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

WIP Refactor generating rules and rule repositories #378

Merged
merged 15 commits into from
Feb 20, 2020

Conversation

mwz
Copy link
Member

@mwz mwz commented Feb 16, 2020

This PR refactors how rules and rule repositories are generated.

My goal is to be able to export the collection of all of our raw rules (as they get generated directly from Scalastyle and Scapegoat) and the rule repositories and quality profiles that get created by sonar-scala at runtime. I want to be able to export all of that data into a json file, which I can then use in a separate user interface embedded on sonar-scala.com website, as described in #343.

In order to do that, I created a new package metadata, which will contain (in an intermediate data format) all of the rules, repositories and quality profiles. This data is then going to be used to

  • create rule repositories and quality profiles at runtime when SonarQube starts up
  • and it will also allow me to export it to a json file using a separate cli tool, which can be run on its own - see the sonar-scala-metadata.json file for the output.

So far I've refactored Scalastyle's rule repository to use this new mechanism and I still have Scapegoat and all the quality profiles left to do. I don't think I want to create a massive PR with all the changes in it, so as long as it's in a working state, I will refactor this functionality incrementally, e.g. Scalastyle quality profile next, then Scapegoat rules repo, quality profile and then all the other quality profiles.

I still need to add some of the new files to the plugin context, so that SonarQube doesn't blow up at runtime.

Relates to #343.

Copy link
Contributor

@BalmungSan BalmungSan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool.

Maybe the generator could / should be moved to another module? But probably just too much extra work for just not including it in the sonar-scala.jar

@mwz
Copy link
Member Author

mwz commented Feb 18, 2020

Maybe the generator could / should be moved to another module?

I thought about it doing it and It's not a big deal thb - I might still do it, but it's not the end of the world if this little app gets bundled into the same artifact.

@mwz
Copy link
Member Author

mwz commented Feb 19, 2020

I still need to add some of the new files to the plugin context, so that SonarQube doesn't blow up at runtime.

It looks like I don't need to declare anything new in the context, I think this is ready to be merged.

@mwz mwz marked this pull request as ready for review February 19, 2020 00:05
@mwz mwz merged commit cc48a30 into master Feb 20, 2020
@mwz mwz deleted the refactor-rules-and-repositories branch February 20, 2020 00:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants