Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sync namespace analyzer #49990

Merged
67 commits merged into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
5069bef
wip
vritant24 Aug 6, 2020
d5cb70c
added codefix
vritant24 Aug 10, 2020
4cda769
added property support
vritant24 Aug 26, 2020
414bd5d
removed ifdefs
vritant24 Aug 26, 2020
a83f04a
clean changes
vritant24 Sep 3, 2020
763bbdb
added TODO
vritant24 Sep 3, 2020
2d142c3
Working test
ryzngard Nov 12, 2020
c7c3a78
WIP: Repro for Error List
ryzngard Nov 13, 2020
64fec6e
Fix some layering. Get the CodeFixProvider done
ryzngard Nov 13, 2020
8fce96c
Fix SyncNamespaceDocumentAction to consider DefaultNamespace
ryzngard Nov 13, 2020
e040ced
Merge branch 'master' into features/namespace_analyzer
ryzngard Dec 15, 2020
d2745a8
Fix compiler errors
ryzngard Dec 15, 2020
20e4ca8
Revert unchanged file
ryzngard Dec 17, 2020
2bb9e4f
Fix tests
ryzngard Dec 17, 2020
524e0d6
First stab at getting some tests working
ryzngard Dec 18, 2020
5f79977
Apply suggestions from code review
ryzngard Dec 18, 2020
a52cae5
Change string to include namespace
ryzngard Dec 18, 2020
8645277
Merge branch 'feature/namespace_analyzer' of https://github.com/ryzng…
ryzngard Dec 18, 2020
4c8d556
WIP
ryzngard Jan 4, 2021
1baddb4
Merge branch 'master' into feature/namespace_analyzer_wip
ryzngard Jan 7, 2021
2d9752a
get build working again
ryzngard Jan 7, 2021
067a3c2
Initial split of diagnostic analyzer
ryzngard Jan 7, 2021
416782e
Make abstract namespace sync fixer
ryzngard Jan 8, 2021
046335d
Small fixes
ryzngard Jan 12, 2021
227c485
Remove custom batch fix. Add file headers
ryzngard Jan 12, 2021
c507cea
Fixup and get tests running again. Make root namespace optional
ryzngard Jan 12, 2021
7d6018c
Fix test
ryzngard Jan 12, 2021
96f93a9
Enable another test
ryzngard Jan 13, 2021
7515516
Merge branch 'master' into feature/namespace_analyzer
ryzngard Jan 14, 2021
b6c866a
Fix tests and enable more
ryzngard Jan 14, 2021
8df3188
Use RoslynString for IsNullOrWhitespace
ryzngard Jan 14, 2021
2e5713c
Fix my own tests...
ryzngard Jan 15, 2021
de7ff95
Fix formatting
ryzngard Jan 15, 2021
24c483b
Change diagnostic id
ryzngard Jan 15, 2021
8284e97
Remove commented out tests
ryzngard Jan 15, 2021
fd06fdc
Add more invalid folder name tests
ryzngard Jan 15, 2021
7801d91
Add failing fix all test
ryzngard Jan 15, 2021
bc25564
FixAll test passing with custom provider
ryzngard Jan 20, 2021
9f6094a
Fix diagnostic tests
ryzngard Jan 20, 2021
b7a2939
PR feedback fixups
ryzngard Jan 21, 2021
6329295
Apply suggestions from code review
ryzngard Jan 21, 2021
feadb2d
Remove root namespace
ryzngard Jan 21, 2021
9bdec53
Merge branch 'feature/namespace_analyzer' of https://github.com/ryzng…
ryzngard Jan 21, 2021
914e76a
Merge branch 'master' into feature/namespace_analyzer
ryzngard Jan 22, 2021
494a9f6
Revert "Remove root namespace"
ryzngard Jan 22, 2021
1fff3d7
Rename and cleanup from PR
ryzngard Jan 22, 2021
3ce37cf
run dotnet format
ryzngard Jan 22, 2021
9a48811
Fix renaming
ryzngard Jan 22, 2021
6ca5989
Remove old analyzer file
ryzngard Jan 22, 2021
95c94bd
Get rid of binlog
ryzngard Jan 22, 2021
3e5cfb5
I really don't like projitems in VS :/
ryzngard Jan 22, 2021
71f7308
Fix test
ryzngard Jan 22, 2021
e2d189a
Add two basic VB tests
ryzngard Jan 22, 2021
2a0b315
Add more VB tests
ryzngard Jan 25, 2021
d973fab
Remove a <returns>
ryzngard Jan 25, 2021
fa70a07
Add defaultnamespace tests. Use symbol name for namespace
ryzngard Jan 26, 2021
bec28ad
Merge branch 'master' into feature/namespace_analyzer
ryzngard Jan 28, 2021
57ea036
Fix VB tests
ryzngard Jan 28, 2021
4e583d5
Fix configuration tests post merge
ryzngard Jan 28, 2021
d2949b9
PR feedback. Get rid of VB analyzer
ryzngard Feb 2, 2021
b455fc0
More PR feedback. Add to syntax facts
ryzngard Feb 2, 2021
af02989
Add progress tracker
ryzngard Feb 2, 2021
cb553e8
Add editorconfig setting
ryzngard Feb 2, 2021
8f2c578
Fix test
ryzngard Feb 2, 2021
4d5f216
Fix more tests
ryzngard Feb 3, 2021
b434df5
Whackamole on tests. I wish it were easier to run all of these together.
ryzngard Feb 3, 2021
cb71134
PR feedback
ryzngard Feb 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Compile Include="$(MSBuildThisFileDirectory)AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConvertTypeofToNameof\CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveRedundantEquality\CSharpRemoveRedundantEqualityDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Analyzers.MatchFolderAndNamespace;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.LanguageServices;

namespace Microsoft.CodeAnalysis.CSharp.Analyzers.MatchFolderAndNamespace
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
internal class CSharpMatchFolderAndNamespaceDiagnosticAnalyzer : AbstractMatchFolderAndNamespaceDiagnosticAnalyzer<NamespaceDeclarationSyntax>
{
protected override ISyntaxFacts GetSyntaxFacts() => CSharpSyntaxFacts.Instance;

protected override void InitializeWorker(AnalysisContext context)
{
context.RegisterSyntaxNodeAction(AnalyzeNamespaceNode, SyntaxKind.NamespaceDeclaration);
}
}
}
1 change: 1 addition & 0 deletions src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<Compile Include="$(MSBuildThisFileDirectory)MakeFieldReadonly\CSharpMakeFieldReadonlyCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MakeStructFieldsWritable\CSharpMakeStructFieldsWritableCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)MatchFolderAndNamespace\CSharpChangeNamespaceToMatchFolderCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OrderModifiers\CSharpOrderModifiersCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PopulateSwitch\CSharpPopulateSwitchExpressionCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PopulateSwitch\CSharpPopulateSwitchStatementCodeFixProvider.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Composition;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeFixes.MatchFolderAndNamespace;
using Microsoft.CodeAnalysis.Host.Mef;

namespace Microsoft.CodeAnalysis.CSharp.CodeFixes.MatchFolderAndNamespace
{
[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.ChangeNamespaceToMatchFolder), Shared]
internal class CSharpChangeNamespaceToMatchFolderCodeFixProvider : AbstractChangeNamespaceToMatchFolderCodeFixProvider
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpChangeNamespaceToMatchFolderCodeFixProvider()
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Import_RootNamespace>Microsoft.CodeAnalysis.CSharp.Analyzers.UnitTests</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnnecessaryDiscardDesignation\RemoveUnnecessaryDiscardDesignationTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)AddAccessibilityModifiers\AddAccessibilityModifiersTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)AddBraces\AddBracesFixAllTests.cs" />
Expand Down
Loading