5

I am trying to use pylint with the python plugin in sonar and a jenkins job. However, even though my pylint results are created and available in the workspace, sonar is not picking it up.

Execute shell step: generate pylint report file

cd $WORKSPACE
export TERM="linux"
pylint --rcfile=.pylintrc $(find . -iname "*.py" -print) -r n --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > pylint-report.txt || exit 0

Execute SonarQube Scanner: scan project and send to sonar server

sonar.projectKey=python:python-project
sonar.projectName=python-project
sonar.projectVersion=dev
sonar.projectDescription=python project

sonar.language=py
sonar.projectBaseDir=$WORKSPACE
sonar.sources=$WORKSPACE

sonar.python.pylint.reportPath=pylint-report.txt
sonar.python.pylint=/bin/pylint
sonar.python.pylint_config=.pylintrc

sonar.exclusions=**/venv/**
sonar.sourceEncoding=UTF-8

This job succeeds and data is populated into sonar, but I don't see any pylint data. I tried running the sonar-scanner manually directly in the workspace using the same flags the job is using (plus debug enabled) and I don't even see it looking for a pylint report file:

09:08:42.040 INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
09:08:42.044 INFO: Project root configuration file: /var/lib/jenkins/workspace/redacted-sonar/sonar-project.properties
09:08:42.066 INFO: SonarQube Scanner 2.8
09:08:42.066 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
09:08:42.066 INFO: Linux 3.10.0-514.6.1.el7.x86_64 amd64
09:08:42.262 DEBUG: keyStore is :
09:08:42.262 DEBUG: keyStore type is : jks
09:08:42.262 DEBUG: keyStore provider is :
09:08:42.262 DEBUG: init keystore
09:08:42.263 DEBUG: init keymanager of type SunX509
09:08:42.332 INFO: User cache: /root/.sonar/cache
09:08:42.332 DEBUG: Extract sonar-scanner-api-batch in temp...
09:08:42.339 DEBUG: Get bootstrap index...
09:08:42.340 DEBUG: Download: http://redacted.com/batch_bootstrap/index
09:08:42.401 DEBUG: Get bootstrap completed
09:08:42.402 DEBUG: Create isolated classloader...
09:08:42.417 DEBUG: Start temp cleaning...
09:08:42.429 DEBUG: Temp cleaning done
09:08:42.429 DEBUG: Execution getVersion
09:08:42.433 DEBUG: Execution start
09:08:42.637 DEBUG: Publish global mode
09:08:42.741 INFO: Load global repositories
09:08:42.813 DEBUG: GET 200 http://redacted.com/batch/global | time=68ms
09:08:42.872 INFO: Load global repositories (done) | time=132ms
09:08:42.888 INFO: User cache: /root/.sonar/cache
09:08:43.094 INFO: Load plugins index
09:08:43.100 DEBUG: GET 200 http://redacted.com/deploy/plugins/index.txt | time=5ms
09:08:43.100 INFO: Load plugins index (done) | time=6ms
09:08:43.101 DEBUG: Load plugins
09:08:43.113 DEBUG: Load plugins (done) | time=12ms
09:08:43.123 DEBUG: API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
09:08:43.201 DEBUG: Plugins:
09:08:43.201 DEBUG:   * Python 1.7.0.1195 (python)
09:08:43.201 DEBUG:   * CSS / SCSS / Less 3.1 (css)
09:08:43.201 DEBUG:   * Web 2.5.0.476 (web)
09:08:43.201 DEBUG:   * Git 1.2 (scmgit)
09:08:43.201 DEBUG:   * JSON 2.2 (JSON)
09:08:43.201 DEBUG:   * SonarJS 2.20.0.4207 (javascript)
09:08:43.219 DEBUG: Execution getVersion
09:08:43.219 INFO: SonarQube server 6.2
09:08:43.220 INFO: Default locale: "en_US", source code encoding: "UTF-8"
09:08:43.220 DEBUG: Work directory: /var/lib/jenkins/workspace/redacted-sonar/.sonar
09:08:43.220 DEBUG: Execution getVersion
09:08:43.221 DEBUG: Execution execute
09:08:43.491 INFO: Process project properties
09:08:43.493 DEBUG: Process project properties (done) | time=2ms
09:08:43.622 INFO: Load project repositories
09:08:43.640 DEBUG: GET 200 http://redacted.com/batch/project.protobuf?key=redacted%3Aredacted | time=17ms
09:08:43.707 INFO: Load project repositories (done) | time=85ms
09:08:43.775 DEBUG: Available languages:
09:08:43.775 DEBUG:   * Python => "py"
09:08:43.775 DEBUG:   * CSS => "css"
09:08:43.775 DEBUG:   * SCSS => "scss"
09:08:43.775 DEBUG:   * Less => "less"
09:08:43.775 DEBUG:   * Web => "web"
09:08:43.775 DEBUG:   * JSON => "json"
09:08:43.775 DEBUG:   * JavaScript => "js"
09:08:43.779 INFO: Load quality profiles
09:08:43.799 DEBUG: GET 200 http://redacted.com/api/qualityprofiles/search.protobuf?projectKey=redacted%3Aredacted | time=20ms
09:08:43.804 INFO: Load quality profiles (done) | time=25ms
09:08:43.810 INFO: Load active rules
09:08:43.853 DEBUG: GET 200 http://redacted.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=css-sonarqube-way-71134&p=1&ps=500 | time=43ms
09:08:43.938 DEBUG: GET 200 http://redacted.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=js-sonar-way-27675&p=1&ps=500 | time=46ms
09:08:43.961 DEBUG: GET 200 http://redacted.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=json-sonarqube-way-96571&p=1&ps=500 | time=19ms
09:08:44.005 DEBUG: GET 200 http://redacted.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=less-sonarqube-way-34273&p=1&ps=500 | time=43ms
09:08:44.039 DEBUG: GET 200 http://redacted.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=py-sonar-way-66789&p=1&ps=500 | time=28ms
09:08:44.090 DEBUG: GET 200 http://redacted.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=scss-sonarqube-way-58162&p=1&ps=500 | time=49ms
09:08:44.114 DEBUG: GET 200 http://redacted.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=web-sonar-way-97604&p=1&ps=500 | time=20ms
09:08:44.125 INFO: Load active rules (done) | time=315ms
09:08:44.160 INFO: Publish mode
09:08:44.160 DEBUG: Start recursive analysis of project modules
09:08:44.161 INFO: -------------  Scan redacted
09:08:44.250 INFO: Language is forced to py
09:08:44.259 INFO: Load server rules
09:08:44.375 DEBUG: GET 200 http://redacted.com/api/rules/list.protobuf | time=116ms
09:08:44.384 INFO: Load server rules (done) | time=125ms
09:08:44.433 DEBUG: Initializers : GenericCoverageSensor
09:08:44.434 INFO: Initializer GenericCoverageSensor
09:08:44.434 INFO: Initializer GenericCoverageSensor (done) | time=0ms
09:08:44.434 INFO: Base dir: /var/lib/jenkins/workspace/redacted-sonar
09:08:44.434 INFO: Working dir: /var/lib/jenkins/workspace/redacted-sonar/.sonar
09:08:44.436 INFO: Source paths: .
09:08:44.436 INFO: Source encoding: UTF-8, default locale: en_US
09:08:44.436 INFO: Index files
09:08:44.439 INFO: Excluded sources:
09:08:44.439 INFO:   **/flask/**
09:08:44.441 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : **/*.py
09:08:44.441 DEBUG: Declared extensions of language CSS were converted to sonar.lang.patterns.css : **/*.css
09:08:44.441 DEBUG: Declared extensions of language SCSS were converted to sonar.lang.patterns.scss : **/*.scss
09:08:44.441 DEBUG: Declared extensions of language Less were converted to sonar.lang.patterns.less : **/*.less
09:08:44.441 DEBUG: Declared extensions of language Web were converted to sonar.lang.patterns.web : **/*.html,**/*.xhtml,**/*.rhtml,**/*.shtml
09:08:44.441 DEBUG: Declared extensions of language JSON were converted to sonar.lang.patterns.json : **/*.json
09:08:44.442 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js
09:08:44.446 DEBUG: Language of file 'app/__init__.py' is detected to be 'py'
09:08:44.446 DEBUG: Language of file 'app/app.py' is detected to be 'py'
09:08:44.447 DEBUG: Language of file 'checks_queue_runner.py' is detected to be 'py'
09:08:44.457 DEBUG: Language of file 'clear_queue.py' is detected to be 'py'
09:08:44.457 DEBUG: Language of file 'config.py' is detected to be 'py'
09:08:44.459 DEBUG: Language of file 'delete_queue_runner.py' is detected to be 'py'
09:08:44.468 DEBUG: Language of file 'get_auth_token.py' is detected to be 'py'
09:08:44.470 DEBUG: Language of file 'osclient.py' is detected to be 'py'
09:08:44.471 DEBUG: Language of file 'queue_runner.py' is detected to be 'py'
09:08:44.477 DEBUG: Language of file 'run.py' is detected to be 'py'
09:08:44.478 DEBUG: Language of file 'tq.py' is detected to be 'py'
09:08:44.490 INFO: 11 files indexed
09:08:44.492 INFO: 0 files ignored because of inclusion/exclusion patterns
09:08:44.507 INFO: Quality profile for py: Sonar way
09:08:44.519 DEBUG: Code colorizer, supported languages:
09:08:45.813 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
09:08:45.813 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
09:08:45.814 DEBUG: 'CSS Analyzer Sensor' skipped because there is no related file in current project
09:08:45.814 DEBUG: 'SCSS Analyzer Sensor' skipped because there is no related file in current project
09:08:45.815 DEBUG: 'Less Analyzer Sensor' skipped because there is no related file in current project
09:08:45.815 DEBUG: 'Web' skipped because there is no related file in current project
09:08:45.815 DEBUG: 'JSON Squid Sensor' skipped because there is no related file in current project
09:08:45.815 DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project
09:08:45.820 DEBUG: Sensors : Lines Sensor -> PythonXUnitSensor -> SCM Sensor -> Python Squid Sensor -> Embedded CSS Analyzer Sensor -> Zero Coverage Sensor -> Code Colorizer Sensor -> CPD Block Indexer
09:08:45.820 INFO: Sensor Lines Sensor
09:08:45.830 INFO: Sensor Lines Sensor (done) | time=10ms
09:08:45.830 INFO: Sensor PythonXUnitSensor
09:08:45.830 DEBUG: Using pattern 'xunit-reports/xunit-result-*.xml' to find reports
09:08:45.842 DEBUG: No report was found for sonar.python.xunit.reportPath using default pattern xunit-reports/xunit-result-*.xml
09:08:45.842 INFO: Sensor PythonXUnitSensor (done) | time=12ms
09:08:45.842 INFO: Sensor SCM Sensor
09:08:45.850 INFO: Sensor SCM Sensor (done) | time=8ms
09:08:45.851 INFO: Sensor Python Squid Sensor
09:08:46.315 INFO: Python unit test coverage
09:08:46.315 DEBUG: Using pattern 'coverage-reports/coverage-*.xml' to find reports
09:08:46.317 DEBUG: No report was found for sonar.python.coverage.reportPath using default pattern coverage-reports/coverage-*.xml
09:08:46.318 INFO: Python integration test coverage
09:08:46.318 DEBUG: Using pattern 'coverage-reports/it-coverage-*.xml' to find reports
09:08:46.319 DEBUG: No report was found for sonar.python.coverage.itReportPath using default pattern coverage-reports/it-coverage-*.xml
09:08:46.319 INFO: Python overall test coverage
09:08:46.319 DEBUG: Using pattern 'coverage-reports/overall-coverage-*.xml' to find reports
09:08:46.321 DEBUG: No report was found for sonar.python.coverage.overallReportPath using default pattern coverage-reports/overall-coverage-*.xml
09:08:46.321 INFO: Sensor Python Squid Sensor (done) | time=470ms
09:08:46.321 INFO: Sensor Embedded CSS Analyzer Sensor
09:08:46.382 INFO: 0 source files to be analyzed
09:08:46.383 INFO: Sensor Embedded CSS Analyzer Sensor (done) | time=62ms
09:08:46.383 INFO: Sensor Zero Coverage Sensor
09:08:46.387 INFO: 0/0 source files have been analyzed
09:08:46.399 INFO: Sensor Zero Coverage Sensor (done) | time=16ms
09:08:46.399 INFO: Sensor Code Colorizer Sensor
09:08:46.400 INFO: Sensor Code Colorizer Sensor (done) | time=1ms
09:08:46.400 INFO: Sensor CPD Block Indexer
09:08:46.400 INFO: DefaultCpdBlockIndexer is used for py
09:08:46.402 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/app/__init__.py
09:08:46.405 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/app/app.py
09:08:46.429 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/checks_queue_runner.py
09:08:46.431 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/clear_queue.py
09:08:46.432 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/config.py
09:08:46.434 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/delete_queue_runner.py
09:08:46.440 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/get_auth_token.py
09:08:46.442 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/osclient.py
09:08:46.446 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/queue_runner.py
09:08:46.449 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/run.py
09:08:46.450 DEBUG: Populating index from /var/lib/jenkins/workspace/redacted-sonar/tq.py
09:08:46.451 INFO: Sensor CPD Block Indexer (done) | time=51ms
09:08:46.456 INFO: Calculating CPD for 9 files
09:08:46.457 DEBUG: Detection of duplications for redacted:redacted:config.py
09:08:46.464 DEBUG: Detection of duplications for redacted:redacted:tq.py
09:08:46.465 DEBUG: Detection of duplications for redacted:redacted:checks_queue_runner.py
09:08:46.471 DEBUG: Detection of duplications for redacted:redacted:queue_runner.py
09:08:46.474 DEBUG: Detection of duplications for redacted:redacted:app/app.py
09:08:46.476 DEBUG: Detection of duplications for redacted:redacted:osclient.py
09:08:46.477 DEBUG: Detection of duplications for redacted:redacted:clear_queue.py
09:08:46.478 DEBUG: Detection of duplications for redacted:redacted:get_auth_token.py
09:08:46.478 DEBUG: Detection of duplications for redacted:redacted:delete_queue_runner.py
09:08:46.479 INFO: CPD calculation finished
09:08:46.557 INFO: Analysis report generated in 74ms, dir size=104 KB
09:08:46.583 INFO: Analysis reports compressed in 25ms, zip size=43 KB
09:08:46.583 INFO: Analysis report generated in /var/lib/jenkins/workspace/redacted-sonar/.sonar/batch-report
09:08:46.583 DEBUG: Upload report
09:08:46.612 DEBUG: POST 200 http://redacted.com/api/ce/submit?projectKey=redacted:redacted&projectName=redacted | time=27ms
09:08:46.614 INFO: Analysis report uploaded in 31ms
09:08:46.614 INFO: ANALYSIS SUCCESSFUL, you can browse http://redacted.com/dashboard/index/redacted:redacted
09:08:46.614 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
09:08:46.614 INFO: More about the report processing at http://redacted.com/api/ce/task?id=redacted
09:08:46.619 DEBUG: Report metadata written to /var/lib/jenkins/workspace/redacted-sonar/.sonar/report-task.txt
09:08:46.620 DEBUG: Post-jobs :
09:08:46.622 INFO: Task total time: 3.396 s
09:08:46.622 INFO: ------------------------------------------------------------------------
09:08:46.622 INFO: EXECUTION SUCCESS
09:08:46.622 INFO: ------------------------------------------------------------------------
09:08:46.622 INFO: Total time: 4.610s
09:08:46.715 INFO: Final Memory: 45M/163M
09:08:46.715 INFO: ------------------------------------------------------------------------
09:08:46.716 DEBUG: Execution getVersion
09:08:46.716 DEBUG: Execution stop

