Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

"scalastyle:ignore" not working with a rule ID #252

Open
gaelrenoux-datadome opened this issue Aug 19, 2019 · 3 comments
Open

"scalastyle:ignore" not working with a rule ID #252

gaelrenoux-datadome opened this issue Aug 19, 2019 · 3 comments

Comments

@gaelrenoux-datadome
Copy link

I have some code like:

class unused extends scala.annotation.StaticAnnotation // scalastyle:ignore class.name

When running scalastyle locally, it rightly ignores the broken rule on the object name. In Sonar however, it appears as a code smell. It works in Sonar if I remove the rule ID:

class unused extends scala.annotation.StaticAnnotation // scalastyle:ignore
@mwz
Copy link
Member

mwz commented Aug 19, 2019

You have to use the fully qualified class name of the rule, so this would be org.scalastyle.scalariform.ClassNamesChecker in your case.

@mwz mwz added the question Further information is requested label Aug 19, 2019
@gaelrenoux-datadome
Copy link
Author

I think it's a bug, though (although obviously a rather minor one). Scalastyle documentation specifies it's the rule ID that should be used, and makes no mention of using the class name for this purpose. Your workaround did solve the issue in Sonar, but it failed in other tools using Scalastyle plugins (SBT and IntelliJ). So, I need to keep both definitions of the rule, which is a mouthful:

class unused extends scala.annotation.StaticAnnotation // scalastyle:ignore class.name org.scalastyle.scalariform.ClassNamesChecker

@mwz
Copy link
Member

mwz commented Aug 20, 2019

Yes, I see - that makes sense. I'm not sure why the scalastyle ids aren't working, but I'm not using scalastyle locally so that's probably why it's something that I missed. Leve it with me for now and I'll see what can be done to make this work.

@mwz mwz added scalastyle and removed question Further information is requested labels Sep 1, 2019
@mwz mwz added this to To do in sonar-scala via automation Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
sonar-scala
  
To do
Development

No branches or pull requests

2 participants