Skip to content

Commit

Permalink
methods don't need to be static and don't need the paramateres
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed Mar 14, 2023
1 parent 0023ff2 commit 887e070
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions analyzers/src/SonarAnalyzer.Common/Helpers/SonarLintXmlReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ public SonarLintXmlReader(SourceText sonarLintXml, string language)

public bool IsFileIncluded(string filePath, bool isTestProject) =>
isTestProject
? IsFileIncluded(TestInclusions, TestExclusions, GlobalTestExclusions, filePath)
: IsFileIncluded(Inclusions, Exclusions, GlobalExclusions, filePath);
? IsFileIncluded(filePath)
: IsFileIncluded(filePath);

private static bool IsFileIncluded(string[] inclusions, string[] exclusions, string[] globalExclusions, string filePath) =>
IsIncluded(inclusions, filePath)
&& !IsExcluded(exclusions, filePath)
&& !IsExcluded(globalExclusions, filePath);
private bool IsFileIncluded(string filePath) =>
IsIncluded(filePath)
&& !IsExcluded(filePath)
&& !IsExcluded(filePath);

private static bool IsIncluded(string[] inclusions, string filePath) =>
inclusions is { Length: 0 } || inclusions.Any(x => WildcardPatternMatcher.IsMatch(x, filePath));
private bool IsIncluded(string filePath) =>
Inclusions is { Length: 0 } || Inclusions.Any(x => WildcardPatternMatcher.IsMatch(x, filePath));

private static bool IsExcluded(string[] exclusions, string filePath) =>
exclusions.Any(x => WildcardPatternMatcher.IsMatch(x, filePath));
private bool IsExcluded(string filePath) =>
Exclusions.Any(x => WildcardPatternMatcher.IsMatch(x, filePath));

private static SonarLintXml ParseContent(SourceText sonarLintXml)
{
Expand Down

0 comments on commit 887e070

Please sign in to comment.