Skip to content

Commit

Permalink
Add whitespace examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel committed Mar 19, 2024
1 parent 90ed38b commit 8c2714d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 62 deletions.
Expand Up @@ -27,14 +27,14 @@ public sealed class RegexContext
{
private static readonly RegexOptions ValidationMask = (RegexOptions)int.MaxValue ^ RegexOptions.Compiled;

private static readonly string[] MatchMethods = new[]
{
private static readonly string[] MatchMethods =
[
nameof(Regex.IsMatch),
nameof(Regex.Match),
nameof(Regex.Matches),
nameof(Regex.Replace),
nameof(Regex.Split),
};
];

public SyntaxNode PatternNode { get; }
public string Pattern { get; }
Expand Down
@@ -1,6 +1,6 @@
/*
* SonarAnalyzer for .NET
* Copyright (C) 2015-2023 SonarSource SA
* Copyright (C) 2015-2024 SonarSource SA
* mailto: contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
Expand All @@ -21,7 +21,7 @@
using CS = SonarAnalyzer.Rules.CSharp;
using VB = SonarAnalyzer.Rules.VisualBasic;

namespace SonarAnalyzer.UnitTest.Rules;
namespace SonarAnalyzer.Test.Rules;

[TestClass]
public class RegexShouldNotContainMultipleSpacesTest
Expand Down
Expand Up @@ -45,6 +45,13 @@ bool WhiteSpaceVariations(string input)
|| Regex.IsMatch(input, "without_spaces")
|| Regex.IsMatch(input, "with\ttab")
|| Regex.IsMatch(input, "")
|| Regex.IsMatch(input, "\x09 character tabulation")
|| Regex.IsMatch(input, "\x0A line feed")
|| Regex.IsMatch(input, "\x0B line tabulation")
|| Regex.IsMatch(input, "\x0C form feed")
|| Regex.IsMatch(input, "\x0D carriage feed")
|| Regex.IsMatch(input, "\x85 next line")
|| Regex.IsMatch(input, "\xA0 non-break space")
|| Regex.IsMatch(input, "ignore pattern white space", RegexOptions.IgnorePatternWhitespace);
}
}
Expand Down

This file was deleted.

0 comments on commit 8c2714d

Please sign in to comment.