-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Quentin Martinez
authored and
Quentin Martinez
committed
Mar 7, 2018
1 parent
ca5eff4
commit 20d6ae7
Showing
24 changed files
with
505 additions
and
101 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace appRegex.Rules | ||
{ | ||
public class Comment : IRules | ||
{ | ||
public Comment() | ||
{ | ||
} | ||
public void Verify(string filename, string[] content) | ||
{ | ||
for (int i = 0; i < content.Length; i++) | ||
{ | ||
string line = content[i]; | ||
|
||
Regex reg = new Regex(@"^((\s)*\/\/)\s*"); | ||
|
||
if (reg.Match(line).Success) | ||
{ | ||
Console.WriteLine($"[{filename}]:[{i}] Wrong type comment."); | ||
} | ||
reg = new Regex(@"^((\s)*\/\*)\s*"); | ||
if (reg.Match(line).Success) | ||
{ | ||
//Console.WriteLine($"[{filename}]:[{i}] Comment in function forbiden."); | ||
} | ||
|
||
} | ||
|
||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace appRegex.Rules | ||
{ | ||
public class Header | ||
public class Header : IRules | ||
{ | ||
public Header() | ||
{ | ||
} | ||
|
||
public void Verify(string filename, string[] content) | ||
{ | ||
|
||
var str = string.Concat(content); | ||
var match = new Regex(@"(\/\*([\s\w_\.\>@\<#\/\:\+]|\*{74})+\*\/)", RegexOptions.Multiline).Matches(str); | ||
if (match.Count <= 10){ | ||
Console.WriteLine($"[{filename}]:[1] Missing or corrupted header."); | ||
} else{ | ||
if (!String.IsNullOrEmpty(content[match.Count])) | ||
{ | ||
Console.WriteLine($"[{filename}]:[{match.Count}] Missing an empty line after header."); | ||
} | ||
} | ||
|
||
|
||
} | ||
} | ||
} |
Oops, something went wrong.