-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from hvanbakel/move
Move logic to respective places
- Loading branch information
Showing
17 changed files
with
361 additions
and
201 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
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,36 +1,35 @@ | ||
using System.Collections.Generic; | ||
using Project2015To2017.Analysis.Diagnostics; | ||
using System.Collections.Generic; | ||
|
||
namespace Project2015To2017.Analysis | ||
{ | ||
public sealed class DiagnosticSet : HashSet<IDiagnostic> | ||
{ | ||
public static readonly IDiagnostic W001 = new W001IllegalProjectTypeDiagnostic(); | ||
// W002 is not a real diagnostic | ||
public static readonly IDiagnostic W002 = new W002MissingProjectFileDiagnostic(); | ||
public static readonly IDiagnostic W010 = new W010ConfigurationsMismatchDiagnostic(); | ||
public static readonly IDiagnostic W011 = new W011UnsupportedConditionalDiagnostic(); | ||
public static readonly IDiagnostic W020 = new W020MicrosoftCSharpDiagnostic(); | ||
public static readonly IDiagnostic W021 = new W021SystemNuGetPackagesDiagnostic(); | ||
public static readonly IDiagnostic W030 = new W030LegacyDebugTypesDiagnostic(); | ||
public static readonly IDiagnostic W031 = new W031MSBuildSdkVersionSpecificationDiagnostic(); | ||
public static readonly IDiagnostic W032 = new W032OldLanguageVersionDiagnostic(); | ||
public static readonly IDiagnostic W033 = new W033ObsoletePortableClassLibrariesDiagnostic(); | ||
public static readonly IDiagnostic W034 = new W034ReferenceAliasesDiagnostic(); | ||
|
||
public static readonly DiagnosticSet AllDefault = new DiagnosticSet | ||
public static readonly DiagnosticSet NoneDefault = new DiagnosticSet(); | ||
|
||
public static readonly DiagnosticSet System = new DiagnosticSet | ||
{ | ||
W001, | ||
W002, | ||
}; | ||
|
||
public static readonly DiagnosticSet GenericProjectIssues = new DiagnosticSet | ||
{ | ||
W010, | ||
W011, | ||
W020, | ||
W021, | ||
W030, | ||
W031, | ||
W032, | ||
W033, | ||
W034, | ||
}; | ||
|
||
public static readonly DiagnosticSet NoneDefault = new DiagnosticSet(); | ||
public static readonly DiagnosticSet All = new DiagnosticSet(); | ||
|
||
static DiagnosticSet() | ||
{ | ||
All.UnionWith(System); | ||
All.UnionWith(GenericProjectIssues); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Project2015To2017.Core/Analysis/Diagnostics/W002MissingProjectFileDiagnostic.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,35 @@ | ||
using Project2015To2017.Definition; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Project2015To2017.Analysis.Diagnostics | ||
{ | ||
public sealed class W002MissingProjectFileDiagnostic : DiagnosticBase | ||
{ | ||
public override bool SkipForLegacyProject => true; | ||
public override bool SkipForModernProject => true; | ||
public override IReadOnlyList<IDiagnosticResult> Analyze(Project project) => | ||
throw new InvalidOperationException("W002 is not an executable diagnostic"); | ||
|
||
public static IReadOnlyList<IDiagnosticResult> CreateResult(ProjectReference @ref, Solution solution = null) | ||
{ | ||
return new[] | ||
{ | ||
new DiagnosticResult | ||
{ | ||
Code = "W002", | ||
Message = | ||
$"Referenced project file '{@ref.Include}' was not found at '{@ref.ProjectFile.FullName}'.", | ||
Location = new DiagnosticLocation | ||
{ | ||
Source = solution?.FilePath | ||
} | ||
} | ||
}; | ||
} | ||
|
||
public W002MissingProjectFileDiagnostic() : base(2) | ||
{ | ||
} | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
...gnostics/W020MicrosoftCSharpDiagnostic.cs → ...gnostics/W020MicrosoftCSharpDiagnostic.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
3 changes: 2 additions & 1 deletion
3
...tics/W021SystemNuGetPackagesDiagnostic.cs → ...tics/W021SystemNuGetPackagesDiagnostic.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
3 changes: 2 additions & 1 deletion
3
...nostics/W030LegacyDebugTypesDiagnostic.cs → ...nostics/W030LegacyDebugTypesDiagnostic.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
3 changes: 2 additions & 1 deletion
3
...BuildSdkVersionSpecificationDiagnostic.cs → ...BuildSdkVersionSpecificationDiagnostic.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
3 changes: 2 additions & 1 deletion
3
...stics/W032OldLanguageVersionDiagnostic.cs → ...stics/W032OldLanguageVersionDiagnostic.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
3 changes: 2 additions & 1 deletion
3
...soletePortableClassLibrariesDiagnostic.cs → ...soletePortableClassLibrariesDiagnostic.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
3 changes: 2 additions & 1 deletion
3
...nostics/W034ReferenceAliasesDiagnostic.cs → ...nostics/W034ReferenceAliasesDiagnostic.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
46 changes: 46 additions & 0 deletions
46
Project2015To2017.Migrate2017.Library/Vs15DiagnosticSet.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,46 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Project2015To2017.Analysis; | ||
using Project2015To2017.Analysis.Diagnostics; | ||
using Project2015To2017.Migrate2017.Diagnostics; | ||
using static Project2015To2017.Analysis.DiagnosticSet; | ||
|
||
namespace Project2015To2017.Migrate2017 | ||
{ | ||
public static class Vs15DiagnosticSet | ||
{ | ||
public static readonly IDiagnostic W020 = new W020MicrosoftCSharpDiagnostic(); | ||
public static readonly IDiagnostic W021 = new W021SystemNuGetPackagesDiagnostic(); | ||
|
||
public static readonly IDiagnostic W030 = new W030LegacyDebugTypesDiagnostic(); | ||
public static readonly IDiagnostic W031 = new W031MSBuildSdkVersionSpecificationDiagnostic(); | ||
public static readonly IDiagnostic W032 = new W032OldLanguageVersionDiagnostic(); | ||
public static readonly IDiagnostic W033 = new W033ObsoletePortableClassLibrariesDiagnostic(); | ||
public static readonly IDiagnostic W034 = new W034ReferenceAliasesDiagnostic(); | ||
|
||
public static readonly DiagnosticSet ModernIssues = new DiagnosticSet | ||
{ | ||
W020, | ||
W021, | ||
}; | ||
|
||
public static readonly DiagnosticSet ModernizationTips = new DiagnosticSet | ||
{ | ||
W030, | ||
W031, | ||
W032, | ||
W033, | ||
W034, | ||
}; | ||
|
||
public static readonly DiagnosticSet All = new DiagnosticSet(); | ||
|
||
static Vs15DiagnosticSet() | ||
{ | ||
All.UnionWith(DiagnosticSet.All); | ||
All.UnionWith(ModernIssues); | ||
All.UnionWith(ModernizationTips); | ||
} | ||
} | ||
} |
Oops, something went wrong.