-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix headers of new files; resolve conflicts; exempt generated files
- Loading branch information
1 parent
985ecd9
commit 326ebf7
Showing
275 changed files
with
450 additions
and
5,627 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,98 @@ | ||
////////////////////////////////////////////////////////////////////// | ||
// CHECK FOR MISSING AND NON-STANDARD FILE HEADERS | ||
////////////////////////////////////////////////////////////////////// | ||
|
||
static readonly int CD_LENGTH = Environment.CurrentDirectory.Length + 1; | ||
|
||
static readonly string[] EXEMPT_FILES = new [] { | ||
"AssemblyInfo.cs", | ||
"Options.cs", | ||
"ProcessUtils.cs", | ||
"ProcessUtilsTests.cs" | ||
}; | ||
|
||
// Standard Header. Change this for each project as needed. | ||
static readonly string[] STD_HDR = new [] { | ||
"// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt" | ||
}; | ||
|
||
Task("CheckHeaders") | ||
.Does(() => | ||
{ | ||
var NoHeader = new List<FilePath>(); | ||
var NonStandard = new List<FilePath>(); | ||
var Exempted = new List<FilePath>(); | ||
int examined = 0; | ||
foreach(var file in GetFiles("src/**/*.cs")) | ||
{ | ||
// Ignore autogenerated files in an obj directory | ||
if (file.ToString().Contains("/obj/")) | ||
continue; | ||
examined++; | ||
var header = GetHeader(file); | ||
if (EXEMPT_FILES.Contains(file.GetFilename().ToString())) | ||
Exempted.Add(file); | ||
else if (header.Count == 0) | ||
NoHeader.Add(file); | ||
else if (!header.SequenceEqual(STD_HDR)) | ||
NonStandard.Add(file); | ||
} | ||
if (NoHeader.Count > 0) | ||
{ | ||
Information("\nFILES WITH NO HEADER\n"); | ||
foreach(var file in NoHeader) | ||
Information(RelPathTo(file)); | ||
} | ||
if (NonStandard.Count > 0) | ||
{ | ||
Information("\nFILES WITH A NON-STANDARD HEADER\n"); | ||
foreach(var file in NonStandard) | ||
{ | ||
Information(RelPathTo(file)); | ||
Information(""); | ||
foreach(string line in GetHeader(file)) | ||
Information(line); | ||
Information(""); | ||
} | ||
} | ||
if (Exempted.Count > 0) | ||
{ | ||
Information("\nEXEMPTED FILES (NO CHECK MADE)\n"); | ||
foreach(var file in Exempted) | ||
Information(RelPathTo(file)); | ||
} | ||
Information($"\nFiles Examined: {examined}"); | ||
Information($"Missing Headers: {NoHeader.Count}"); | ||
Information($"Non-Standard Headers: {NonStandard.Count}"); | ||
Information($"Exempted Files: {Exempted.Count}"); | ||
if (NoHeader.Count > 0 || NonStandard.Count > 0) | ||
throw new Exception("Missing or invalid file headers found"); | ||
}); | ||
|
||
private List<string> GetHeader(FilePath file) | ||
{ | ||
var header = new List<string>(); | ||
var lines = System.IO.File.ReadLines(file.ToString()); | ||
|
||
foreach(string line in lines) | ||
{ | ||
if (!line.StartsWith("//")) | ||
break; | ||
|
||
header.Add(line); | ||
} | ||
|
||
return header; | ||
} | ||
|
||
private string RelPathTo(FilePath file) | ||
{ | ||
return file.ToString().Substring(CD_LENGTH); | ||
} |
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,30 @@ | ||
// Copyright (c) The NUnit Project and distributed under the MIT License | ||
|
||
// This file contains tasks intended to be run locally by developers | ||
// in any NUnit project. To use these tasks in a project, copy the file | ||
// to an accessible directory and #load it in your build.cake file. | ||
|
||
// Since the tasks are intended for use by the NUnit Project, it follows | ||
// certain conventions and will need to be modified for use elsewhere. | ||
|
||
using System.Linq; | ||
|
||
////////////////////////////////////////////////////////////////////// | ||
// DELETE ALL OBJ DIRECTORIES | ||
////////////////////////////////////////////////////////////////////// | ||
|
||
Task("DeleteObjectDirectories") | ||
.WithCriteria(BuildSystem.IsLocalBuild) | ||
.Does(() => | ||
{ | ||
Information("Deleting object directories"); | ||
foreach (var dir in GetDirectories("src/**/obj/")) | ||
DeleteDirectory(dir, new DeleteDirectorySettings() { Recursive = true }); | ||
}); | ||
|
||
// NOTE: Any project to which this file is added is required to have a 'Clean' target | ||
Task("CleanAll") | ||
.Description("Perform standard 'Clean' followed by deleting object directories") | ||
.IsDependentOn("Clean") | ||
.IsDependentOn("DeleteObjectDirectories"); |
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
23 changes: 1 addition & 22 deletions
23
src/NUnitConsole/nunit3-console.tests/ConsoleOutputTests.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
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
Oops, something went wrong.