How do I set up my .rubocop.yml in SonarCloud?

Template for a good new topic, formatted with Markdown:

  • ALM used GitHub
  • CI system used Circle CI
  • Languages of the repository: Ruby

When I open a PR and it realize that the automatic verification of SonarCloud does not take my Rubocop configuration, I have already tried to understand the documentation, but, I just found something for SonarQube, which I do not use. Can someone help me?

I’m not sure what you want to do.

The ruby analyzer has a sonar.ruby.rubocop.reportPaths property which you can use to import a Rubocop json report containing issues raised by rubocop. It doesn’t try to read rubocop configuration.

Hi Pierre, what I’m trying to do is make Sonarcloud identify the Code Smells at the opening of the PRs, and I realized that it doesn’t identify the offenses that Rubocop points out when the PR is opened. Can you give me any suggestions on how to solve this as SonarCloud, or am I just going to get it with Code Climate anyway?

I suggest that you update your CI process so that:

  • Rubocop analysis generates a json report. See the Rubocop documentation.
  • SonarCloud analysis is fed a sonar.ruby.rubocop.reportPaths parameter which points to the Rubocop json report.

Sorry, I’m not a Ruby developer and I never used Circle CI nor Code Climate.
Maybe someone else on this community forum can help you better than me.