Comments (13)
Any update on this? Love the tool but it would be great for a IDE1006 naming 'fix all'.
from format.
Hi @nikolamalesevic, @jmarolf and I are working on getting analyzer support into a dotnet-format release. If you take our latest development build from our myget feed, you will see the progress that we've made so far.
Here is the output from running dotnet-format ./format.sln --fix-style warn --check -v diag
The dotnet CLI version is '5.0.100-preview.6.20277.3'.
Using MSBuild.exe located in '/usr/local/share/dotnet/sdk/5.0.100-preview.6.20277.3/'.
Formatting code files in workspace '/Users/joeyrobichaud/Source/format/format.sln'.
Loading workspace.
Complete in 5688ms.
Determining formattable files.
Complete in 915ms.
Running formatters.
Running Code Style analysis.
Determining diagnostics...
src/CodeFormatter.cs(25,64): Naming rule violation: Missing prefix: 's_' (IDE1006)
src/Workspaces/FolderWorkspace.cs(4,1): Using directive is unnecessary. (IDE0005)
tests/Analyzers/FilterDiagnosticsTests.cs(3,1): Using directive is unnecessary. (IDE0005)
tests/Analyzers/FilterDiagnosticsTests.cs(7,1): Using directive is unnecessary. (IDE0005)
tests/Analyzers/FilterDiagnosticsTests.cs(12,1): Using directive is unnecessary. (IDE0005)
Complete in 26650ms.
Fixing diagnostics...
Unable to fix IDE0005. No associated code fix found.
Unable to fix IDE1006. Code fix NamingStyleCodeFixProvider doesn't support Fix All in Solution.
Complete in 1208ms.
Analysis complete in 27858ms.
Complete in 28948ms.
Formatted 0 of 78 files.
Format complete in 35551ms.
I introduced a naming issue to show that we can now report naming violations. The next step will be improving our code fix support to work around provider that do not support fix all in solution.
You can try this out yourself by installing our latest development build with the caveat that the feature isn't 100% baked. For instance Full Framework or NetStandard projects may report compilation errors around unresolved dependencies.
dotnet tool install -g dotnet-format --version 5.0.135801 --add-source https://dotnet.myget.org/F/format/api/v3/index.json
-Joey
*Edit: The timings in the log are for a local debug build. Running with the tool built in release mode completes in just under 11 seconds.
from format.
Hi @Loreno10, currently format does not support naming styles. From our perspective there are 3 types of configuration in the editorconfig; whitespace, code style, and naming. We launched with support for whitespace formatting and are close to merging in initial support for code style. Naming will come later after we have improved the performance of the code style formatting.
from format.
Any updates on this? We've started using dotnet format
and we're sad to find out it cannot format naming.
from format.
@JoeRobich Any update on this? Are there any guidelines for prospective contributors for a feature like this one?
from format.
Hi @JoeRobich ! Thank you for the awesome tool! It seems that this page contains information suggesting that naming issues fixing should work. I wasn't able to make it work on version 5.0.135301+b255ad16af715cae7bf2a80cc1db697742f46d96
. Could you clarify please if it has been implemented or when it might be if not?
from format.
@JoeRobich awesome bloody tool.
So just to be clear, does dotnet format expect NamingStyleFixProvider
to be provided from somewhere else?
If so, where is it expected to be provided from?
from format.
So just to be clear, does dotnet format expect
NamingStyleFixProvider
to be provided from somewhere else?
The NamingStyleCodeFixProvider
is present but does not provide a batch fixer as other code style fix providers do. We would need to either enhance the Roslyn CodeFixerProvider with this capability or update dotnet-format to handle these diagnostics differently.
from format.
@JoeRobich Ah okay, that makes sense. I'd love for this to be added. It's incredible useful to have a formatter do these things, especially if you pair it with pre-commit hooks.
I have absolutely no idea of the complexity of such a feature. However, is it something we/I can help out with, and if so, where is a good place to start?
from format.
I'd just like dotnet format --verify-no-changes
to pick up errors with the names in the code. I'm less interested in fixing
It's super weird seeing red lines in the IDE (VS Code) and dotnet format
simply ignoring them
from format.
Hi @JoeRobich iI couldn't find that version (version 5.0.135801) you mentioned.
running the command dotnet tool install -g dotnet-format --version 5.0.135801 --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json
gives me this result:
warning NU1603: restore depends on dotnet-format (>= 5.0.135801) but dotnet-format 5.0.135801 was not found. An approximate best match of dotnet-format 5.0.211103 was resolved. You can invoke the tool using the following command: dotnet-format Tool 'dotnet-format' (version '5.0.211103') was successfully installed.
from format.
@Sakyawira The versions that ship with the .NET 6 and .NET 7 SDK support reporting naming style violations. There is still no batch fixer implemented for Naming Style errors. See this Roslyn feature request dotnet/roslyn#14983
from format.
Bump.
from format.
Related Issues (20)
- --binarylog option broken HOT 3
- Please clarify if this tool is actively supported / worked on HOT 2
- Can I use dotnet format to just generate report and not make the changes to the file. HOT 2
- Issue: Limited Scope for Running the Tool on Changed Files in Pull Requests HOT 1
- running dotnet format on my unity project takes over an hour HOT 2
- .net 8.0.2 Blazor `_imports.razor` & using `IDE0005` HOT 4
- Not detect IDE0290. HOT 1
- IDE0051 format issues with Razor code behind files with SDK 8.0.200 HOT 4
- Questions around Contributing to the Repo HOT 5
- dotnet format is now part of the SDK repo HOT 1
- Wrong indentation when using primary constructor
- Simplify interpolation (IDE0071) - false positive with Enum and FormattableString
- CA1067 on C# record implementing a VB.NET interface
- Does not adhere to language set in `DOTNET_CLI_UI_LANGUAGE`
- Line wrapping and indentation of Collection Literals
- Error Changing document properties is not supported
- CS0534 validation adding wrong code. HOT 1
- pre-commit hook fails: no compatible SDK was found HOT 1
- Feature Request: Support for Excluding Specific Subcommands with --skip in dotnet format
- Can't suppress WHITESPACE warnings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from format.