Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Engine/Generic/AvoidCmdletGeneric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
/// <returns>The source name of the rule.</returns>
public abstract string GetSourceName();

/// <summary>
/// GetSourceType: Retrieves the source type of the rule.
/// </summary>
/// <returns>The source type of the rule.</returns>
public abstract SourceType GetSourceType();

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions Engine/Generic/AvoidParameterGeneric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
/// <returns>The source name of the rule.</returns>
public abstract string GetSourceName();

/// <summary>
/// GetSourceType: Retrieves the source type of the rule.
/// </summary>
/// <returns>The source type of the rule.</returns>
public abstract SourceType GetSourceType();

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions Engine/Generic/ConfigurableRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ public virtual void ConfigureRule(IDictionary<string, object> paramValueMap)
/// <returns>The source name of the rule.</returns>
public abstract string GetSourceName();

/// <summary>
/// Retrieves the source type of the rule.
/// </summary>
/// <returns>The source type of the rule.</returns>
public abstract SourceType GetSourceType();

private void SetDefaultValues()
Expand Down
7 changes: 2 additions & 5 deletions Engine/Generic/ExternalRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ public string GetParameter()
return this.param;
}

public SourceType GetSourceType()
{
return SourceType.Module;
}
public SourceType GetSourceType() => SourceType.Module;

public string GetParameterType()
{
Expand All @@ -71,7 +68,7 @@ public string GetFullModulePath()
#endregion

#region Constructors

public ExternalRule()
{

Expand Down
10 changes: 2 additions & 8 deletions Rules/AlignAssignmentStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ var member in enumTypeDefAst.Members.Where(
// Next we need to find the location of the equals sign for this
// member. We know the line it should be on. We can
// search all of the equals signs on that line.
//
//
// Unlike hashtables, we don't have an extent for the LHS and
// RHS of the member. We have the extent of the entire
// member, the name of the member, and the extent of the
Expand Down Expand Up @@ -699,12 +699,6 @@ public override string GetSourceName()
return string.Format(CultureInfo.CurrentCulture, Strings.SourceName);
}

/// <summary>
/// Retrieves the type of the rule, Builtin, Managed or Module.
/// </summary>
public override SourceType GetSourceType()
{
return SourceType.Builtin;
}
public override SourceType GetSourceType() => SourceType.Builtin;
}
}
10 changes: 2 additions & 8 deletions Rules/AvoidAlias.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void SetProperties()
{
return;
}
// Fallback for object from legacy allowlist argument name
// Fallback for object from legacy allowlist argument name
if (obj == null) {
obj = objLegacy;
}
Expand Down Expand Up @@ -260,13 +260,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidUsingCmdletAliasesDescription);
}

/// <summary>
/// GetSourceType: Retrieves the type of the rule, Builtin, Managed or Module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
Expand Down
8 changes: 1 addition & 7 deletions Rules/AvoidAssignmentToAutomaticVariable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidAssignmentToReadOnlyAutomaticVariableDescription);
}

/// <summary>
/// GetSourceType: Retrieves the type of the rule: builtin, managed or module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
Expand Down
8 changes: 1 addition & 7 deletions Rules/AvoidDefaultTrueValueSwitchParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidDefaultValueSwitchParameterDescription);
}

/// <summary>
/// GetSourceType: Retrieves the type of the rule, builtin, managed or module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
Expand Down
12 changes: 3 additions & 9 deletions Rules/AvoidDefaultValueForMandatoryParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
/// <param name="paramAst">The parameter AST to examine</param>
/// <param name="comparer">String comparer for case-insensitive attribute name matching</param>
/// <returns>
/// True if the parameter has at least one [Parameter] attribute and ALL of them
/// True if the parameter has at least one [Parameter] attribute and ALL of them
/// have the Mandatory named argument set to true (explicitly or implicitly).
/// False if the parameter has no [Parameter] attributes or if any [Parameter]
/// False if the parameter has no [Parameter] attributes or if any [Parameter]
/// attribute does not have Mandatory=true.
/// </returns>
private static bool HasMandatoryInAllParameterAttributes(ParameterAst paramAst)
Expand Down Expand Up @@ -122,13 +122,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidDefaultValueForMandatoryParameterDescription);
}

/// <summary>
/// Method: Retrieves the type of the rule: builtin, managed or module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
Expand Down
8 changes: 1 addition & 7 deletions Rules/AvoidEmptyCatchBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidUsingEmptyCatchBlockDescription);
}

