Some warnings not shown for files in "Editor" folder in Unity project

In Unity projects, code inside “Editor” folders is added to a separate project file (with some exceptions). After some digging I’ve found the cause: there’s a reference to the Unity package for NUnit (“Library\PackageCache\com.unity.ext.nunit@1.0.6\net35\unity-custom\nunit.framework.dll”) in that editor project file, and removing the reference (or the dll file itself) makes the warnings appear correctly.

So I’m assuming this is the same issue as SonarLint and Sonarqube show different issues - #6 by Damien_Urruty, right? Is there no way to avoid this (preferably without changing the project file)?