Separate generated or declarative files from code with behaviour. EF Core migrations, *.Designer.cs and model snapshots are generated: exclude them from coverage only with sonar.coverage.exclusions (e.g. **/Migrations/**), keep them in analysis, and record why in the repo. Plain DTOs (records with properties) usually have no logic worth testing; if they're failing the gate, check whether they actually contain validation, mapping or computed properties. If they do, that logic needs tests (validator tests, mapping tests), and it may belong in a validator or mapper rather than the DTO. Don't lower the threshold for everything; change exclusions only through a reviewed PR.
Checks they tune exclusions deliberately rather than lowering the bar
Last updated 23 Nov 2026.