- Notifications
You must be signed in to change notification settings - Fork1
Atc coding rules and guidelines
License
atc-net/atc-coding-rules
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ATC Analyzers Rules decisions overview
This github repository contains coding rules which are defined by the ATC core team for use in various code projects. It is a collection of code analyzers with all rulestreated as errors
by default - forrelease build
.
When creating a new project, it will be a good start to download files from thedistribution folder as a starting point for a solution.
The main focus for the ATC core team is Visual Studio, Visual Studio Code and .NET/C#.
A team can use the same set of code rules for all projects.
Extensive code style settings for C# have been defined that require the latest C# features to be used.
All .NET naming conventions are consistent with the .NET Framework Design Guideline'sNaming Guidelines.
When a rule is found annoying and someone wants to deactivate it, this must follow a standard procedure. Firstly, argumentation must be in place as to why the rule should be disabled. Once this argumentation is in place, a session with the ATC core team can be held, where a decision will be made and afterwards executed and documented.
This means that NO rules must be deactivated by a single person and must first be documented so that everyone later can refer to this!
Take a copy of thedistribution folder and drop it into the root of a project. Once this is done, when opening a file in Visual Studio, the .editorconfig file settings will automatically be used to help format the document and also raise warnings if the code style and formatting does not conform to the rules.
For Visual Studio Code, install theEditorConfig for VS Code extension to gain .editorconfig support.
One way is to use the sample provided hereatc-coding-rules-updater.
Another way is to just download the files manually from the distribution folder.
Note: First time the script is run, it will create folders likesrc
,test
,sample
and dump relevant files into each folder.
Directory descriptions:
src
- folder for source codetest
- folder for test codesample
- folder for sample/demo applications
If the foldersample
is not relevant - simply delete this folder, and it will not be recreated when the script is run again.
- If the rule is suppressed in code by a
SuppressMessage
attribute, hopefully theJustification
description should clarify it. - If the rule is suppressed in the
.editorconfig
and it is not defined under acustom section then the rule must be found underdocumentation for rules suppression overview - I can't see the rule defined as described in bullet 1 or 2 - Then the rule isINVALID - use
git blame
and get the code fixed with the person/team or/and follow up on the process for code quality - e.g. improve the PullRequest-Review process.
If you have a rule you don't like, please feel free to start a suggestion proceess.
Create a newissue based on theRule suppression suggestion
Read more on this in therule suppression process.
EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems. Find out more at:
For atc-coding-rules the default severity setting is:dotnet_analyzer_diagnostic.severity = error
andTreat Warnings As Errors
is set forBuild-Target = Release
This means that atc-coding-rules only use the following severity:
error
suggestion
(Info
inVisual Studio - Error List Window)none
Read about severity-level:
Imagine that we want to set theLangVersion
property. To do this we can set it directly in the.csproj
file or it can be set in aDirectory.Build.props
file - or in both files. TheMSBuild
ordotnet build
commands both use the file hierarchy ofDirectory.Build.props
and.csproj
to read the value of theLangVersion
property. Last definition wins.
Example of a hierarcy:
TheLangVersion
property value will be read as:7.0 =>8.0 =>9.0
Imagine the we want to set the severity level for a ruleSA1633
. To do this we can set it in the.editorconfig
file and it can be set multiples times. An editor likeVisual Studio
orVS Code
uses the file hierarchy of.editorconfig
to read thekey/value pair (dotnet_diagnostic.SA1633.severity
). The last definition of thekey/value pair wins.
Example of a hierarchy:
Thedotnet_diagnostic.SA1633.severity
value will be read as:none =>error =>suggestion =>error
About
Atc coding rules and guidelines
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors9
Uh oh!
There was an error while loading.Please reload this page.