GithubHelp home page GithubHelp logo

atc-net / atc-coding-rules-updater Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 5.98 MB

A CLI tool to update atc coding rules and guidelines in a project / solution.

Home Page: https://atc-net.github.io/repository/atc-coding-rules-updater

License: MIT License

C# 99.62% PowerShell 0.20% Shell 0.19%
coding-rules command-line-tool analyzers

atc-coding-rules-updater's Introduction

NuGet Version

ATC-NET Coding rules updater

This repository contains a CLI tool, which can be used to maintain coding-rules in a project, where atc-coding-rules has been utilized.

Table of Contents

CLI Tool

The Atc.CodingRules.Updater.CLI library is available through a cross platform command line application.

Requirements

Installation

The tool can be installed as a .NET Core global tool by the following command

dotnet tool install --global atc-coding-rules-updater

or by following the instructions here to install a specific version of the tool.

A successful installation will output something like

The tool can be invoked by the following command: atc-coding-rules-updater
Tool 'atc-coding-rules-updater' (version '2.0.xxx') was successfully installed.`

Update

The tool can be updated by following command

dotnet tool update --global atc-coding-rules-updater

Usage

Since the tool is published as a .NET Tool, it can be launched from anywhere using any shell or command-line interface by calling atc-coding-rules-updater. The help information is displayed when providing the --help argument to atc-coding-rules-updater

Option --help

atc-coding-rules-updater --help


USAGE:
    atc-coding-rules-updater.exe [OPTIONS]

OPTIONS:
    -h, --help       Prints help information
        --verbose    Use verbose for more debug/trace information
    -v, --version    Display version

COMMANDS:
    run                   Update the project folder with ATC coding rules and configurations
    sanity-check          Sanity check the project files
    options-file          Commands for the options file 'atc-coding-rules-updater.json'
    analyzer-providers    Commands for analyzer providers

Command run

USAGE:
    atc-coding-rules-updater.exe run [OPTIONS]

EXAMPLES:
    atc-coding-rules-updater.exe .         (equivalent to 'run -p [CurrentFolder]')
    atc-coding-rules-updater.exe run .     (equivalent to 'run -p [CurrentFolder]')
    atc-coding-rules-updater.exe run -p .  (equivalent to 'run -p [CurrentFolder]')
    atc-coding-rules-updater.exe run -p c:\temp\MyProject
    atc-coding-rules-updater.exe run -p c:\temp\MyProject -t DotNetCore --useTemporarySuppressions  --organizationName
MyCompany  --repositoryName MyRepo --verbose

OPTIONS:
    -h, --help                                                   Prints help information
        --verbose                                                Use verbose for more debug/trace information
    -p, --projectPath <PROJECTPATH>                              Path to the project directory (default current
                                                                 diectory)
    -o, --optionsPath [OPTIONSPATH]                              Path to an optional options json-file
    -t, --projectTarget [PROJECTTARGET]                          Sets the ProjectTarget. Valid values are: DotNetCore,
                                                                 DotNet5, DotNet6, DotNet7, DotNet8 (default)
        --useLatestMinorNugetVersion                             Indicate if nuget packages should by updated to latest
                                                                 minor version (default true)
        --useTemporarySuppressions                               Indicate if build process should use temporary
                                                                 suppressions - appends to .editorconfig - unless
                                                                 temporarySuppressionPath is set
        --temporarySuppressionPath [TEMPORARYSUPPRESSIONPATH]    Optional path to temporary suppressions file - if not
                                                                 set .editorconfig file is used
        --temporarySuppressionAsExcel                            Indicate if temporary suppressions file should be saved
                                                                 as Excel (.xlsx)
        --buildFile [BUILDFILE]                                  Solution/project file - required when multiple .sln
                                                                 files exists in root path
        --organizationName [ORGANIZATIONNAME]                    Optional: Specify the name of your organization for the
                                                                 Directory.Build.Props file
        --repositoryName [REPOSITORYNAME]                        Optional: Specify the name of your repository for the
                                                                 Directory.Build.Props file

Command sanity-check

USAGE:
    atc-coding-rules-updater.exe sanity-check [OPTIONS]

EXAMPLES:
    atc-coding-rules-updater.exe sanity-check .         (equivalent to 'sanity-check -p [CurrentFolder]')
    atc-coding-rules-updater.exe sanity-check -p c:\temp\MyProject
    atc-coding-rules-updater.exe sanity-check -p c:\temp\MyProject -t DotNetCore --verbose

OPTIONS:
    -h, --help                             Prints help information
        --verbose                          Use verbose for more debug/trace information
    -p, --projectPath <PROJECTPATH>        Path to the project directory (default current diectory)
    -o, --optionsPath [OPTIONSPATH]        Path to an optional options json-file
    -t, --projectTarget [PROJECTTARGET]    Sets the ProjectTarget. Valid values are: DotNetCore, DotNet5, DotNet6, DotNet7, DotNet8 (default)

Command options-file

USAGE:
    atc-coding-rules-updater.exe options-file [OPTIONS] <COMMAND>

EXAMPLES:
    atc-coding-rules-updater.exe options-file create .       (equivalent to 'options-file create -p [CurrentFolder]')
    atc-coding-rules-updater.exe options-file create -p .    (equivalent to 'options-file create -p [CurrentFolder]')
    atc-coding-rules-updater.exe options-file create -p c:\temp\MyProject
    atc-coding-rules-updater.exe options-file create -p c:\temp\MyProject -t DotNet5
    atc-coding-rules-updater.exe options-file validate .     (equivalent to 'options-file validate -p [CurrentFolder]')
    atc-coding-rules-updater.exe options-file validate -p c:\temp\MyProject

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    create      Create default options file 'atc-coding-rules-updater.json' if it doesnΒ΄t exist
    validate    Validate the options file 'atc-coding-rules-updater.json'

Example

Having a project folder in c:\code\MyProject where the .sln file for C# projects exists in the root, run the following command

atc-coding-rules-updater run -p c:\code\MyProject --verbose

Running the command above produces the following output

  ____            _                                      _           _
 |  _ \   _   _  | |   ___   ___     _   _   _ __     __| |   __ _  | |_    ___   _ __
 | |_) | | | | | | |  / _ \ / __|   | | | | | `_ \   / _` |  / _` | | __|  / _ \ | `__|
 |  _ <  | |_| | | | |  __/ \__ \   | |_| | | |_) | | (_| | | (_| | | |_  |  __/ | |
 |_| \_\  \__,_| |_|  \___| |___/    \__,_| | .__/   \__,_|  \__,_|  \__|  \___| |_|
                                            |_|
🐭 Working on EditorConfig files
🟒   root: .editorconfig files merged
🟒   sample: .editorconfig created
🟒   src: .editorconfig created
🟒   test: .editorconfig created
πŸ”¨ Working on Directory.Build.props files
🟒   root: Directory.Build.props created
🟒   sample: Directory.Build.props created
🟒   src: Directory.Build.props created
🟒   test: Directory.Build.props created
βœ… Done

Options file schema / example

The tool has an optional options parameter, which can be used to control the paths for persisting the .editorconfigs and props files. This can be applied as follows --optionsPath 'C:\Temp\atc-coding-rules-updater.json'

By default the atc-coding-rules-updater will detect projects in the solution and try to fetch the matching project specific rules and supply an .editorconfig in those projects. This mapping can however be over-ruled as seen in atc-coding-rules-updater.json example 3

atc-coding-rules-updater.json example 1

{
    "mappings": {
        "sample": {
            "paths": [
                "C:\\Temp\\MyProject\\sample1",
                "C:\\Temp\\MyProject\\sample2"
            ]
        },
        "src": {
            "paths": [
                "C:\\Temp\\MyProject\\src"
            ]
        },
        "test": {
            "paths": [
                "C:\\Temp\\MyProject\\test"
            ]
        }
    }
}

atc-coding-rules-updater.json example 2

{
    "mappings": {
        "src": { "paths": [ "source" ] },
        "test": { "paths": [ "tests" ] }
    }
}

atc-coding-rules-updater.json example 3

In this example a project framework mapping has been added. The entry is mapped using the CsProj fileName and the specific ProjectFrameworkType. Currently the supported values for project framework type are defined here

By specifying this mapping it will over-rule the automatic detection of the project framework type.

{
    "projectTarget": "DotNet8",
    "mappings": {
        "sample": { "paths": [ "sample" ] },
        "src": { "paths": [ "src" ] },
        "test": { "paths": [ "test" ] }
    },
    "projectFrameworkMappings": [
    {
      "name": "HelloWorldWpf",
      "type": "Wpf"
    }
  ]
}

atc-coding-rules-updater.json default

{
  "projectTarget": "DotNet8",
  "useLatestMinorNugetVersion": true,
  "useTemporarySuppressions": false,
  "temporarySuppressionAsExcel": false,
  "analyzerProviderCollectingMode": "LocalCache",
  "mappings": {
    "src": {
      "paths": [
        "src"
      ]
    },
    "test": {
      "paths": [
        "test"
      ]
    }
  },
  "projectFrameworkMappings": []
}

Note: If there is a atc-coding-rules-updater.json file present in the root folder (given by options --projectPath / -p), then it will automatically be found and used. Other given arguments will then override.

CLI Tool Usage from powershell

To ensure that the latest version of the CLI tool atc-coding-rules-updater is being used, the following methodology can be used:

  1. Download the 2 files from sample into a project root folder.
  2. Modify the atc-coding-rules-updater.json to the projects specific needs.
  3. Run atc-coding-rules-updater.ps1 from powershell

Deep dive in what atc-coding-rules-updater actual does and doesn't do

The atc-coding-rules-updater downloads files from the atc-coding-rules repository's distribution folder.

From here it works with 2 concepts:

  • Scaffolding files (.editorconfig and Directory.Build.props) - if a file does not exist - it creates a copy.
  • Updating files (.editorconfig) - if a file exist - updates the files first content part and does not touch the second content part.
    • First content part is related to rules above the line # Custom - Code Analyzers Rules - and will be updated - herafter known as ATC-part.
    • Second content part is related to rules below the line # Custom - Code Analyzers Rules - and will not be touched - herafter known as Customer-part.

A use case-scenario for coding rules structure setups - Scenario A

In scenario A we have root where src and test destination is defined as:

{
    "mappings": {
        "src": { "paths": [ "src" ] },
        "test": { "paths": [ "test" ] }
    }
}

When the atc-coding-rules-update is exceuted first time, the following happens (see legend for explanation):

  • #70AD47 arrows indicate files created in root folder.
  • #00B0F0 arrows indicate files created in src folder.
  • #7030A0 arrows indicate files created in test folder.

Img

A use case-scenario for coding rules structure setups - Scenario B

In this scenario we have root where src and test destination is defined as:

{
    "mappings": {
        "src": { "paths": [
            "MyDemo.Gui",
            "MyDemo.SharedContracts",
            "MyDemo.WebApi"
            ] },
        "test": { "paths": [
            "MyDemo.Gui.Tests",
            "MyDemo.SharedContracts.Tests",
            "MyDemo.WebApi.Tests"
            ] }
    }
}

When the atc-coding-rules-update is executed first time, the following happens (see legend for explanation):

  • #70AD47 arrows indicate files created in root folder.
  • #00B0F0 arrows indicate files created in src folder.
  • #7030A0 arrows indicate files created in test folder.

Img

For both use-case scenarios

For both scenario A and scenario B, when the atc-coding-rules-update is executed a second time it will only update .editorconfig file. And as previously stated, it will only update the ATC-part of these files.

Img

Temporary suppressions

When starting with ATC rules on an existing project, the general recommendation is to initially suppress all failing rules in your Custom section in order to get back to βœ… state for the project, and then later clean up the code and remove the suppressions one by one in nice clean commits.

The challenge is that this initial suppression list takes a long time to hand-write. In order to circumvent this tedious process, some extra flags have been added to the CLI to allow for auto-generation of these suppression lines. When utilizing these new options, the updater process will run a dotnet build on your project and extract any errors and create suppressions for these along with a count of how many occurences are present. The CLI will also add additional information, e.g: Category, Title, Link to the rule being broken.

The three CLI options for generating temporary suppressions are as follows.

--useTemporarySuppressions      Use temporary suppressions from build - appends to .editorconfig - unless temporarySuppressionPath is set
--temporarySuppressionPath      Optional path to temporary suppressions file - if not set .editorconfig file is used
--temporarySuppressionAsExcel   Optional - save temporary suppressions file as Excel (.xlsx)

Below an example of the auto-generated supressions is shown:

##########################################
# ATC temporary suppressions
# generated @ 21. juni 2021 02:33:34
# Please fix all generated temporary suppressions
# either by code changes or move the
# suppressions one by one to the relevant
# 'Custom - Code Analyzers Rules' section.
##########################################

# Microsoft.CodeAnalysis.NetAnalyzers
dotnet_diagnostic.CA1303.severity = none            # 1 occurrence - Do not pass literals as localized parameters - https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1303
dotnet_diagnostic.CA1707.severity = none            # 1 occurrence - Identifiers should not contain underscores - https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1707
dotnet_diagnostic.CA1801.severity = none            # 1 occurrence - Review unused parameters - https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1801

# SonarAnalyzer.CSharp
dotnet_diagnostic.S1118.severity = none             # 1 occurrence - Category: 'Code Smell' - Utility classes should not have public constructors - https://rules.sonarsource.com/csharp/RSPEC-1118

# StyleCop.Analyzers
dotnet_diagnostic.SA1400.severity = none            # 2 occurrences - Category: 'Maintainability' - Access modifier must be declared - https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1400.md

Build

When using the --useTemporarySuppressions option, a dotnet.exe build will be executed (up to 10 times depending on the complexity of the solution). Hence a requirement is that dotnet.exe can be called from the root path. If there are multiple solutions (.sln) files in the root folder, the --buildFile option will then be required as a parameter when calling the CLI tool.

--buildFile                 Optional path to solution/project file - required when multiple .sln files exists in root path

How to contribute

Contribution Guidelines

Coding Guidelines

atc-coding-rules-updater's People

Contributors

davidkallesen avatar egil avatar jkrag avatar perkops avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

atc-coding-rules-updater's Issues

Make dotnet tool check if it is out of date when invoked

To help users have the latest version of the updater tool installed, the tool should query nuget.org/look at github releases and see if it has the latest version installed.

This could probably be done by checking the the version timestamp in the asesmbly and compare it to the latest released to nuget.org.

If there is a newer version, the tools should output the approprate dotnet command to update the tool.

Custom rules section should include [*.{cs}] specifier

To make sure that the following custom rules work as intended, even if the user has added other custom rules for instance for overriding normal editorconfig settings, we should specify the *.cs pattern before the rules.

This should be included in all .editorconfig files generated, and maybe in both the normal Custom section and the temporary suppression section.

Should .editorconfig contain info on updater version?

When running the updater with temporary suppressions, it creates a whole comment block that includes timestamp of the run:

##########################################
# ATC temporary suppressions
# generated @ Thursday, January 27, 2022 10:35:50 PM
# Please fix all generated temporary suppressions
# either by code changes or move the
# suppressions one by one to the relevant
# 'Custom - Code Analyzers Rules' section.
##########################################

I was wondering if it would be useful for this block to also contain a line about the version of the updater used to generate this?
E.g. Generated by: atc-coding-rules-updater v. 2.0.92

EnableNETAnalyzers set in csproj causes build errors after add of ATC rules

If the project has:

 <EnableNETAnalyzers>true</EnableNETAnalyzers>

set already, then running the atc-rules-updater to add rules etc. will cause the project to fail with something like:

CSC : error CS8034: Unable to load Analyzer assembly C:\Users\extjkrag\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.3\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll : Assembly with same name is already loaded [C:\Users\extjkrag\source\repos\XYZ\XYX.Test\XYX.Test.csproj]
CSC : error CS8034: Unable to load Analyzer assembly C:\Users\extjkrag\.nuget\packages\microsoft.codeanalysis.netanalyzers\5.0.3\analyzers\dotnet\cs\Microsoft.CodeAnalysis.NetAnalyzers.dll : Assembly with same name is already loaded [C:\Users\extjkrag\source\repos\XYX\XYX.Test\XYX.Test.csproj]

Removing the EnableNETAnalyzers declaration so that it is only included in Directory.build.props fixes this issue, but this is not very obvious to end users, and maybe the updater cli should handle this in some nice way?

Allow updater to skip a target in project file that would prevent updater to run

Problem: I have a few projects where the coding-rules-updater can't complete the Release builds needed to generate the temporary suppressions, e.g. because the Release build runs a code obfuscator that causes various namespace/using related errors.
I can manually comment out the import line in the csproj file, run the atc-coding-rules-updater run -s . and then add the line back, but this is not a nice workflow when doing it manually, and also makes automation near impossible (or at least very ugly and failure prone).

I don't know exactly what the right solution is here as I am not very knowledgeable in dotnet build, but it would be really nice if it would be possible to send a parameter to the updater to skip certain named build targets when running the repeated build for generating temporary suppressions.

I am happy to assist where I can with more information, or with testing possible solutions.

command `options-file create` should support setting target framework

When running atc-coding-rules-updater options-file create . it always generates an options json with target set to DotNet6, even on a DotNet5 project.
If we can't realistically autodetect the framework, then it would be nice if this subcommand at least could take the same -t option as the regular run command.

Should updater fail if no internet connection?

I ran the updater today, and the output made me indirectly realize that my internet connection was completely down. The updaters error message about "no such host is known" are correct, but don't really tell the user what it was trying to fetch.
Also, in the end, it just continues "silently" to the .editorconfig / temp. suppressions part, and ends up reporting a perfectly clean green "Done" without any messages about the possible side effects of the previous sections not running correctly.
In my case, it was all on one screen, and I noticed the warnings, but if there had been more suppression output, I might have missed the initial red lines.

atc-rules-updater-when-network-down

I am not sure what would be the best behavior here, but figured I would post the screenshot while I had it, for further discussion.

command `options-file create` should autodetect existing root folders.

I don't know if it is possible, but it would be really nice if the options-file create command didn't add a section for a sample folder if none is present in the existing project.
If this is not a realistic feature to implement, then we should probably output a warning to check/validate the content of the generated json file and remind the user that the generator is not that intelligent ;-)

As a user running the create command, it is hard to know if the generator actually analyses my project or just outputs a dummy json file that happens to nearly match my paths.

Updater still slightly confused about available versions

I was running version 2.0.82.
First off, very happy to see that it now correctly reposts the right version with --version and also notifies me about an available update.

But it seems that it is still slightly confused about what is available.

$ atcu --sanity-check .
  ____            _                                      _           _
 |  _ \   _   _  | |   ___   ___     _   _   _ __     __| |   __ _  | |_    ___   _ __ 
 | |_) | | | | | | |  / _ \ / __|   | | | | | '_ \   / _` |  / _` | | __|  / _ \ | '__|
 |  _ <  | |_| | | | |  __/ \__ \   | |_| | | |_) | | (_| | | (_| | | |_  |  __/ | |   
 |_| \_\  \__,_| |_|  \___| |___/    \__,_| | .__/   \__,_|  \__,_|  \__|  \___| |_|   
                                            |_|
Version 2.0.88 of ATC-Coding-Rules-Updater is available!
You are running version 2.0.82.41834

finds new version 2.0.88 but then immediately updates to 2.0.92 ;-)

$ dotnet tool update --global atc-coding-rules-updater
Tool 'atc-coding-rules-updater' was successfully updated from version '2.0.82' to version '2.0.92'.

Improve output for non-standard folder names

I had a new project that needed coding-rules added. This project did not have the default src/ and test/ folders, but rather ProjectName and ProjectNameTest subfolders, so I started by running atc-coding-rules-updater options-file create . to create a default atc-coding-rules-updater.json file, and then edited the paths in this one.

Afterwards, I ran the run subcommand to add all the coding-rules stuff, and this ran perfectly smooth. However, the actual output says:

atc-coding-rules-src-test-folder-names

Since the paths in the output are formatted to look like actual paths src/.editorconfig then maybe it would be less confusing if they actually printed the correct path to the file that was created e.g. ProjectNameTest/.editorconfig rather than the "conceptual" test/ path?

Maybe there is a good reason why it does what it currently does?

Temporary Suppressions generator seems to count occurrences wrong

When running the updater with --useTemporarySuppresions, it adds lines to .editorconfig for each violating rule. The comment generated for each violation includes the number of occurrences found. This is quite useful when triaging which problems are easy to attack and clean up.
I have however seen a few examples where the updater vastly underestimates the number of violations. E.g. my .editorconfig after running mentioned "# occurrences 13 ..." for SA1503, but when I commented out the suppression, and rana build, there were way over 50 errors.

I am running on a solution with 5 projects, so maybe the updater is just counting the occurrences in the first project it finds, generating the exclusion, and then somehow not adding to the number for later projects analysed? (pure guess)

This is not a critical issue by any means, but worth looking at if this part of the code is revisited for other reasons.
If the generator bothers to mention the number of occurrences, it does look better if it is actually correct πŸ˜„

Support keeping (many) projects updated

This is not (yet) a specific feature request, but more an attempt to start a discussion about this general topic.

The updater is really cool and smart, but at the moment it is very dependent on developers remembering (and being motivated) to run it once in a while. If you have many projects using the atc-coding-rules, I expect it will become a huge, boring and then quickly forgotten task to actually keep the rules up to date.

Just like with other similar projects, this should be solvable with automation, e.g. in a pipeline.

As a MVP, the updater should have sort of a dry-run run-mode (switch) that just reports a zero or non-zero exit code depending on whether there are actually any updates. This would at least allow setting up a daily/weekly pipeline job that just fails if there are any pending updates, thus (hopefully) alerting someone on the team to manually run the updater and "do what needs to be done".

A more advanced solution could be something in the style of Dependabot that actually creates and submits a Pull Request with the updates. This would then automatically be built and can be reviewed/merged by a developer. The challenge with this is that it becomes platform dependent as there is no common interface for PR's across different Git hosting systems.
On the other hand, this could probably be done quite easily in simple pipeline steps on most platforms, and might therefore not (yet) be in reasonable scope for ATC?
I.e. If I can run the updater in a pipeline and easily "detect" if there are any real changes, then I can also get my pipeline to create a branch and make a PR.

So for now, the main point for me is to figure out which features are needed in the updater tool to better support automation.

Generate initial list of exclusions

As I understand it, the general recommendation when starting with ATC rules on an existing project, is to initially suppress all failing rules in your Custom section in order to get back to βœ… state for the project, and then later clean up the code and remove the suppressions one by one in nice clean commits.

The challenge is that this initial suppression list takes a long time to hand-write. There is no easily translatable output from dotnet build that you can use unless you do serious amounts of manipulation (sorting, cleaning format etc.) in an editor or spread sheet to get the right format.

It would be really nice if we could somehow generate this list for the user. I am not really a .Net guy, so I don't know how this could be plugged into the ecosystem (as it is only dotnet build that knows which rules are violating it is probably not a good job for the atc updater to do this).

I envision the tool generating the actual syntax needed for insertion in the .editorconfig files, or even auto-adding to the custom sections. It would be a bonus if rues that only fail in test/ are only excluded in that folder, so as not to "cloak" future errors in production code.

Ideally, I would wish for a format where each line also contains information about the rule, e.g. the description and maybe link:

# StyleCop
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
dotnet_diagnostic.SA1309.severity = none    # https://documentation.help/StyleCop/SA1309.html FieldNamesMustNotBeginWithUnderscore
dotnet_diagnostic.SA1402.severity = none    # https://documentation.help/StyleCop/SA1402.html FileMayOnlyContainASingleClass

# SonarSource
dotnet_diagnostic.S101.severity = none      # https://rules.sonarsource.com/csharp/RSPEC-101 Types should be named in PascalCase
dotnet_diagnostic.S108.severity = none      # https://rules.sonarsource.com/csharp/RSPEC-108 Nested blocks of code should not be left empty

# https://cezarypiatek.github.io/post/non-nullable-references-in-dotnet-core/
dotnet_diagnostic.CS8600.severity = none    # Converting null literal or possible null value to non-nullable type.
dotnet_diagnostic.CS8601.severity = none    # Possible null reference assignment.

# Meziantou
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm
dotnet_diagnostic.MA0002.severity = none    # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0002.md IEqualityComparer<string> or IComparer<string> is missing
dotnet_diagnostic.MA0004.severity = none    # https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0004.md Use Task.ConfigureAwait(false)

The example above is a very shortened snippet from the hand-crafted exclusion list I made when adding ATC rules to a small Swagger API project. The full list originally contained > 100 rule suppressions, and adding the links and comments took quite a few hours, but I judged that it would be so much easier to motivate the developers to clean up the rules if they could actually read which one they were commenting out instead of just going by trial and error and having VS do useless Bing searches for help.

To me this sounds like a perfect use-case for automation.

Duplicate key warning should show both versions with values

When running the command, it will print out a duplicate key warning. This may be because the same key exists twice with different values or with the same value, and I have no way of seeing which.
In case of a duplicate key, it would be nice if it printet out both/all the duplicates including the set value, preferably with a line number so they are easy to find in the file.

If might be good if this extra output was covered by either a verbose switch to enable, or a quiet switch to silence it?

EnforceCodeStyleInBuild in csproj causes .editorconfig to be ignored

It looks as if having the

    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>

set in your csproj file makes dotnet build enforce ALL rules, even if they are disabled in .editorconfig.

This may need more investigation.

Removing the line solves the problem, but this has to be at least documented, probably addressed somehow in the atc-coding-rules-updater (either autofix or warn about it).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.