Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Scalastyle+Scapegoat Quality Profile. #112

Merged
merged 2 commits into from Sep 16, 2018

Conversation

@BalmungSan
Copy link
Contributor

BalmungSan commented Sep 14, 2018

This is a Proof of Concept of how we could implement the Scalastyle+Scapegoat Quality Profile.

I want to note two important things:

  1. For the sonar-scala recommended Quality Profile, if we only want to blacklist/whitelist some inspections, we could implement it by adding a method similar that the one that activates all rules, but this time it will receive a predicate to filter the rules as an argument too.
    However, if we want to make more sophisticated things like, override the severity of a rule or their parameters.... this approach will not work, and we should fallback to @mwz's idea of exposing the Scalastyle/Scapegoat list of inspections.

  2. I tried to make the ScalastyleInspections object private to the scalastyle package, but that would have implied either moving the ScalastyleInspectionsGenerator to the scalastyle package, or make the code Stringly Typed; like the ScapegoatInspectionsGenerator.

I'll stay tuned to any comments.

Fixes #79


// Activate all rules in the Scapegoat rules repository.
//ScapegoatQualityProfile.activateAllRules(profile)
scapegoat.ScapegoatQualityProfile.activateAllRules(profile)

This comment has been minimized.

Copy link
@BalmungSan

BalmungSan Sep 14, 2018

Author Contributor

So, I don't know if you like this way of calling the Scalastyle/Scapegoat quality profiles.
Or if you prefer to import them.

This comment has been minimized.

Copy link
@mwz

mwz Sep 14, 2018

Owner

My personal preference would be just to import both of the objects.

@mwz

This comment has been minimized.

Copy link
Owner

mwz commented Sep 14, 2018

That's great @BalmungSan, looks good to me!

Re 1: I'm almost 100% sure that we'll want to adjust rule severity, blacklist some of the active rules and even potentially create new instances of Scalastyle templates, so we'll need to come up with a good mechanism that will allow us to create a quality profile that we can both be happy about and consider to be the best possible combination of Scalastyle and Scapegoat rules. 🥇

This PR gets the job done for the Scalastyle + Scapegoat quality profile, but I have a feeling that we'll need to refactor things a bit in order to set up our recommended profile. But let's merge this PR for now and we can move the discussion about this to #80.

Re 2: I'm not entirely sure what you mean by Stringly Typed, would you mind expanding on this?

@BalmungSan

This comment has been minimized.

Copy link
Contributor Author

BalmungSan commented Sep 15, 2018

"I'm not entirely sure what you mean by Stringly Typed, would you mind expanding on this?"

Oh, sorry, it's a term I heard in a Scala conference and I started using it without noticing. Basically it means using Strings for everything (pun intended with Strongly Typed) - Most common example, being a Database schema where each field, except for the PK, is a VARCHAR255.
So, long story short, if you recall, all methods of the ScapegoatInspectionsGenerator only operate with Strings - this is best observed in its tests. That's what I mean.

Regarding sonar-scala recomended profile, I will start a discussion about it in #80.

@BalmungSan BalmungSan changed the title PoC: Adding the Scalastyle+Scapegoat Quality Profile. Adding the Scalastyle+Scapegoat Quality Profile. Sep 15, 2018
@mwz

This comment has been minimized.

Copy link
Owner

mwz commented Sep 16, 2018

Excellent, thanks!

@mwz mwz merged commit f791012 into mwz:master Sep 16, 2018
1 check passed
1 check passed
ci/circleci: test Your tests passed on CircleCI!
Details
@BalmungSan BalmungSan deleted the BalmungSan:scalastyle-scapegoat-quality-profile branch Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.