Code style and cleanup
JetBrains Rider provides a lot of features for keeping your code neat and clean. Being tightly interwoven with the majority of other JetBrains Rider's features, they help you produce code and change existing codebases according to the specific code style. The code style, which includes naming standards, formatting rules, file layout, file header style, and many other tiny aspects (such as order of modifiers or whether to use the 'var' keyword) can be configured to a very detailed level and shared across your team.
JetBrains Rider uses different approaches to deal with different aspects of the code style. For instance:
Using code inspections, JetBrains Rider detects and highlights symbol names inconsistent with your naming standards, redundancies in your code, and a lot more.
Each of the highlighted style violations can be fixed with a quick-fix, or the fix in scope can be applied to all violations of this type.
Violations of code formatting rules as well as some other minor inconsistencies are not highlighted for the reason of keeping your code readable in the editor. Violations of formatting rules can be easily fixed though — select non-formatted code, press Alt+Enter and choose Format Selection.
Code cleanup helps apply formatting rules and many other code style preferences in a bulk mode for the desired scope.
Most of your code style preferences are taken into account when JetBrains Rider produces new code with code completion and code generation features, applies code templates and performs refactorings.
The mechanism of shared settings allows keeping your code style configurations under a VCS and automatically sharing them with your team members.
Code formatting styles, code syntax styles, and code inspection severity levels can be also configured in .editorconfig files, which also allow you to share your code style settings.
You can refer to specific topics in this section to learn how exactly JetBrains Rider deals with the corresponding code style aspects.