- Create a consistent look to the code, so that developers can focus on content.
- Onboarding new developers become easier because the code is uniform and easier to understand.
- Reduction of development time by allowing code reviewers to focus on substance.
Introducing the EditorConfig and DotSettings files!
The EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig is used to define coding styles, and because the file is human-readable it works nicely with version control systems.
DotSettings is a file used to set Layer-based settings for Rider and ReSharper. This file contains the 'DotPulsar: Full Cleanup' cleanup profile and the setting for enabling auto clean up on save for Visual Studio with ReSharper.
The editorconfig default settings have been chosen to prioritize style compatibility between Jetbrains and Microsoft offerings. Developers should still have the choice of what style overall makes sense for them in a given coding scenario. Therefore the configs contain no strict rules on if a method should be an expression body or block body. But it will enforce small things, like an empty space at the end of each cs file.
- In the commit window, click the gear icon.
- Make sure only the "Cleanup 'DotPulsar: Full Cleanup' profile" is checked. ("Check TODO" can be left on or off according to your preference)
- Goto Extensions, then ReSharper and click Options...
- Find Code Editing then Code Cleanup and click General
- Check "Automatically run cleanup when saving a file (not supported for shared/linked files)"
- Goto Profiles and make sure the profile 'DotPulsar: Full Cleanup' is set as the default
- Save
To get Visual Studio to automatically enforce the code style on file save, do the following
- Goto Tools and then Options...
- Text Editor -> Code Cleanup
- Check the box "Run Code Cleanup profile on Save"
- click ok