JetBrains Fleet 1.44 Help

Code inspections in C#

JetBrains Fleet provides over a thousand code inspections in C# . These inspections are applied to detect and highlight code issues in design time in all opened files .

Code inspections can be divided into the following groups:

  • Inspections with the fixed severity level 'Error'. These inspections detect compiler errors and there is no way to disable or configure them.

  • Inspections with configurable severity levels, which detect the rest of code issues (for example, compiler warnings, runtime and logical errors, code smells, redundancies, improvement suggestions, and so on). These inspections can be configured — you can disable them or change their severity level in .editorconfig files.

You can find all configurable code inspections in the List of code inspections in C#.

Severity levels of code inspections

Each JetBrains Fleet code inspection has one of the following severity levels:

Error

Code inspections with this severity level are aimed at code issues that either prevent your code from compiling or result in runtime errors. Most of these inspections are not configurable, that is you cannot disable them or change their severity level.

Code issues detected with these inspections are highlighted with a red underline.

Warning

This severity level corresponds to compiler warnings and to other issues that do not prevent your code from compiling but may nevertheless represent serious coding inefficiencies. For example, JetBrains Fleet informs you about redundant type casts or namespace import directives, incorrect format strings, declared but never used local variables or private fields, unused private methods, and so on.

Code issues detected with these inspections are highlighted with a yellow underline.

Suggestion

Code issues with this severity level provide insights into code structure, drawing your attention to things that aren't necessarily bad or wrong, but probably useful to know.

Code issues detected with these inspections are highlighted with a grey underline.

Hint

This is the lowest severity level. Code issues with this severity are not highlighted in the editor.

Configure code inspections

You can change severity levels of code inspections or disable specific inspections with EditorConfig.

Inspection settings in .editorconfig files are configured similarly to other properties — by adding the corresponding lines:

[inspection_property]=[error | warning | suggestion | hint | none]

For example, you can change the severity level of the Possible 'System.NullReferenceException' inspection to Error with the following line:

resharper_possible_null_reference_exception_highlighting=error

or you can disable the Redundant argument with default value inspection with the following line:

resharper_redundant_argument_default_value_highlighting=none

To find EditorConfig properties for each configurable inspection, refer to List of code inspections in C#.

As EditorConfig convention suggests, JetBrains Fleet will apply inspection settings defined in files named .editorconfig in the directory of the current file and in all its parent directories until it reaches the root filepath or finds an EditorConfig file with root=true. File masks specified in .editorconfig files, for example *Test.cs are also taken into account.

You can also mark some files as generated. For these files, JetBrains Fleet runs only those code inspections that check code for compiler errors and warnings. Use generated_code property to mark such files. For example:

[*generated.cs] generated_code = true
Last modified: 11 July 2024