Permalink
Browse files

Renamed from DotNetDependencyChecker to the more handy NDepCheck

  • Loading branch information...
1 parent 8371b7d commit 2c531f9f6f8a92084585efc29676ad8882279c7c @thoemmi committed Jul 12, 2012
Showing with 4,994 additions and 4,993 deletions.
  1. +3 −0 .gitignore
  2. +80 −80 src/{DotNetArchitectureChecker.MSBuild → NDepCheck.MSBuild}/DependencyChecker.cs
  3. +97 −97 src/{DotNetArchitectureChecker.MSBuild → NDepCheck.MSBuild}/MSBuildLogger.cs
  4. +62 −62 ...er.MSBuild/DotNetArchitectureChecker.MSBuild.csproj → NDepCheck.MSBuild/NDepCheck.MSBuild.csproj}
  5. +36 −36 src/{DotNetArchitectureChecker.MSBuild → NDepCheck.MSBuild}/Properties/AssemblyInfo.cs
  6. +275 −275 ...DotNetArchitectureCheckerTestAssembly → NDepCheck.TestAssembly}/DotNetArchitectureCheckerTests.cs
  7. +8 −8 src/{DotNetArchitectureCheckerTestAssembly → NDepCheck.TestAssembly}/ISomeInterface.cs
  8. +74 −74 ...NetArchitectureCheckerTestAssembly.csproj → NDepCheck.TestAssembly/NDepCheck.TestAssembly.csproj}
  9. 0 src/{DotNetArchitectureCheckerTestAssemblyÄÖÜß → NDepCheck.TestAssembly}/Properties/AssemblyInfo.cs
  10. 0 ...eckerTestAssemblyÄÖÜß → NDepCheck.TestAssemblyÄÖÜß}/DotNetArchitectureCheckerTestAssembly2.csproj
  11. 0 ...hitectureCheckerTestAssemblyÄÖÜß → NDepCheck.TestAssemblyÄÖÜß}/DotNetArchitectureCheckerTests2.cs
  12. 0 ...ectureCheckerTestAssemblyÄÖÜß → NDepCheck.TestAssemblyÄÖÜß}/DotNetArchitectureCheckerTestsÄÖÜß.cs
  13. +2 −2 ...ureCheckerTestAssemblyÄÖÜß.csproj → NDepCheck.TestAssemblyÄÖÜß/NDepCheck.TestAssemblyÄÖÜß.csproj}
  14. +36 −36 src/{DotNetArchitectureCheckerTestAssembly → NDepCheck.TestAssemblyÄÖÜß}/Properties/AssemblyInfo.cs
  15. +69 −69 src/{DotNetArchitectureCheckerTest → NDepCheck.Tests}/EnumerableComparer.cs
  16. +186 −187 src/{DotNetArchitectureCheckerTest → NDepCheck.Tests}/FileHandlingTests.cs
  17. +378 −379 src/{DotNetArchitectureCheckerTest → NDepCheck.Tests}/MainTests.cs
  18. +112 −112 ...tectureCheckerTest/DotNetArchitectureCheckerTest.csproj → NDepCheck.Tests/NDepCheck.Tests.csproj}
  19. +35 −35 src/{DotNetArchitectureCheckerTest → NDepCheck.Tests}/Properties/AssemblyInfo.cs
  20. +129 −129 src/{DotNetArchitectureCheckerTest → NDepCheck.Tests}/TestDeclarations.cs
  21. +93 −93 src/{DotNetArchitectureCheckerTest → NDepCheck.Tests}/TestDependencies.dep
  22. +44 −44 src/{DotNetArchitectureCheckerAll.sln → NDepCheck.sln}
  23. +57 −57 src/{DotNetArchitectureChecker → NDepCheck}/AssemblyOption.cs
  24. +49 −49 src/{DotNetArchitectureChecker → NDepCheck}/ConsoleLogger.cs
  25. +136 −136 src/{DotNetArchitectureChecker → NDepCheck}/Dependency.cs
  26. +40 −40 src/{DotNetArchitectureChecker → NDepCheck}/DependencyChecker.cs
  27. +227 −227 src/{DotNetArchitectureChecker → NDepCheck}/DependencyGrapher.cs
  28. +338 −338 src/{DotNetArchitectureChecker → NDepCheck}/DependencyReader.cs
  29. +711 −711 src/{DotNetArchitectureChecker → NDepCheck}/DependencyRule.cs
  30. +149 −149 src/{DotNetArchitectureChecker → NDepCheck}/DependencyRuleGroup.cs
  31. +442 −442 src/{DotNetArchitectureChecker → NDepCheck}/DependencyRuleSet.cs
  32. +29 −29 src/{DotNetArchitectureChecker → NDepCheck}/DirectoryOption.cs
  33. +150 −150 src/{DotNetArchitectureChecker → NDepCheck}/DotNetArchitectureCheckerMain.cs
  34. +14 −14 src/{DotNetArchitectureChecker → NDepCheck}/EverythingAllowed.dep
  35. +60 −60 src/{DotNetArchitectureChecker → NDepCheck}/FullNameToken.cs
  36. +64 −64 src/{DotNetArchitectureChecker → NDepCheck}/GraphAbstraction.cs
  37. +11 −11 src/{DotNetArchitectureChecker → NDepCheck}/ILogger.cs
  38. +137 −137 src/{DotNetArchitectureChecker/DotNetArchitectureChecker.csproj → NDepCheck/NDepCheck.csproj}
  39. +415 −415 src/{DotNetArchitectureChecker → NDepCheck}/Options.cs
  40. +142 −142 src/{DotNetArchitectureChecker → NDepCheck}/Pattern.cs
  41. +34 −34 src/{DotNetArchitectureChecker → NDepCheck}/Properties/AssemblyInfo.cs
  42. +6 −6 src/{DotNetArchitectureChecker → NDepCheck}/README.txt
  43. +38 −38 src/{DotNetArchitectureChecker → NDepCheck}/SimpleNameToken.cs
  44. +23 −23 src/{DotNetArchitectureChecker → NDepCheck}/StandardDependencies.dep
  45. +3 −3 src/{DotNetArchitectureChecker → NDepCheck}/app.config
