@@ -157,24 +157,26 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
157
157
private DiagnosticRecord CheckForImplicitGetAliasing ( string commandName , CommandAst commandAst , string fileName )
158
158
{
159
159
bool isNativeCommand = Helper . Instance . GetCommandInfo ( commandName , CommandTypes . Application | CommandTypes . ExternalScript ) != null ;
160
- if ( ! isNativeCommand )
160
+ if ( isNativeCommand )
161
161
{
162
- var commdNameWithGetPrefix = $ "Get-{ commandName } ";
163
- var cmdletNameIfCommandWasMissingGetPrefix = Helper . Instance . GetCommandInfo ( $ "Get-{ commandName } ") ;
164
- if ( cmdletNameIfCommandWasMissingGetPrefix != null )
165
- {
166
- var diagnosticRecord = new DiagnosticRecord (
167
- string . Format ( CultureInfo . CurrentCulture , Strings . AvoidUsingCmdletAliasesMissingGetPrefixError , commandName , commdNameWithGetPrefix ) ,
168
- GetCommandExtent ( commandAst ) ,
169
- GetName ( ) ,
170
- DiagnosticSeverity . Warning ,
171
- fileName ,
172
- commandName ,
173
- suggestedCorrections : GetCorrectionExtent ( commandAst , commdNameWithGetPrefix ) ) ;
174
- return diagnosticRecord ;
175
- }
162
+ return null ;
163
+ }
164
+ var commdNameWithGetPrefix = $ "Get-{ commandName } ";
165
+ var cmdletNameIfCommandWasMissingGetPrefix = Helper . Instance . GetCommandInfo ( $ "Get-{ commandName } ") ;
166
+ if ( cmdletNameIfCommandWasMissingGetPrefix == null )
167
+ {
168
+ return null ;
176
169
}
177
- return null ;
170
+
171
+ var diagnosticRecord = new DiagnosticRecord (
172
+ string . Format ( CultureInfo . CurrentCulture , Strings . AvoidUsingCmdletAliasesMissingGetPrefixError , commandName , commdNameWithGetPrefix ) ,
173
+ GetCommandExtent ( commandAst ) ,
174
+ GetName ( ) ,
175
+ DiagnosticSeverity . Warning ,
176
+ fileName ,
177
+ commandName ,
178
+ suggestedCorrections : GetCorrectionExtent ( commandAst , commdNameWithGetPrefix ) ) ;
179
+ return diagnosticRecord ;
178
180
}
179
181
180
182
/// <summary>
0 commit comments