Ignoring a line with Sonar
<p>Sonar complains about a line.</p>

<pre><code>Thread.sleep(SLEEP_TIME); // NOSONAR
</code></pre>

<p>Its problem is that </p>

<blockquote>
  <p>"Thread.sleep" should not be used in tests</p>
  
  <p>Using Thread.sleep in a test is just generally a bad idea. It creates brittle tests that can fail unpredictably depending on environment ("Passes on my machine!") or load. </p>
</blockquote>

<p>And it makes sense, this should be fixed. But my problem is: why doesn't the <code>NOSONAR</code> part has any effect here? It seems to work in other parts of the code where it's used, e.g. with</p>

<pre><code>public static final String PASSWORD_FILE_NAME = "secret.txt"; // NOSONAR
</code></pre>

<p>it doesn't complain any more that there is a hardcoded password in the code. So why doesn't it work with the <code>Thread.sleep()</code> case?</p>

<p>I can see the issue both in SonarQube and in the SonarLint plugin for IntelliJ.</p>