View
@@ -2,3 +2,6 @@ bin
obj
thumbs.db
+
+*.suo
+*.user
@@ -1,81 +1,81 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace DotNetArchitectureChecker.MSBuild {
- public class DependencyChecker : Task {
- public string DotFilename { get; set; }
- public bool ShowTransitiveEdges { get; set; }
- public bool ShowUnusedQuestionableRules { get; set; }
- public ITaskItem DefaultRuleSet { get; set; }
- public bool GenerateErrorHtml { get; set; }
- public bool LogWarnings { get; set; }
-
- [Required]
- public ITaskItem[] Assemblies { get; set; }
-
- public ITaskItem[] Directories { get; set; }
- public bool Verbose;
-
- [Output]
- public string ErrorHtml { get; set; }
-
- [Output]
- public int ExitCode { get; set; }
-
- public override bool Execute() {
- var logger = new MSBuildLogger(Log, GenerateErrorHtml, LogWarnings);
- DotNetArchitectureCheckerMain.Logger = logger;
-
- var options = new Options {
- Debug = false,
- Verbose = Verbose,
- DotFilename = DotFilename,
- ShowTransitiveEdges = ShowTransitiveEdges,
- ShowUnusedQuestionableRules = ShowUnusedQuestionableRules,
- };
- Assemblies
- .Select(item => new AssemblyOption(item.ItemSpec, null))
- .AddTo(options.Assemblies);
-
- if (DefaultRuleSet != null) {
- options.DefaultRuleSet = DependencyRuleSet.Create(new DirectoryInfo("."), DefaultRuleSet.ItemSpec, true, false);
- }
- if (Directories != null) {
- Directories
- .Select(GetDirectoryOptionFromTaskItem)
- .AddTo(options.Directories);
- }
-
- var main = new DotNetArchitectureCheckerMain(options);
- ExitCode = main.Run();
-
- if (GenerateErrorHtml) {
- ErrorHtml = logger.GetErrorHtml();
- }
-
- return ExitCode == 0;
- }
-
- private static DirectoryOption GetDirectoryOptionFromTaskItem(ITaskItem taskItem) {
- bool recursive = true;
- bool tmp;
- var recursiveString = taskItem.GetMetadata("Recursive");
- if (!string.IsNullOrEmpty(recursiveString) && Boolean.TryParse(recursiveString, out tmp)) {
- recursive = tmp;
- }
- return new DirectoryOption(taskItem.ItemSpec, recursive);
- }
- }
-
- public static class EnumerableExtensions {
- public static void AddTo<T>(this IEnumerable<T> source, ICollection<T> target) {
- foreach (var item in source) {
- target.Add(item);
- }
- }
- }
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace NDepCheck.MSBuild {
+ public class DependencyChecker : Task {
+ public string DotFilename { get; set; }
+ public bool ShowTransitiveEdges { get; set; }
+ public bool ShowUnusedQuestionableRules { get; set; }
+ public ITaskItem DefaultRuleSet { get; set; }
+ public bool GenerateErrorHtml { get; set; }
+ public bool LogWarnings { get; set; }
+
+ [Required]
+ public ITaskItem[] Assemblies { get; set; }
+
+ public ITaskItem[] Directories { get; set; }
+ public bool Verbose;
+
+ [Output]
+ public string ErrorHtml { get; set; }
+
+ [Output]
+ public int ExitCode { get; set; }
+
+ public override bool Execute() {
+ var logger = new MSBuildLogger(Log, GenerateErrorHtml, LogWarnings);
+ DotNetArchitectureCheckerMain.Logger = logger;
+
+ var options = new Options {
+ Debug = false,
+ Verbose = Verbose,
+ DotFilename = DotFilename,
+ ShowTransitiveEdges = ShowTransitiveEdges,
+ ShowUnusedQuestionableRules = ShowUnusedQuestionableRules,
+ };
+ Assemblies
+ .Select(item => new AssemblyOption(item.ItemSpec, null))
+ .AddTo(options.Assemblies);
+
+ if (DefaultRuleSet != null) {
+ options.DefaultRuleSet = DependencyRuleSet.Create(new DirectoryInfo("."), DefaultRuleSet.ItemSpec, true, false);
+ }
+ if (Directories != null) {
+ Directories
+ .Select(GetDirectoryOptionFromTaskItem)
+ .AddTo(options.Directories);
+ }
+
+ var main = new DotNetArchitectureCheckerMain(options);
+ ExitCode = main.Run();
+
+ if (GenerateErrorHtml) {
+ ErrorHtml = logger.GetErrorHtml();
+ }
+
+ return ExitCode == 0;
+ }
+
+ private static DirectoryOption GetDirectoryOptionFromTaskItem(ITaskItem taskItem) {
+ bool recursive = true;
+ bool tmp;
+ var recursiveString = taskItem.GetMetadata("Recursive");
+ if (!string.IsNullOrEmpty(recursiveString) && Boolean.TryParse(recursiveString, out tmp)) {
+ recursive = tmp;
+ }
+ return new DirectoryOption(taskItem.ItemSpec, recursive);
+ }
+ }
+
+ public static class EnumerableExtensions {
+ public static void AddTo<T>(this IEnumerable<T> source, ICollection<T> target) {
+ foreach (var item in source) {
+ target.Add(item);
+ }
+ }
+ }
}
@@ -1,98 +1,98 @@
-using System.Collections.Generic;
-using System.Text;
-using System.Web;
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace DotNetArchitectureChecker.MSBuild {
- public class MSBuildLogger : ILogger {
- private readonly TaskLoggingHelper _log;
- private readonly bool _generateErrorHtml;
- private readonly bool _logWarnings;
- private string _currentAssemblyFilename;
- private bool _currentAssemblyFilenameWasLogged;
- private readonly StringBuilder _stringBuilder = new StringBuilder();
- private readonly Dictionary<string,int> _assembliesWithErrors = new Dictionary<string, int>();
-
- public MSBuildLogger(TaskLoggingHelper log, bool generateErrorHtml, bool logWarnings) {
- _log = log;
- _generateErrorHtml = generateErrorHtml;
- _logWarnings = logWarnings;
- }
-
- public void StartProcessingAssembly(string assemblyFilename) {
- _currentAssemblyFilename = assemblyFilename;
- _currentAssemblyFilenameWasLogged = false;
- }
-
- public void WriteError(string msg) {
- _log.LogError(msg);
- AppendErrorToHtml(msg);
- }
-
- public void WriteError(string msg, string fileName, uint startLine, uint startColumn, uint endLine, uint endColumn) {
- _log.LogError((string)null, (string)null, (string)null, fileName, (int)startLine, (int)startColumn, (int)endLine, (int)endColumn, msg);
- AppendErrorToHtml(Format(msg, fileName, startLine));
- }
-
- private void AppendErrorToHtml(string msg) {
- if (!_generateErrorHtml) {
- return;
- }
- if (!_currentAssemblyFilenameWasLogged) {
- _stringBuilder.AppendLine("<h3><a name=\"" + _currentAssemblyFilename + "\">" + _currentAssemblyFilename + "</a></h3>");
- _currentAssemblyFilenameWasLogged = true;
- }
- lock (_assembliesWithErrors) {
- int errors;
- _assembliesWithErrors.TryGetValue(_currentAssemblyFilename, out errors);
- _assembliesWithErrors[_currentAssemblyFilename] = errors + 1;
- }
- _stringBuilder.AppendLine("<span style=\"color: red;\"/>" + HttpUtility.HtmlEncode(msg) + "</span><hr center width=\"80%\">");
- }
-
- public void WriteWarning(string msg) {
- _log.LogWarning(msg);
- }
-
- public void WriteWarning(string msg, string fileName, uint startLine, uint startColumn, uint endLine, uint endColumn) {
- if (_logWarnings) {
- _log.LogWarning((string) null, (string) null, (string) null, fileName, (int) startLine, (int) startColumn, (int) endLine,
- (int) endColumn, msg);
- }
- }
-
- public void WriteInfo(string msg) {
- _log.LogMessage(MessageImportance.Normal, msg);
- }
-
- public void WriteDebug(string msg) {
- _log.LogMessage(MessageImportance.Low, msg);
- }
-
- private static string Format(string msg, string fileName, uint lineNumber) {
- if (fileName != null) {
- msg += " (probably at " + fileName;
- if (lineNumber > 0)
- msg += ":" + lineNumber;
- msg += ")";
- }
- return msg;
- }
-
- public string GetErrorHtml() {
- var summary = new StringBuilder();
- summary.AppendLine("<h2>Summary</h2>");
- if (_assembliesWithErrors.Count > 0) {
- foreach (var assembly in _assembliesWithErrors) {
- summary.AppendFormat("<a href=\"#{0}\">{0}</a>: {1} error{2}<br/>", assembly.Key, assembly.Value, assembly.Value == 1 ? "" : "s");
- summary.AppendLine();
- }
- summary.AppendLine("<hr center width=\"80%\" />");
- } else {
- summary.AppendLine("Congratulations, no errors detected");
- }
- return summary.ToString() + _stringBuilder.ToString();
- }
- }
+using System.Collections.Generic;
+using System.Text;
+using System.Web;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace NDepCheck.MSBuild {
+ public class MSBuildLogger : ILogger {
+ private readonly TaskLoggingHelper _log;
+ private readonly bool _generateErrorHtml;
+ private readonly bool _logWarnings;
+ private string _currentAssemblyFilename;
+ private bool _currentAssemblyFilenameWasLogged;
+ private readonly StringBuilder _stringBuilder = new StringBuilder();
+ private readonly Dictionary<string,int> _assembliesWithErrors = new Dictionary<string, int>();
+
+ public MSBuildLogger(TaskLoggingHelper log, bool generateErrorHtml, bool logWarnings) {
+ _log = log;
+ _generateErrorHtml = generateErrorHtml;
+ _logWarnings = logWarnings;
+ }
+
+ public void StartProcessingAssembly(string assemblyFilename) {
+ _currentAssemblyFilename = assemblyFilename;
+ _currentAssemblyFilenameWasLogged = false;
+ }
+
+ public void WriteError(string msg) {
+ _log.LogError(msg);
+ AppendErrorToHtml(msg);
+ }
+
+ public void WriteError(string msg, string fileName, uint startLine, uint startColumn, uint endLine, uint endColumn) {
+ _log.LogError((string)null, (string)null, (string)null, fileName, (int)startLine, (int)startColumn, (int)endLine, (int)endColumn, msg);
+ AppendErrorToHtml(Format(msg, fileName, startLine));
+ }
+
+ private void AppendErrorToHtml(string msg) {
+ if (!_generateErrorHtml) {
+ return;
+ }
+ if (!_currentAssemblyFilenameWasLogged) {
+ _stringBuilder.AppendLine("<h3><a name=\"" + _currentAssemblyFilename + "\">" + _currentAssemblyFilename + "</a></h3>");
+ _currentAssemblyFilenameWasLogged = true;
+ }
+ lock (_assembliesWithErrors) {
+ int errors;
+ _assembliesWithErrors.TryGetValue(_currentAssemblyFilename, out errors);
+ _assembliesWithErrors[_currentAssemblyFilename] = errors + 1;
+ }
+ _stringBuilder.AppendLine("<span style=\"color: red;\"/>" + HttpUtility.HtmlEncode(msg) + "</span><hr center width=\"80%\">");
+ }
+
+ public void WriteWarning(string msg) {
+ _log.LogWarning(msg);
+ }
+
+ public void WriteWarning(string msg, string fileName, uint startLine, uint startColumn, uint endLine, uint endColumn) {
+ if (_logWarnings) {
+ _log.LogWarning((string) null, (string) null, (string) null, fileName, (int) startLine, (int) startColumn, (int) endLine,
+ (int) endColumn, msg);
+ }
+ }
+
+ public void WriteInfo(string msg) {
+ _log.LogMessage(MessageImportance.Normal, msg);
+ }
+
+ public void WriteDebug(string msg) {
+ _log.LogMessage(MessageImportance.Low, msg);
+ }
+
+ private static string Format(string msg, string fileName, uint lineNumber) {
+ if (fileName != null) {
+ msg += " (probably at " + fileName;
+ if (lineNumber > 0)
+ msg += ":" + lineNumber;
+ msg += ")";
+ }
+ return msg;
+ }
+
+ public string GetErrorHtml() {
+ var summary = new StringBuilder();
+ summary.AppendLine("<h2>Summary</h2>");
+ if (_assembliesWithErrors.Count > 0) {
+ foreach (var assembly in _assembliesWithErrors) {
+ summary.AppendFormat("<a href=\"#{0}\">{0}</a>: {1} error{2}<br/>", assembly.Key, assembly.Value, assembly.Value == 1 ? "" : "s");
+ summary.AppendLine();
+ }
+ summary.AppendLine("<hr center width=\"80%\" />");
+ } else {
+ summary.AppendLine("Congratulations, no errors detected");
+ }
+ return summary.ToString() + _stringBuilder.ToString();
+ }
+ }
}
Oops, something went wrong.

0 comments on commit 2c531f9

Please sign in to comment.