I’m trying to apply Codacy across an organization with many repos. The organization coding standards is nice, as is the default option, but makes it difficult to decide as a team what we may want to change, and also see what has changed from default.
Ideally I’d like to be able to go through a PR process where someone can propose a change for the rules, and people can review/feedback, then the change can be accepted to declined. Makes sense that you’d use a git provider’s repo for this.
Org standards as code idea
Introduce the ability to select a repository as a source of an (or multiple) organization coding standard. Or simply just search for a specific file in existing repositories.
.codacy-coding-standard.yml
Example file above could contain the title and other non-tool specific settings. Tool specific config could be adjacent files named .codacy-<tool>.yml
, i.e. .codacy-sonarcsharp.yml
I don’t know how you model patterns.
Workaround Attempt
I was exploring other ways of making this happen, such as placing SonarLint.xml
and other tool configuration files in a repo. I had hoped Codacy would pick them up and parse those settings. I would then use a git workflow to copy the coding standards of this repository to the org default coding standard.
Sadly it doesn’t seem like there is any parsing of these files by Codacy - rather they just go straight to the tool. This would make sense, but a bit of a bummer.
API Alternatives
Alternatively, introducing a few more API options would give us the means to do this ourselves:
- List all enabled patterns on a tool for a given repository
- Add/add-many/remove/remove-many patterns from a tool for a given repo
- Assign the patterns to a tool for a given repo
- All of the above, but for an org standard
This would at least allow me to store the coding standards as json in the repo, and have a workflow call the API to apply these settings to either a repo or an org coding standard.
The goal here is to involve many people in the process of dialing the right settings in a visible way, instead of someone silently flipping switches in the UI.