How to work with rule csharpsquid:S2068

Version info:

  • Community Edition
  • Version 7.7 (build 23042)

Hi.

We have a question about csharpsquid:S2068 rule ( Credentials should not be hard-coded)
It rule is false positive in 100% cases for us NOW.
For example we are using Password fields and constants in test classes, sample help classes and other cases, not in production program logic cases. And we want to turn off this logic for that cases.
What is the best practice for right using of this rule?
We want to turn off this rule for our test classes and turn on in other cases.

Thank you/

hi @IvanovNiko , welcome to the community!

I think you’re looking to Narrow the focus - see docs

Also, you may want to read the Detection of Test Projects section of SonarScanner for MSBuild docs (in Advanced topics) - have you marked your test project as such?