Versions:

Java 1.8.0_121 Oracle Corporation
Linux 3.10.0-514.6.1.el7.x86_64 amd64
SonarQube server 6.2
pylint 1.6.5,
astroid 1.4.9
Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
Plugins:
  * Python 1.7.0.1195 (python)
  * CSS / SCSS / Less 3.1 (css)
  * Web 2.5.0.476 (web)
  * Git 1.2 (scmgit)
  * JSON 2.2 (JSON)
  * SonarJS 2.20.0.4207 (javascript)

example pylint output:

************* Module tq
tq.py:1: [R0801(duplicate-code), ] Similar lines in 2 files
==app.app:246
==get_auth_token:13
***REDACTED RAW CODE***

tq.py:1: [R0801(duplicate-code), ] Similar lines in 2 files
==checks_queue_runner:1
==queue_runner:1
***REDACTED RAW CODE***

# connect to consul
tq.py:1: [R0801(duplicate-code), ] Similar lines in 3 files
==checks_queue_runner:1
==clear_queue:1
==queue_runner:1
***REDACTED RAW CODE***

tq.py:1: [R0801(duplicate-code), ] Similar lines in 2 files
==app.app:40
==tq:11
***REDACTED RAW CODE***

tq.py:1: [R0801(duplicate-code), ] Similar lines in 4 files
==checks_queue_runner:1
==clear_queue:1
==delete_queue_runner:2
==queue_runner:1
***REDACTED RAW CODE***


