@@ -62,20 +62,20 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
62
62
if ( _readOnlyAutomaticVariables . Contains ( variableName , StringComparer . OrdinalIgnoreCase ) )
63
63
{
64
64
yield return new DiagnosticRecord ( DiagnosticRecordHelper . FormatError ( Strings . AvoidAssignmentToReadOnlyAutomaticVariableError , variableName ) ,
65
- variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Error , fileName ) ;
65
+ variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Error , fileName , variableName ) ;
66
66
}
67
67
68
68
if ( _readOnlyAutomaticVariablesIntroducedInVersion6_0 . Contains ( variableName , StringComparer . OrdinalIgnoreCase ) )
69
69
{
70
70
var severity = IsPowerShellVersion6OrGreater ( ) ? DiagnosticSeverity . Error : DiagnosticSeverity . Warning ;
71
71
yield return new DiagnosticRecord ( DiagnosticRecordHelper . FormatError ( Strings . AvoidAssignmentToReadOnlyAutomaticVariableIntroducedInPowerShell6_0Error , variableName ) ,
72
- variableExpressionAst . Extent , GetName ( ) , severity , fileName ) ;
72
+ variableExpressionAst . Extent , GetName ( ) , severity , fileName , variableName ) ;
73
73
}
74
74
75
75
if ( _writableAutomaticVariables . Contains ( variableName , StringComparer . OrdinalIgnoreCase ) )
76
76
{
77
77
yield return new DiagnosticRecord ( DiagnosticRecordHelper . FormatError ( Strings . AvoidAssignmentToWritableAutomaticVariableError , variableName ) ,
78
- variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Warning , fileName ) ;
78
+ variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Warning , fileName , variableName ) ;
79
79
}
80
80
}
81
81
@@ -93,20 +93,20 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
93
93
if ( _readOnlyAutomaticVariables . Contains ( variableName , StringComparer . OrdinalIgnoreCase ) )
94
94
{
95
95
yield return new DiagnosticRecord ( DiagnosticRecordHelper . FormatError ( Strings . AvoidAssignmentToReadOnlyAutomaticVariableError , variableName ) ,
96
- variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Error , fileName ) ;
96
+ variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Error , fileName , variableName ) ;
97
97
}
98
98
99
99
if ( _readOnlyAutomaticVariablesIntroducedInVersion6_0 . Contains ( variableName , StringComparer . OrdinalIgnoreCase ) )
100
100
{
101
101
var severity = IsPowerShellVersion6OrGreater ( ) ? DiagnosticSeverity . Error : DiagnosticSeverity . Warning ;
102
102
yield return new DiagnosticRecord ( DiagnosticRecordHelper . FormatError ( Strings . AvoidAssignmentToReadOnlyAutomaticVariableIntroducedInPowerShell6_0Error , variableName ) ,
103
- variableExpressionAst . Extent , GetName ( ) , severity , fileName ) ;
103
+ variableExpressionAst . Extent , GetName ( ) , severity , fileName , variableName ) ;
104
104
}
105
105
106
106
if ( _writableAutomaticVariables . Contains ( variableName , StringComparer . OrdinalIgnoreCase ) )
107
107
{
108
108
yield return new DiagnosticRecord ( DiagnosticRecordHelper . FormatError ( Strings . AvoidAssignmentToWritableAutomaticVariableError , variableName ) ,
109
- variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Warning , fileName ) ;
109
+ variableExpressionAst . Extent , GetName ( ) , DiagnosticSeverity . Warning , fileName , variableName ) ;
110
110
}
111
111
}
112
112
}
0 commit comments