sonarqube exclusions not working
Pyb 0.12.0.dev20180406110150 on linux, not work sonnarqube exclusions
self.project.set_property("sonarqube_project_key", "project_key")
self.project.set_property("sonarqube_project_name", "project_name")
self.project.set_property("dir_source_main_python", "src/main/python")
self.project.set_property("dir_target", "target")
self.project.set_property("dir_reports", "target/reports")
self.project.set_property("exclusions", "src/main/python/main.py")
self.assertEqual(build_sonar_runner(self.project).as_string,
"sonar-runner -Dsonar.projectKey=project_key "
"-Dsonar.exclusions=src/main/python/main.py "
"-Dsonar.projectName=project_name "
"-Dsonar.projectVersion=0.0.1 "
"-Dsonar.sources=src/main/python "
"-Dsonar.python.coverage.reportPath=target/reports/coverage*.xml")
if I run direct sonnar-ruuner then everything is fine
What exactly isn't working?
not work sonnarqube exclusions self.project.set_property("exclusions", "src/main/python/main.py") "-Dsonar.exclusions=src/main/python/main.py "
Ok, let me rephrase that. Why do you think it's not working? :) Is sonar.exclusions property not respected anymore? Has format changed?
as I said in first message if I run sonnar direct without pyb all things works, it's a bug, it's not syntax change or something
And when you run it directly, what is the command line you run it with?
Are there error messages? What's the output?
no error, it's just not exclude files, if I run it direct it's said about exclusions in log
sonar-runner -Dsonar.projectKey=project_key -Dsonar.exclusions=src/main/python/main.py -Dsonar.projectName=project_name -Dsonar.projectVersion=0.0.1 -Dsonar.sources=src/main/python -Dsonar.python.coverage.reportPath=target/reports/coverage*.xml
can you please post logs via PyB and logs via cmd line?
I can't figureout what you want to see there, here is it
pyb run_sonar_analysis PyBuilder version 0.12.0.dev20180406110150 Build started at 2018-05-31 16:10:11
[INFO] Building project version 3.0-SNAPSHOT [INFO] Executing build in /media/project [INFO] Going to execute task run_sonar_analysis [INFO] Running unit tests [INFO] Executing unit tests from Python modules in /media/project/src/unittest/python [WARN] No unit tests executed. [INFO] All unit tests passed. [INFO] Collecting coverage information [WARN] coverage_branch_threshold_warn is 0 and branch coverage will not be checked [WARN] coverage_branch_partial_threshold_warn is 0 and partial branch coverage will not be checked [INFO] Running unit tests [INFO] Executing unit tests from Python modules in /media/project/src/unittest/python [WARN] No unit tests executed. [INFO] All unit tests passed. Coverage.py warning: No data was collected. (no-data-collected) [INFO] Overall coverage is 100% [INFO] Overall coverage branch coverage is 100% [INFO] Overall coverage partial branch coverage is 100%
BUILD SUCCESSFUL
Build Summary Project: project Version: 3.0-SNAPSHOT Base directory: /media/project Environments: Tasks: prepare [330 ms] compile_sources [0 ms] run_unit_tests [61 ms] analyze [975 ms] run_sonar_analysis [23303 ms] Build finished at 2018-05-31 16:10:36 Build took 24 seconds (24730 ms)
direct
sonar-runner -Dsonar.projectKey=project_key -Dsonar.exclusions=src/main/python/main.py -Dsonar.projectName=project_name -Dsonar.projectVersion=0.0.1 -Dsonar.sources=src/main/python -Dsonar.python.coverage.reportPath=target/reports/coverage*.xml SonarQube Runner 2.4 Java 1.8.0_171 Oracle Corporation (64-bit) Linux 3.10.0-693.21.1.el7.x86_64 amd64 INFO: Runner configuration file: /opt/sonar-runner/conf/sonar-runner.properties INFO: Project configuration file: NONE INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent) INFO: Work directory: /media/project/./.sonar INFO: SonarQube Server 6.4.0.25310 16:16:21.168 INFO - Load global settings 16:16:21.328 INFO - Load global settings (done) | time=160ms 16:16:21.338 INFO - User cache: /root/.sonar/cache 16:16:21.708 INFO - Load plugins index 16:16:21.714 INFO - Load plugins index (done) | time=6ms 16:16:22.325 INFO - Process project properties 16:16:22.614 INFO - Load project repositories 16:16:22.706 INFO - Load project repositories (done) | time=92ms 16:16:22.806 INFO - Load quality profiles 16:16:22.879 INFO - Load quality profiles (done) | time=73ms 16:16:22.883 INFO - Load active rules 16:16:23.996 INFO - Load active rules (done) | time=1113ms 16:16:23.997 INFO - Load metrics repository 16:16:24.079 INFO - Load metrics repository (done) | time=82ms 16:16:24.199 INFO - Publish mode 16:16:24.199 INFO - Project key: project_key 16:16:24.202 INFO - ------------- Scan project_name 16:16:24.388 INFO - Load server rules 16:16:24.448 INFO - Load server rules (done) | time=60ms 16:16:24.756 INFO - Initializer GenericCoverageSensor 16:16:24.756 INFO - Initializer GenericCoverageSensor (done) | time=0ms 16:16:24.756 INFO - Base dir: /media/project 16:16:24.756 INFO - Working dir: /media/project/.sonar 16:16:24.757 INFO - Source paths: src/main/python 16:16:24.757 INFO - Source encoding: UTF-8, default locale: en_US 16:16:24.758 INFO - Index files 16:16:24.767 INFO - Excluded sources: 16:16:24.767 INFO - src/main/python/main.py 16:16:24.898 INFO - 20 files indexed 16:16:24.899 INFO - 1 file ignored because of inclusion/exclusion patterns 16:16:24.899 INFO - Quality profile for py: Sonar way 16:16:26.221 INFO - Sensor PythonXUnitSensor [python] 16:16:26.430 INFO - Sensor PythonXUnitSensor [python] (done) | time=209ms 16:16:26.430 INFO - Sensor Python Squid Sensor [python] 16:16:29.118 INFO - Python unit test coverage 16:16:29.306 INFO - Parsing report '/media/project/target/reports/coverage.xml' 16:16:29.469 INFO - Python integration test coverage 16:16:29.655 INFO - Python overall test coverage 16:16:29.840 INFO - Sensor Python Squid Sensor [python] (done) | time=3410ms 16:16:29.841 INFO - Sensor SonarJavaXmlFileSensor [java] 16:16:29.841 INFO - Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms 16:16:29.841 INFO - Sensor Analyzer for "php.ini" files [php] 16:16:29.843 INFO - Sensor Analyzer for "php.ini" files [php] (done) | time=2ms 16:16:29.843 INFO - Sensor Zero Coverage Sensor 16:16:29.891 INFO - Sensor Zero Coverage Sensor (done) | time=48ms 16:16:29.891 INFO - Sensor CPD Block Indexer 16:16:30.124 INFO - Sensor CPD Block Indexer (done) | time=233ms 16:16:30.124 INFO - SCM provider for this project is: git 16:16:30.125 INFO - 15 files to be analyzed 16:16:33.147 INFO - 15/15 files analyzed 16:16:33.165 INFO - 1 file had no CPD blocks 16:16:33.165 INFO - Calculating CPD for 14 files 16:16:33.304 INFO - CPD calculation finished 16:16:34.522 INFO - Analysis report generated in 946ms, dir size=153 KB 16:16:35.689 INFO - Analysis reports compressed in 1166ms, zip size=64 KB 16:16:35.922 INFO - Analysis report uploaded in 233ms 16:16:35.923 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/project_key 16:16:35.923 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report 16:16:35.923 INFO - More about the report processing at http://localhost:9000/api/ce/task?id=AWO32Eu3aP9iQQ2jIBxN 16:16:36.973 INFO - Task total time: 15.032 s INFO: ------------------------------------------------------------------------ INFO: EXECUTION SUCCESS INFO: ------------------------------------------------------------------------ Total time: 17.094s Final Memory: 9M/111M INFO: ------------------------------------------------------------------------
could you please run pyb with -vX arguments?
pyb -vX run_sonar_analysis PyBuilder version 0.12.0.dev20180406110150 Build started at 2018-06-01 03:56:54
[DEBUG] Loading project module from /media/project/build.py [DEBUG] Loading plugin 'python.core'fo [DEBUG] Trying to load builtin plugin 'python.core' [DEBUG] Loading plugin 'core' [DEBUG] Trying to load builtin plugin 'core' [DEBUG] Found builtin plugin 'pybuilder.plugins.core_plugin' [DEBUG] Found task 'clean' with dependencies [] [DEBUG] Registering task 'clean' [DEBUG] Found task 'compile_sources' with dependencies [prepare] [DEBUG] Registering task 'compile_sources' [DEBUG] Registering initializer 'init' [DEBUG] Found task 'install' with dependencies [package, publish(optional)] [DEBUG] Registering task 'install' [DEBUG] Found task 'package' with dependencies [compile_sources, run_unit_tests(optional)] [DEBUG] Registering task 'package' [DEBUG] Found task 'prepare' with dependencies [] [DEBUG] Registering task 'prepare' [DEBUG] Found task 'print_module_path' with dependencies [] [DEBUG] Registering task 'print_module_path' [DEBUG] Found task 'print_scripts_path' with dependencies [] [DEBUG] Registering task 'print_scripts_path' [DEBUG] Found task 'publish' with dependencies [package, verify(optional)] [DEBUG] Registering task 'publish' [DEBUG] Found task 'run_integration_tests' with dependencies [package] [DEBUG] Registering task 'run_integration_tests' [DEBUG] Found task 'run_unit_tests' with dependencies [compile_sources] [DEBUG] Registering task 'run_unit_tests' [DEBUG] Found task 'verify' with dependencies [run_integration_tests] [DEBUG] Registering task 'verify' [DEBUG] Found builtin plugin 'pybuilder.plugins.python.core_plugin' [DEBUG] Registering initializer 'init_python_directories' [DEBUG] Found task 'package' with dependencies [] [DEBUG] Registering task 'package' [DEBUG] Loading plugin 'python.unittest' [DEBUG] Trying to load builtin plugin 'python.unittest' [DEBUG] Found builtin plugin 'pybuilder.plugins.python.unittest_plugin' [DEBUG] Registering initializer 'init_test_source_directory' [DEBUG] Found task 'run_unit_tests' with dependencies [] [DEBUG] Registering task 'run_unit_tests' [DEBUG] Loading plugin 'python.install_dependencies' [DEBUG] Trying to load builtin plugin 'python.install_dependencies' [DEBUG] Found builtin plugin 'pybuilder.plugins.python.install_dependencies_plugin' [DEBUG] Found action create_install_log_directory [DEBUG] Registering action 'create_install_log_directory' [DEBUG] Registering initializer 'initialize_install_dependencies_plugin' [DEBUG] Found task 'install_build_dependencies' with dependencies [] [DEBUG] Registering task 'install_build_dependencies' [DEBUG] Found task 'install_dependencies' with dependencies [] [DEBUG] Registering task 'install_dependencies' [DEBUG] Found task 'install_runtime_dependencies' with dependencies [] [DEBUG] Registering task 'install_runtime_dependencies' [DEBUG] Found task 'list_dependencies' with dependencies [] [DEBUG] Registering task 'list_dependencies' [DEBUG] Loading plugin 'python.coverage' [DEBUG] Trying to load builtin plugin 'python.coverage' [DEBUG] Loading plugin 'analysis' [DEBUG] Trying to load builtin plugin 'analysis' [DEBUG] Found builtin plugin 'pybuilder.plugins.analysis_plugin' [DEBUG] Found task 'analyze' with dependencies [run_unit_tests] [DEBUG] Registering task 'analyze' [DEBUG] Found builtin plugin 'pybuilder.plugins.python.coverage_plugin' [DEBUG] Registering initializer 'init_coverage_properties' [DEBUG] Found action verify_coverage [DEBUG] Registering action 'verify_coverage' [DEBUG] Loading plugin 'python.distutils' [DEBUG] Trying to load builtin plugin 'python.distutils' [DEBUG] Found builtin plugin 'pybuilder.plugins.python.distutils_plugin' [DEBUG] Found action build_binary_distribution [DEBUG] Registering action 'build_binary_distribution' [DEBUG] Registering initializer 'initialize_distutils_plugin' [DEBUG] Found task 'install' with dependencies [] [DEBUG] Registering task 'install' [DEBUG] Found action set_description [DEBUG] Registering action 'set_description' [DEBUG] Found task 'upload' with dependencies [] [DEBUG] Registering task 'upload' [DEBUG] Found action write_manifest_file [DEBUG] Registering action 'write_manifest_file' [DEBUG] Found action write_setup_script [DEBUG] Registering action 'write_setup_script' [DEBUG] Loading plugin 'python.sonarqube' [DEBUG] Trying to load builtin plugin 'python.sonarqube' [DEBUG] Found builtin plugin 'pybuilder.plugins.python.sonarqube_plugin' [DEBUG] Found action check_sonar_runner_availability [DEBUG] Registering action 'check_sonar_runner_availability' [DEBUG] Registering initializer 'initialize_sonarqube_plugin' [DEBUG] Found task 'run_sonar_analysis' with dependencies [analyze] [DEBUG] Registering task 'run_sonar_analysis' [DEBUG] Loading plugin 'exec' [DEBUG] Trying to load builtin plugin 'exec' [DEBUG] Found builtin plugin 'pybuilder.plugins.exec_plugin' [DEBUG] Found task 'analyze' with dependencies [] [DEBUG] Registering task 'analyze' [DEBUG] Found task 'package' with dependencies [] [DEBUG] Registering task 'package' [DEBUG] Found task 'publish' with dependencies [] [DEBUG] Registering task 'publish' [DEBUG] Found task 'run_integration_tests' with dependencies [] [DEBUG] Registering task 'run_integration_tests' [DEBUG] Found task 'run_unit_tests' with dependencies [] [DEBUG] Registering task 'run_unit_tests' [DEBUG] Have loaded plugins python.core, core, python.unittest, python.install_dependencies, python.coverage, analysis, python.distutils, python.sonarqube, exec [DEBUG] Registering initializer 'initialize' [DEBUG] Found task 'setUp' with dependencies [] [DEBUG] Registering task 'setUp' [DEBUG] Registering initializer 'set_properties' [DEBUG] Found task 'zipthepackage' with dependencies [] [DEBUG] Registering task 'zipthepackage' [DEBUG] Adding 'prepare' as a dependency of task 'compile_sources' [DEBUG] Adding 'package' as a dependency of task 'install' [DEBUG] Adding 'publish(optional)' as a dependency of task 'install' [DEBUG] Adding 'compile_sources' as a dependency of task 'package' [DEBUG] Adding 'run_unit_tests(optional)' as a dependency of task 'package' [DEBUG] Adding 'package' as a dependency of task 'publish' [DEBUG] Adding 'verify(optional)' as a dependency of task 'publish' [DEBUG] Adding 'package' as a dependency of task 'run_integration_tests' [DEBUG] Adding 'compile_sources' as a dependency of task 'run_unit_tests' [DEBUG] Adding 'run_integration_tests' as a dependency of task 'verify' [DEBUG] Adding 'run_unit_tests' as a dependency of task 'analyze' [DEBUG] Adding 'analyze' as a dependency of task 'run_sonar_analysis' [DEBUG] Adding before action 'create_install_log_directory' for task 'install_build_dependencies' [DEBUG] Adding before action 'create_install_log_directory' for task 'install_runtime_dependencies' [DEBUG] Adding before action 'create_install_log_directory' for task 'install_dependencies' [DEBUG] Adding after action 'verify_coverage' for task 'analyze' [DEBUG] Adding after action 'verify_coverage' for task 'verify' [DEBUG] Adding before action 'build_binary_distribution' for task 'publish' [DEBUG] Adding after action 'set_description' for task 'prepare' [DEBUG] Adding after action 'write_manifest_file' for task 'package' [DEBUG] Adding after action 'write_setup_script' for task 'package' [DEBUG] Adding before action 'check_sonar_runner_availability' for task 'run_sonar_analysis' [DEBUG] Verbose output enabled. [DEBUG] Executing initializer 'init' from 'pybuilder.plugins.core_plugin' [DEBUG] Executing initializer 'init_python_directories' from 'pybuilder.plugins.python.core_plugin' [DEBUG] Executing initializer 'init_test_source_directory' from 'pybuilder.plugins.python.unittest_plugin' [DEBUG] Executing initializer 'initialize_install_dependencies_plugin' from 'pybuilder.plugins.python.install_dependencies_plugin' [DEBUG] Executing initializer 'init_coverage_properties' from 'pybuilder.plugins.python.coverage_plugin' [DEBUG] Executing initializer 'initialize_distutils_plugin' from 'pybuilder.plugins.python.distutils_plugin' [DEBUG] Executing initializer 'initialize_sonarqube_plugin' from 'pybuilder.plugins.python.sonarqube_plugin' [DEBUG] Executing initializer 'initialize' from 'build' [DEBUG] Executing initializer 'set_properties' from 'build' [DEBUG] Project properties: basedir : /media/project coverage_allow_non_imported_modules : True coverage_branch_partial_threshold_warn : 0 coverage_branch_threshold_warn : 0 coverage_break_build : False coverage_exceptions : [] coverage_fork : None coverage_reload_modules : None coverage_reset_modules : False coverage_threshold_warn : 40 dir_dist : $dir_target/dist/project-3.0-SNAPSHOT dir_dist_scripts : scripts dir_install_logs : $dir_logs/install_dependencies dir_logs : $dir_target/logs dir_reports : $dir_target/reports dir_source_main_python : src/main/python dir_source_main_scripts : src/main/scripts dir_source_unittest_python : src/unittest/python dir_target : target distutils_classifiers : ['Development Status :: 3 - Alpha', 'Programming Language :: Python'] distutils_command_options : {'sdist': '--format=zip'} distutils_commands : ['sdist', 'bdist_wheel'] distutils_console_scripts : None distutils_description_overwrite : False distutils_entry_points : None distutils_issue8876_workaround_enabled : False distutils_readme_description : False distutils_readme_file : README.md distutils_setup_keywords : None distutils_upload_register : False distutils_upload_repository : None distutils_upload_repository_key : None distutils_upload_sign : False distutils_upload_sign_identity : None distutils_use_setuptools : True install_dependencies_extra_index_url : None install_dependencies_index_url : None install_dependencies_insecure_installation : [] install_dependencies_local_mapping : {} install_dependencies_trusted_host : None install_dependencies_upgrade : False sonarqube_project_key : project sonarqube_project_name : project source_dist_ignore_patterns : ['.keep', '.pyc'] unittest_file_suffix : None unittest_module_glob : _tests unittest_runner : (<function
at 0x7f97ff605de8>, u'_make_result') unittest_test_method_prefix : None verbose : True [DEBUG] Execution plan is prepare, compile_sources, run_unit_tests, analyze, run_sonar_analysis [INFO] Building project version 3.0-SNAPSHOT [INFO] Executing build in /media/project [INFO] Going to execute task run_sonar_analysis [DEBUG] Executing task 'prepare' [DEBUG] Executing subtask from pybuilder.plugins.core_plugin [DEBUG] Processing plugin dependency coverage [DEBUG] Processing plugin dependency pypandoc [DEBUG] Processing plugin dependency twine [DEBUG] Processing plugin dependency unittest-xml-reporting [DEBUG] Executing action 'set_description' from 'pybuilder.plugins.python.distutils_plugin' before task [DEBUG] Executing task 'compile_sources' [DEBUG] Executing subtask from pybuilder.plugins.core_plugin [DEBUG] Executing task 'run_unit_tests' [DEBUG] Executing subtask from pybuilder.plugins.core_plugin [DEBUG] Executing subtask from pybuilder.plugins.python.unittest_plugin [INFO] Running unit tests [DEBUG] Forking process to run unit tests [INFO] Executing unit tests from Python modules in /media/project/src/unittest/python [DEBUG] Including files matching ' _tests' [WARN] No unit tests executed. [INFO] All unit tests passed. [DEBUG] Executing subtask from pybuilder.plugins.exec_plugin [DEBUG] Executing task 'analyze' [DEBUG] Executing subtask from pybuilder.plugins.analysis_plugin [DEBUG] Executing subtask from pybuilder.plugins.exec_plugin [DEBUG] Executing action 'verify_coverage' from 'pybuilder.plugins.python.coverage_plugin' before task [INFO] Collecting coverage information [WARN] coverage_branch_threshold_warn is 0 and branch coverage will not be checked [WARN] coverage_branch_partial_threshold_warn is 0 and partial branch coverage will not be checked [DEBUG] Forking process to do coverage analysis [DEBUG] Module 'main' coverage to be verified [DEBUG] Module 'project.blend' coverage to be verified [DEBUG] Module 'project.consolidateData' coverage to be verified [DEBUG] Module 'project.debug' coverage to be verified [DEBUG] Module 'project.project' coverage to be verified [DEBUG] Module 'project.projectAndprojectError' coverage to be verified [DEBUG] Module 'project.projectEnum' coverage to be verified [DEBUG] Module 'project.hive' coverage to be verified [DEBUG] Module 'project.notifyprojectCompleted' coverage to be verified [DEBUG] Module 'project.prescriptionLevelproject' coverage to be verified [DEBUG] Module 'project.regressionLine' coverage to be verified [DEBUG] Module 'project.seasonal1' coverage to be verified [DEBUG] Module 'project.seasonality2' coverage to be verified [DEBUG] Module 'project.seasonalRatio' coverage to be verified [DEBUG] Module 'project.simpleproject' coverage to be verified [DEBUG] Module 'project.main' coverage to be verified [DEBUG] Executing task 'prepare' [DEBUG] Executing subtask from pybuilder.plugins.core_plugin [DEBUG] Processing plugin dependency coverage [DEBUG] Processing plugin dependency pypandoc [DEBUG] Processing plugin dependency twine [DEBUG] Processing plugin dependency unittest-xml-reporting [DEBUG] Executing action 'set_description' from 'pybuilder.plugins.python.distutils_plugin' before task [DEBUG] Executing task 'compile_sources' [DEBUG] Executing subtask from pybuilder.plugins.core_plugin [DEBUG] Executing task 'run_unit_tests' [DEBUG] Executing subtask from pybuilder.plugins.core_plugin [DEBUG] Executing subtask from pybuilder.plugins.python.unittest_plugin [INFO] Running unit tests [INFO] Executing unit tests from Python modules in /media/project/src/unittest/python [DEBUG] Including files matching '_tests' [WARN] No unit tests executed. [INFO] All unit tests passed. [DEBUG] Executing subtask from pybuilder.plugins.exec_plugin Coverage.py warning: No data was collected. (no-data-collected) [INFO] Overall coverage is 100% [INFO] Overall coverage branch coverage is 100% [INFO] Overall coverage partial branch coverage is 100% [DEBUG] Executing task 'run_sonar_analysis' [DEBUG] Executing action 'check_sonar_runner_availability' from 'pybuilder.plugins.python.sonarqube_plugin' before task [DEBUG] Executing subtask from pybuilder.plugins.python.sonarqube_pluginBUILD SUCCESSFUL
Build Summary Project: project Version: 3.0-SNAPSHOT Base directory: /media/project Environments: Tasks: prepare [335 ms] compile_sources [0 ms] run_unit_tests [100 ms] analyze [1037 ms] run_sonar_analysis [15151 ms] Build finished at 2018-06-01 03:57:10 Build took 16 seconds (16638 ms)
seems it's not understand more that
sonarqube_project_key : project sonarqube_project_name : project
It looks to me like a plugin not working. I'll check it out.
How to pass sonar qube host url with run_sonar_analysis task like : pyb run_sonar_analysis -P sonarqube_project_key=some_project_key_in_sonar