/// <summary>
/// Method: Retrieves the type of the rule: builtin, managed or module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
Expand Down
16 changes: 5 additions & 11 deletions Rules/AvoidExclaimOperator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
};
diagnosticRecords.Add(new DiagnosticRecord(
string.Format(
CultureInfo.CurrentCulture,
CultureInfo.CurrentCulture,
Strings.AvoidExclaimOperatorError
),
unaryExpressionAst.Extent,
),
unaryExpressionAst.Extent,
GetName(),
GetDiagnosticSeverity(),
GetDiagnosticSeverity(),
fileName,
suggestedCorrections: corrections
));
Expand Down Expand Up @@ -135,13 +135,7 @@ public override string GetSourceName()
return string.Format(CultureInfo.CurrentCulture, Strings.SourceName);
}

/// <summary>
/// Retrieves the type of the rule, Builtin, Managed or Module.
/// </summary>
public override SourceType GetSourceType()
{
return SourceType.Builtin;
}
public override SourceType GetSourceType() => SourceType.Builtin;
}
}

5 changes: 1 addition & 4 deletions Rules/AvoidGlobalAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ public string GetSourceName()
return string.Format(CultureInfo.CurrentCulture, Strings.SourceName);
}

public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;
}
}
5 changes: 1 addition & 4 deletions Rules/AvoidGlobalFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ public string GetSourceName()
return string.Format(CultureInfo.CurrentCulture, Strings.SourceName);
}

public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;
}
}
8 changes: 1 addition & 7 deletions Rules/AvoidGlobalVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidGlobalVarsDescription);
}

/// <summary>
/// Method: Retrieves the type of the rule: builtin, managed or module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
Expand Down
14 changes: 4 additions & 10 deletions Rules/AvoidInvokingEmptyMembers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
// Rule name is inconsistent.
/// <summary>
/// AvoidInvokingEmptyMembers: Analyzes the script to check if any non-constant members have been invoked.
/// </summary>
/// </summary>
#if !CORECLR
[Export(typeof(IScriptRule))]
#endif
Expand Down Expand Up @@ -55,10 +55,10 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
}
}
}

}


/// <summary>
/// GetName: Retrieves the name of this rule.
/// </summary>
Expand Down Expand Up @@ -86,13 +86,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidInvokingEmptyMembersDescription);
}

/// <summary>
/// GetSourceType: Retrieves the type of the rule, Builtin, Managed or Module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
Expand Down
10 changes: 2 additions & 8 deletions Rules/AvoidLongLines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
));

var record = new DiagnosticRecord(
String.Format(CultureInfo.CurrentCulture,
String.Format(CultureInfo.CurrentCulture,
String.Format(Strings.AvoidLongLinesError, MaximumLineLength)),
violationExtent,
GetName(),
Expand Down Expand Up @@ -145,12 +145,6 @@ public override string GetSourceName()
return string.Format(CultureInfo.CurrentCulture, Strings.SourceName);
}

/// <summary>
/// Retrieves the type of the rule, Builtin, Managed or Module.
/// </summary>
public override SourceType GetSourceType()
{
return SourceType.Builtin;
}
public override SourceType GetSourceType() => SourceType.Builtin;
}
}
16 changes: 5 additions & 11 deletions Rules/AvoidMultipleTypeAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed class AvoidMultipleTypeAttributes : IScriptRule
/// </summary>
public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
{
if (ast is null)
if (ast is null)
{
throw new ArgumentNullException(Strings.NullAstErrorMessage);
}
Expand All @@ -42,13 +42,13 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
yield return new DiagnosticRecord(
String.Format(CultureInfo.CurrentCulture, Strings.AvoidMultipleTypeAttributesError, paramAst.Name),
paramAst.Name.Extent,
GetName(),
DiagnosticSeverity.Warning,
GetName(),
DiagnosticSeverity.Warning,
fileName);
}
}
}

/// <summary>
/// GetName: Retrieves the name of this rule.
/// </summary>
Expand Down Expand Up @@ -76,13 +76,7 @@ public string GetDescription()
return string.Format(CultureInfo.CurrentCulture, Strings.AvoidMultipleTypeAttributesDescription);
}

/// <summary>
/// GetSourceType: Retrieves the type of the rule, Builtin, Managed or Module.
/// </summary>
public SourceType GetSourceType()
{
return SourceType.Builtin;
}
public SourceType GetSourceType() => SourceType.Builtin;

/// <summary>
/// GetSeverity: Retrieves the severity of the rule: error, warning or information.
Expand Down
Loading