RCheesley
(Ruth Cheesley)
July 18, 2022, 10:11am
1
Hi folks!
I am working on trying to implement Sonarcloud on our open source repo on GitHub.
I have been following the steps to get this working on a PR from a forked repo which is how we accept contributions - see How to use SonarCloud with a forked repository on GitHub? - #34 by RCheesley for the relevant files and steps I have taken this far.
I now have it working in that it’s running the checks and is pulling in the code coverage report from Codecov, however the report itself seems to be pulling up all the current issues with the whole codebase rather than just the things from the PR itself.
I am not sure if this is something that I have misconfigured in the settings and would appreciate a nudge in the right direction, as this is the last piece in the rather long-running puzzle that is getting SonarCloud deployed!
Thanks in advance!
Colin
(Colin)
July 18, 2022, 10:26am
2
Hey there.
I saw this in your GitHub actions logs:
INFO: SCM Publisher is disabled
This will prevent the detection of changed files / changed lines. I couldn’t find this setting in your repo – maybe you have it configured in the UI? Check your project-level Administration > General Settings > SCM
1 Like
RCheesley
(Ruth Cheesley)
July 18, 2022, 10:33am
3
Thanks for the super speedy reply @Colin - just re-running against a PR with that setting turned on, sounds like that might be the missing link!
RCheesley
(Ruth Cheesley)
July 18, 2022, 10:59am
4
Hmm, it is still showing the same report:
RCheesley:4.x
← RCheesley:mauticSonar
opened 01:23PM - 13 May 22 UTC
<!-- ## Which branch should I use for my PR?
Assuming that:
a = current ma… jor release
b = current minor release
c = future major release
* a.x for any features and enhancements (e.g. 4.x)
* a.b for any bug fixes (e.g. 4.0, 4.1, 4.2)
* c.x for any features, enhancements or bug fixes with backward compatibility breaking changes (e.g. 5.x) -->
| Q | A
| -------------------------------------- | ---
| Bug fix? (use the a.b branch) | [ ]
| New feature/enhancement? (use the a.x branch) | [ ]
| Deprecations? | [ ]
| BC breaks? (use the c.x branch) | [ ]
| Automated tests included? | [ ]
| Related user documentation PR URL | mautic/mautic-documentation#...
| Related developer documentation PR URL | mautic/developer-documentation#...
| Issue(s) addressed | Fixes #...
<!--
Additionally (see https://contribute.mautic.org/contributing-to-mautic/developer/code/pull-requests#work-on-your-pull-request):
- Always add tests and ensure they pass.
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against the "4.x" branch.
-->
#### Description:
<!--
Please write a short README for your feature/bugfix. This will help people understand your PR and what it aims to do. If you are fixing a bug and if there is no linked issue already, please provide steps to reproduce the issue here.
-->
#### Steps to test this PR:
<!--
This part is really important. If you want your PR to be merged, take the time to write very clear, annotated and step by step test instructions. Do not assume any previous knowledge - testers may not be developers.
-->
1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs [here](https://contribute.mautic.org/contributing-to-mautic/tester))
2.
<!--
If you have any deprecations, list them here along with the new alternative.
If you have any backwards compatibility breaks, list them here.
-->
I checked and it looks like it should be enabled:
I tried also setting the provider as git but that made no difference - maybe I need to explicitly declare it in our properties file or in the command itself?
Update:
Still getting stuck here!
Set in the UI to be enabled, also set it in the project settings file:
sonar.projectKey=RCheesley_mautic
sonar.organization=rcheesley
sonar.projectName=mautic
sonar.projectVersion=1.0
sonar.modules=phpmodule
sonar.sourceEncoding=UTF-8
sonar.scm.disabled=false
sonar.scm.provider=git
phpmodule.sonar.sources=app,plugins
phpmodule.sonar.projectBaseDir=.
phpmodule.sonar.inclusions=app/*.php,app/**/*.php,plugins/*.php,plugins/**/*.php
phpmodule.sonar.exclusions=app/migrations/**/*,app/bundles/*Bundle/Config/**/*,app/bundles/*Bundle/DataFixtures/**/*,app/bundles/*Bundle/Tests/**/*,app/bundles/*Bundle/Translations/**/*,app/bundles/*Bundle/Views/**/*,app/middlewares/Test/**/*,app/bundles/CoreBundle/Test/**/*,plugins/*Bundle/Config/**/*,plugins/*Bundle/Tests/**/*,plugins/*Bundle/Translations/**/*,plugins/*Bundle/Views/**/*
phpmodule.sonar.cpd.exclusions=**/*
phpmodule.sonar.tests=tests
sonar.php.coverage.reportPaths=clover.xml
sonar.scm.disabled=true
When the action runs it is still showing that SCM is disabled:
Any ideas or anything obvious that I am missing here @Colin ?
Colin
(Colin)
July 18, 2022, 3:34pm
5
To be clear, you want sonar.scm.disabled
to be set to false
in all places – and a sonar-project.properties file will override anything set in the UI, so I would suggest removing it from your sonar-project.properties file and restoring your settings in the UI to the default.
RCheesley
(Ruth Cheesley)
July 18, 2022, 3:47pm
6
I believe it is set to false in all places - in the UI, in the project settings file (see screenshot above where it is not selected in the UI - assuming that to mean false and green to be true, as in, turn this on if you WANT to disable the sensor - and in the project settings file it is explicitly set to false).
Colin
(Colin)
July 18, 2022, 4:12pm
7
It’s set to true here:
sonar.sourceEncoding=UTF-8
sonar.scm.disabled=false
sonar.scm.provider=git
phpmodule.sonar.sources=app,plugins
phpmodule.sonar.projectBaseDir=.
phpmodule.sonar.inclusions=app/*.php,app/**/*.php,plugins/*.php,plugins/**/*.php
phpmodule.sonar.exclusions=app/migrations/**/*,app/bundles/*Bundle/Config/**/*,app/bundles/*Bundle/DataFixtures/**/*,app/bundles/*Bundle/Tests/**/*,app/bundles/*Bundle/Translations/**/*,app/bundles/*Bundle/Views/**/*,app/middlewares/Test/**/*,app/bundles/CoreBundle/Test/**/*,plugins/*Bundle/Config/**/*,plugins/*Bundle/Tests/**/*,plugins/*Bundle/Translations/**/*,plugins/*Bundle/Views/**/*
phpmodule.sonar.cpd.exclusions=**/*
phpmodule.sonar.tests=tests
sonar.php.coverage.reportPaths=clover.xml
sonar.scm.disabled=true
It looks like you may have accidentally declared the property twice in sonar-project.properties
RCheesley
(Ruth Cheesley)
July 18, 2022, 4:16pm
8
Ahhhhh, that would do it! Just removed that line, hopefully that will sort it out! Thanks for pointing out the mistake!
system
(system)
Closed
July 25, 2022, 4:59pm
10
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.