Rule-specific NOSONAR

I also think this would make a lot of sense when all you want is ignore a specific issue on a specific line:

  • We shouldn’t ignore all rules on the same line (with NOSONAR comments), just the problematic one.
  • We shouldn’t ignore a specific rule in all lines of a file (with module-level ignores using a pattern).

And it would align with other tools, for example:

  • ESLint has // eslint-disable-line no-alert.
  • TypeScript has @ts-expect-error, which works differently, but just as good.
References:

And this is a little off topic, but we should also support putting standalone # NOSONAR comments on previous lines in (not just)Dockerfile files, because otherwise: