Skip to content

Commit 5ff8a40

Browse files
Add docs for disabling analyzers (#102)
1 parent 8434b69 commit 5ff8a40

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,30 @@ Look for `Structured Logging` in Settings -> Plugins -> Browse repositories.
3737
* [Inconsistent log property naming in context](rules/InconsistentContextLogPropertyNaming.md)
3838
* [Log event messages should be fragments, not sentences](rules/LogMessageIsSentenceProblem.md)
3939

40+
## Turning Off Analyzers
41+
42+
Individual analyzers can be disabled as needed either through code comments or by adding a line to a project's
43+
`.editorconfig` file.
44+
45+
### Turning Off Via Comments
46+
47+
The analyzer name can be used as-is in a ReSharper comment to disable an analyzer on a per-file or per-line basis.
48+
For example:
49+
50+
```csharp
51+
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
52+
```
53+
54+
### Turning Off Via `.editorconfig`
55+
56+
To disable an analyzer for an entire directory, you can add a line to a `.editorconfig` file
57+
([learn more](https://editorconfig.org)). In this case, the analyzer name needs to be converted to `snake_case`, prefixed
58+
with `resharper_` and suffixed with `_highlighting`. For example:
59+
60+
```editorconfig
61+
resharper_template_is_not_compile_time_constant_problem_highlighting = none
62+
```
63+
4064
## Credits
4165

4266
Inspired by [SerilogAnalyzer](https://github.com/Suchiman/SerilogAnalyzer)

0 commit comments

Comments
 (0)