Report
======
774 statements analysed.

Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |12     |12         |=          |25.00       |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |1      |1          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |16     |16         |=          |93.75       |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |25     |25         |=          |8.00        |0.00     |
+---------+-------+-----------+-----------+------------+---------+



External dependencies
---------------------
::

    app
      \-app (run)
        \-app (app)
    osclient (clear_queue,app.app,queue_runner,checks_queue_runner,delete_queue_runner)
    six (osclient)



Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |895    |66.59 |895      |=          |
+----------+-------+------+---------+-----------+
|docstring |102    |7.59  |102      |=          |
+----------+-------+------+---------+-----------+
|comment   |141    |10.49 |141      |=          |
+----------+-------+------+---------+-----------+
|empty     |206    |15.33 |206      |=          |
+----------+-------+------+---------+-----------+



Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |97    |97       |=          |
+-------------------------+------+---------+-----------+
|percent duplicated lines |7.282 |7.282    |=          |
+-------------------------+------+---------+-----------+



Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |238    |238      |=          |
+-----------+-------+---------+-----------+
|refactor   |16     |16       |=          |
+-----------+-------+---------+-----------+
|warning    |681    |681      |=          |
+-----------+-------+---------+-----------+
|error      |41     |41       |=          |
+-----------+-------+---------+-----------+



% errors / warnings by module
-----------------------------

+--------------------+------+--------+---------+-----------+
|module              |error |warning |refactor |convention |
+====================+======+========+=========+===========+
|app.app             |21.95 |56.09   |25.00    |43.28      |
+--------------------+------+--------+---------+-----------+
|delete_queue_runner |19.51 |4.99    |25.00    |7.98       |
+--------------------+------+--------+---------+-----------+
|queue_runner        |14.63 |14.39   |12.50    |15.97      |
+--------------------+------+--------+---------+-----------+
|checks_queue_runner |14.63 |8.22    |0.00     |7.56       |
+--------------------+------+--------+---------+-----------+
|clear_queue         |14.63 |7.05    |0.00     |6.30       |
+--------------------+------+--------+---------+-----------+
|get_auth_token      |4.88  |7.78    |0.00     |4.62       |
+--------------------+------+--------+---------+-----------+
|osclient            |4.88  |0.88    |6.25     |7.56       |
+--------------------+------+--------+---------+-----------+
|app.__init__        |2.44  |0.15    |0.00     |1.26       |
+--------------------+------+--------+---------+-----------+
|tq                  |2.44  |0.00    |31.25    |3.78       |
+--------------------+------+--------+---------+-----------+
|config              |0.00  |0.29    |0.00     |1.26       |
+--------------------+------+--------+---------+-----------+
|run                 |0.00  |0.15    |0.00     |0.42       |
+--------------------+------+--------+---------+-----------+



Messages
--------

+------------------------------+------------+
|message id                    |occurrences |
+==============================+============+
|mixed-indentation             |233         |
+------------------------------+------------+
|bad-indentation               |204         |
+------------------------------+------------+
|unused-wildcard-import        |149         |
+------------------------------+------------+
|invalid-name                  |75          |
+------------------------------+------------+
|bad-whitespace                |49          |
+------------------------------+------------+
|line-too-long                 |44          |
+------------------------------+------------+
|import-error                  |38          |
+------------------------------+------------+
|unused-variable               |33          |
+------------------------------+------------+
|missing-docstring             |33          |
+------------------------------+------------+
|unused-import                 |32          |
+------------------------------+------------+
|bad-continuation              |18          |
+------------------------------+------------+
|wrong-import-order            |11          |
+------------------------------+------------+
|unnecessary-semicolon         |8           |
+------------------------------+------------+
|wildcard-import               |6           |
+------------------------------+------------+
|unused-argument               |5           |
+------------------------------+------------+
|duplicate-code                |5           |
+------------------------------+------------+
|redefined-outer-name          |4           |
+------------------------------+------------+
|bare-except                   |4           |
+------------------------------+------------+
|too-many-statements           |3           |
+------------------------------+------------+
|too-many-locals               |3           |
+------------------------------+------------+
|too-many-arguments            |3           |
+------------------------------+------------+
|superfluous-parens            |3           |
+------------------------------+------------+
|undefined-variable            |2           |
+------------------------------+------------+
|trailing-whitespace           |2           |
+------------------------------+------------+
|wrong-import-position         |1           |
+------------------------------+------------+
|too-many-nested-blocks        |1           |
+------------------------------+------------+
|too-many-format-args          |1           |
+------------------------------+------------+
|too-many-branches             |1           |
+------------------------------+------------+
|singleton-comparison          |1           |
+------------------------------+------------+
|relative-import               |1           |
+------------------------------+------------+
|old-style-class               |1           |
+------------------------------+------------+
|broad-except                  |1           |
+------------------------------+------------+
|anomalous-backslash-in-string |1           |
+------------------------------+------------+



Global evaluation
-----------------
Your code has been rated at -4.73/10 (previous run: -4.73/10, +0.00)

EDIT I was able to get this working by chowning the pylint-report.txt to jenkins:jenkins as a part of my exec shell step and that seems to have made it work.

beardedeagle
  • 762
  • 1
  • 11
  • 24
  • 1
    Did you activate Pylint rules in SonarQube profile? – Elena Vilchik Feb 23 '17 at 13:38
  • @ElenaVilchik I have all rules enabled except for deprecated rules. However, I chowned the pylint-report.txt to `jenkins:jenkins` as a part of my exec shell step and that seems to have made `PylintImportSensor` kick in (complains alot about `Pylint rule is unknown in Sonar` though). It's not picking up duplications though and there are definitely some when I run pylint manually. Not sure how to make that work. – beardedeagle Feb 23 '17 at 14:46
  • What kind of duplications are you talking about? Could you provide pylint report? – Elena Vilchik Feb 24 '17 at 14:45
  • @ElenaVilchik Added. Redacted the raw code pylint outputs for showing what code is duplicated. – beardedeagle Feb 24 '17 at 19:05
  • @ElenaVilchik for now I have my jenkins instance using clonedigger for duplicate code reports until sonar has it working. – beardedeagle Feb 28 '17 at 17:55
  • @ElenaVilchik how do you activate the pylint rules??? – XtianGIS Aug 01 '17 at 22:34
  • In your report I only issues for R0801 (duplicate-code), this rule is deprecated. To activate the rule, open it in SQ UI and activate in the profile you use in your project. – Elena Vilchik Aug 23 '17 at 12:25

1 Answers1

0

I had the same problem, but the solution was different: activate pylint rules on sonarqube. I activated one by one in my Python quality profile, jotting down the code of the pylint rules for which the description (on sonarqube) said it was deprecated.

In general, the pylint rule is deemed deprecated on sonarqube when the "built-in" SonarAnalyzer for Python already has the same rule. (We don't want the same issue reported by two rules.)

These are the pylint rules that I found as deprecated on sonarqube. I disabled them on my pylint.cfg file. C0103,C0111,C0112,C0301,C0302,C0303,C0304,C0321,C0325,C1001,E0100,E0101,E0103,E0104,E0105,E0106,E0107,E0235,R0201,R0801,R0911,R0912,R0913,W0101,W0107,W0122,W0331,W0333,W1401

When activating a rule, you specify the severity, so doing one by one allows you to configure how "offensive" each type of violation is for your projects.

Paulo Merson
  • 13,270
  • 8
  • 79
  • 72