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

Python: ecoCode plugin with SonarQube, no code-smell detection #64

Closed
matthieumarrast opened this issue Mar 3, 2023 · 8 comments
Closed
Assignees
Labels
__PRIO_HIGH__ python 💉 bug Something isn't working

Comments

@matthieumarrast
Copy link

I installed the plugin in my local SonarQube installation (v9.9).
I activated the "eco-conception" rules in my Quality Profile:
image
This Quality Profile is well "applied" to my project.

But the rules are no detecting code smells on my Python code :
image
Example in screenshot above for rules:

  • S74: Don't use the query SELECT * FROM
  • S72 : Avoid SQL request in loop
    I also tried, S34 (Avoid using try-catch-finally statement) without "success".
@matthieumarrast matthieumarrast added the 💉 bug Something isn't working label Mar 3, 2023
@matthieumarrast
Copy link
Author

Way to reproduce:

# 1. run server
$ docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest
# 2. go to http://localhost:9000, update admin password and create a project
# 3. add plugin
$ wget https://github.com/green-code-initiative/ecoCode/releases/download/0.2.2/ecocode-python-plugin-0.2.2.jar
$ docker cp ecocode-python-plugin-0.2.2.jar sonarqube:/opt/sonarqube/extensions/plugins
$ docker restart sonarqube
# 4. create a new Quality Profile with "eco-conception" rules activated, and apply on project
# 5. run scanner
$ sudo docker run --network=host --rm -e SONAR_HOST_URL="http://localhost:9000" -e SONAR_SCANNER_OPTS="-Dsonar.projectKey=<project-key>" -e SONAR_LOGIN="<sonar-token>" -v "<project_repository>:/usr/src" sonarsource/sonar-scanner-cli

@dedece35
Copy link
Member

dedece35 commented Mar 7, 2023

Hi @matthieumarrast,
thank you for your issue.

The best thing to do to check this issue is to create a test project like mentionned here #65 (in progress for java language).
I will work on it soon unless if you want to create it ;p

@dedece35 dedece35 self-assigned this Mar 14, 2023
@dedece35
Copy link
Member

Hi @matthieumarrast,
I'm working on this issue with the creation of a python test-project like mentionned above.

@dedece35
Copy link
Member

Hi @matthieumarrast,
you're right, there was a problem with python plugin.
my PR #77 and the new test project for python (https://github.com/green-code-initiative/ecoCode-python-test-project) was modified to check now the good processing.

@matthieumarrast
Copy link
Author

ok as soon as the plugin will be released with your PR #77 I'm gonna test it

@dedece35
Copy link
Member

Hi @matthieumarrast,
PR #77 merged on main branch.
the correction is available on main branch (SNAPSHOT version) or in the next release version.

@dedece35
Copy link
Member

Hi @matthieumarrast,
all is ok now.
please, test it with out new real test project above.

@matthieumarrast
Copy link
Author

Hi @dedece35

Thank you it's OK now.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
__PRIO_HIGH__ python 💉 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants