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
2 changes: 1 addition & 1 deletion Engine/Generic/RuleSuppression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public static List<RuleSuppression> GetSuppressions(IEnumerable<AttributeAst> at

if (targetAsts != null)
{
if (targetAsts.Count() == 0)
if (!targetAsts.Any())
{
if (String.IsNullOrWhiteSpace(scopeAst.Extent.File))
{
Expand Down
8 changes: 4 additions & 4 deletions Engine/ScriptAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ internal bool ParseProfile(object profileObject, PathIntrinsics path, IOutputWri
return false;
}

this.severity = (severityList.Count() == 0) ? null : severityList.ToArray();
this.includeRule = (includeRuleList.Count() == 0) ? null : includeRuleList.ToArray();
this.excludeRule = (excludeRuleList.Count() == 0) ? null : excludeRuleList.ToArray();
this.severity = (severityList.Count == 0) ? null : severityList.ToArray();
this.includeRule = (includeRuleList.Count == 0) ? null : includeRuleList.ToArray();
this.excludeRule = (excludeRuleList.Count == 0) ? null : excludeRuleList.ToArray();
if (settings != null
&& settings.ContainsKey("Rules"))
{
Expand Down Expand Up @@ -609,7 +609,7 @@ private bool ParseProfileString(string profile, PathIntrinsics path, IOutputWrit
IEnumerable<Ast> hashTableAsts = profileAst.FindAll(item => item is HashtableAst, false);

// no hashtable, raise warning
if (hashTableAsts.Count() == 0)
if (!hashTableAsts.Any())
{
writer.WriteError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.InvalidProfile, profile)),
Strings.ConfigurationFileHasNoHashTable, ErrorCategory.ResourceUnavailable, profile));
Expand Down
2 changes: 1 addition & 1 deletion Engine/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ private void parseSettingsFile(string settingsFilePath)
IEnumerable<Ast> hashTableAsts = profileAst.FindAll(item => item is HashtableAst, false);

// no hashtable, raise warning
if (hashTableAsts.Count() == 0)
if (!hashTableAsts.Any())
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.InvalidProfile, settingsFilePath));
}
Expand Down
2 changes: 1 addition & 1 deletion Rules/AvoidMultipleTypeAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
// Iterates all ParamAsts and check the number of its types.
foreach (ParameterAst paramAst in paramAsts)
{
if (paramAst.Attributes.Where(typeAst => typeAst is TypeConstraintAst).Count() > 1)
if (paramAst.Attributes.OfType<TypeConstraintAst>().Skip(1).Any())
{
yield return new DiagnosticRecord(
String.Format(CultureInfo.CurrentCulture, Strings.AvoidMultipleTypeAttributesError, paramAst.Name),
Expand Down