Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensuring only valid PascalCharacters (#99)
* Ensuring only valid PascalCharacters Fixes #80 Questions: Is it acceptable to only allow upper/lower/number for naming on methods/properties/fields? Any counter examples? * Updating unit tests to 3.1 Setting pipeline to install .NET Core 3.1
- Loading branch information
Showing
9 changed files
with
151 additions
and
7 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
IntelliTect.Analyzer/IntelliTect.Analyzer.Test/IntelliTect.Analyzer.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
IntelliTect.Analyzer/IntelliTect.Analyzer/Naming/Casing.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace IntelliTect.Analyzer.Naming | ||
{ | ||
internal static class Casing | ||
{ | ||
public static bool IsPascalCase(IEnumerable<char> name) | ||
{ | ||
bool isFirst = true; | ||
foreach (char character in name) | ||
{ | ||
if (isFirst && !char.IsUpper(character)) | ||
{ | ||
return false; | ||
} | ||
|
||
isFirst = false; | ||
if (char.IsUpper(character) || | ||
char.IsLower(character) || | ||
char.IsNumber(character)) | ||
{ | ||
continue; | ||
} | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters