I'm deprecating and replacing the cslint tool which is currently used by CSharpArcanistLinter. It's replacement, csast and the associated PHP linter, CSharpASTArcanistLinter, offer better support for extending with custom lint rules and provide auto-fixes.
The important notes are:
- CSharpASTArcanistLinter does not use StyleCop at all, and as such, no StyleCop lint messages are detected by the new linter
- CSharpASTArcanistLinter does not require any additional configuration; it does not require a discovery map (as reported in T8922 as being confusing).
- CSharpASTArcanistLinter provides auto-fixes for every built-in rule that is provided, meaning that developers do not have to manually fix the style of their code.
- CSharpASTArcanistLinter supports writing custom additional lint policies against the C# AST. If you have your own custom libphutil library, you can create these by deriving from CSharpLintPolicy.
If you are currently using CSharpArcanistLinter, this is what you need to do to upgrade:
- Add https://github.com/hach-que/cstools as a submodule of your Git repository if you haven't already. If you're not using Git, then you'll need to copy the contents of that repository into a folder inside your non-Git repository.
- To add a Git submodule, run git submodule add https://github.com/hach-que/cstools.
- Configure Arcanist to load the submodule as a libphutil library, by either creating the load setting in .arcconfig, or adding cstools to it, like so:
{ "load": ["cstools"] }
- Configure Arcanist to use the new linter, by updating your .arclint configuration:
{ "linters": { "csharp-ast": { "type": "csharp-ast", "include": "(^.+\\.cs$)" } } }
Why is CSharpASTArcanistLinter in an external repository?
I'm still actively developing new lint rules for the Arcanist linter and restructuring things as required. It is far easier for me to push out new changes through an external library.
In addition, it means that I can ship the csast.exe binary and associated DLLs in the repository to remove the requirement to configure a path to csast.exe.