nedbat / coveragepy

The code coverage tool for Python
https://coverage.readthedocs.io
Apache License 2.0
3.02k stars 433 forks source link

java.lang.IllegalStateException: Line 534 is out of range in the file #937

Closed anilkonduru closed 3 years ago

anilkonduru commented 4 years ago

java.lang.IllegalStateException: Line 534 is out of range in the file. This error started after updating build environment from python 3.5 and 3.8. Any idea what could be the reason?

sonar-scanner version 4.2

With Python 3.8, the generated coverage.xml has 676 lines while actual source file has only 420 lines.

With Python 3.5, the generated coverage.xml has exactly 420 line same as source file.

SonarPython 1.14.1.3143 (python)

SonarQube 1.5.0.870

06:29:37 + cat /opt/runtime/sonar-scanner-4.2/conf/sonar-scanner.properties 06:29:37 #Configure here general information about the environment, such as SonarQube server connection details for example 06:29:37 #No information about specific project should appear here 06:29:37 06:29:37 #----- Default SonarQube server 06:29:37 06:29:37 06:29:37 #----- Default source code encoding 06:29:37 #sonar.sourceEncoding=UTF-8 06:29:37 [Pipeline] sh

[Pipeline] sh

[Pipeline] sh

[Pipeline] sh 06:29:50 + rm -f /home/git/.sonar/cache [Pipeline] echo 06:29:50 end1

06:29:51 Insight correlationId: d824edf1-f25c-4138-b47f-8ba5ef21a16e [Pipeline] withEnv [Pipeline] { [Pipeline] sh 06:29:51 + set +x [Pipeline] } [Pipeline] // withEnv [Pipeline] stage [Pipeline] { (run sonarqube scan) [Pipeline] libraryResource [Pipeline] readProperties [Pipeline] echo 06:29:52 ✅ run sonarqube scan Started. [Pipeline] libraryResource [Pipeline] readProperties [Pipeline] sh 06:29:53 + echo /test/tes/testy/workspace/test-component 06:29:55 + pip list 06:29:55 + grep pylint 06:29:55 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at 06:29:55 WARNING: You are using pip version 19.3.1; however, version 20.0.2 is available. 06:29:55 You should consider upgrading via the 'pip install --upgrade pip' command. 06:29:55 + true [Pipeline] fileExists [Pipeline] sh 06:29:56 + /opt/runtime/sonar-scanner-4.2/bin/sonar-scanner -Dsonar.python.coverage.reportPaths=./mycomponent-test/coverage.xml -Dsonar.language=py -Dsonar.sources=. -Dsonar.scm.forceReloadAll=true -Dsonar.forceAnalysis=true -Dsonar.projectBaseDir=tests -Dsonar.verbose=true -Dsonar.host.url=test/ -Dsonar.projectKey=mycomponent-test -Dsonar.projectName=mycomponent-test -Dsonar.projectVersion=0.1.32 -Dsonar.profile=test_Python_PROFILE -Dsonar.forceAnalysis=false -Dsonar.python.pylint=/test/tes/testy/workspace/mycomponent-test_pylint/bin/pylint '-Dsonar.exclusions=/database//.,/models//.,/exceptions//.,//init.py,' 06:29:56 INFO: Scanner configuration file: /opt/runtime/sonar-scanner-4.2/conf/sonar-scanner.properties 06:29:56 INFO: Project root configuration file: NONE 06:29:56 06:29:56.417 INFO: SonarQube Scanner 4.2.0.1873 06:29:56 06:29:56.418 INFO: Java 11.0.3 AdoptOpenJDK (64-bit) 06:29:56 06:29:56.418 INFO: Linux 4.14.158-129.185.amzn2.x86_64 amd64 06:29:56 06:29:56.599 DEBUG: keyStore is : 06:29:56 06:29:56.599 DEBUG: keyStore type is : pkcs12 06:29:56 06:29:56.599 DEBUG: keyStore provider is : 06:29:56 06:29:56.599 DEBUG: init keystore 06:29:56 06:29:56.600 DEBUG: init keymanager of type SunX509 06:29:57 06:29:56.750 DEBUG: Create: /home/git/.sonar/cache 06:29:57 06:29:56.750 INFO: User cache: /home/git/.sonar/cache 06:29:57 06:29:56.750 DEBUG: Create: /home/git/.sonar/cache/_tmp 06:29:57 06:29:56.752 DEBUG: Extract sonar-scanner-api-batch in temp... 06:29:57 06:29:56.757 DEBUG: Get bootstrap index... 06:29:57 06:29:56.757 DEBUG: Download: test/batch/index 06:29:57 06:29:57.042 DEBUG: Get bootstrap completed 06:29:57 06:29:57.046 DEBUG: Download test/batch/file?name=scanner-enterprise-7.9.1-all.jar to /home/git/.sonar/cache/_tmp/fileCache8605793573051139961.tmp 06:29:57.628 DEBUG: Create isolated classloader... 06:29:57.639 DEBUG: Start temp cleaning... 06:29:57.642 DEBUG: Temp cleaning done 06:29:57.643 DEBUG: Execution getVersion 06:29:57.649 INFO: SonarQube server 7.9.1 06:29:57.649 INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent) 06:29:57.650 DEBUG: Work directory: /test/tes/testy/workspace/test-component/tests/.scannerwork 06:29:57.650 DEBUG: Execution execute 06:29:57.906 DEBUG: Enterprise 7.9.1.27448 06:29:57.999 INFO: Load global settings .140 DEBUG: GET 200 test/api/settings/values.protobuf | time=140ms .167 INFO: Load global settings (done) | time=168ms .168 INFO: Server id: 07F94FC8-AWZHVadh5K9I-bHTD0ra .180 DEBUG: Create : /home/git/.sonar/_tmp .180 INFO: User cache: /home/git/.sonar/cache .182 INFO: Load/download plugins .182 INFO: Load plugins index .191 DEBUG: GET 200 test/api/plugins/installed | time=9ms .231 INFO: Load plugins index (done) | time=49ms .232 DEBUG: Download plugin 'checkstyle' to '/home/git/.sonar/_tmp/fileCache11781872618657778709.tmp' .237 DEBUG: GET 200 test/api/plugins/download?plugin=checkstyle&acceptCompressions=pack200 | time=5ms .407 DEBUG: Download plugin 'cobertura' to '/home/git/.sonar/_tmp/fileCache8324797407117933830.tmp' .412 DEBUG: GET 200 test/api/plugins/download?plugin=cobertura&acceptCompressions=pack200 | time=5ms .441 DEBUG: Download plugin 'scmgit' to '/home/git/.sonar/_tmp/fileCache12342208922069793359.tmp' .446 DEBUG: GET 200 test/api/plugins/download?plugin=scmgit&acceptCompressions=pack200 | time=5ms .478 DEBUG: Download plugin 'authgithub' to '/home/git/.sonar/_tmp/fileCache17938913787270697927.tmp' .517 DEBUG: GET 200 test/api/plugins/download?plugin=authgithub&acceptCompressions=pack200 | time=38ms .521 DEBUG: Download plugin 'groovy' to '/home/git/.sonar/_tmp/fileCache1344656685416936350.tmp' .526 DEBUG: GET 200 test/api/plugins/download?plugin=groovy&acceptCompressions=pack200 | time=5ms .696 DEBUG: Download plugin 'jacoco' to '/home/git/.sonar/_tmp/fileCache6245259296101678116.tmp' .701 DEBUG: GET 200 test/api/plugins/download?plugin=jacoco&acceptCompressions=pack200 | time=5ms .702 DEBUG: Download plugin 'ldap' to '/home/git/.sonar/_tmp/fileCache13197007540718861228.tmp' .707 DEBUG: GET 200 test/api/plugins/download?plugin=ldap&acceptCompressions=pack200 | time=5ms .711 DEBUG: Download plugin 'license' to '/home/git/.sonar/_tmp/fileCache7866821207516757955.tmp' .715 DEBUG: GET 200 test/api/plugins/download?plugin=license&acceptCompressions=pack200 | time=4ms .716 DEBUG: Download plugin 'abap' to '/home/git/.sonar/_tmp/fileCache17244528725458905904.tmp' .720 DEBUG: GET 200 test/api/plugins/download?plugin=abap&acceptCompressions=pack200 | time=4ms .747 DEBUG: Download plugin 'sonarapex' to '/home/git/.sonar/_tmp/fileCache6897602918384311873.tmp' .776 DEBUG: GET 200 test/api/plugins/download?plugin=sonarapex&acceptCompressions=pack200 | time=29ms .837 DEBUG: Download plugin 'csharp' to '/home/git/.sonar/_tmp/fileCache1395814516449025885.tmp' .842 DEBUG: GET 200 test/api/plugins/download?plugin=csharp&acceptCompressions=pack200 | time=5ms .887 DEBUG: Download plugin 'cpp' to '/home/git/.sonar/_tmp/fileCache2196650965137547104.tmp' .916 DEBUG: GET 200 test/api/plugins/download?plugin=cpp&acceptCompressions=pack200 | time=29ms .176 DEBUG: Download plugin 'cobol' to '/home/git/.sonar/_tmp/fileCache7442926184452165365.tmp' .182 DEBUG: GET 200 test/api/plugins/download?plugin=cobol&acceptCompressions=pack200 | time=5ms .226 DEBUG: Download plugin 'cssfamily' to '/home/git/.sonar/_tmp/fileCache4981945578147199978.tmp' .231 DEBUG: GET 200 test/api/plugins/download?plugin=cssfamily&acceptCompressions=pack200 | time=5ms .301 DEBUG: Download plugin 'flex' to '/home/git/.sonar/_tmp/fileCache9829896026743009969.tmp' .306 DEBUG: GET 200 test/api/plugins/download?plugin=flex&acceptCompressions=pack200 | time=5ms .323 DEBUG: Download plugin 'go' to '/home/git/.sonar/_tmp/fileCache3176707595731935443.tmp' .328 DEBUG: GET 200 test/api/plugins/download?plugin=go&acceptCompressions=pack200 | time=5ms .366 DEBUG: Download plugin 'web' to '/home/git/.sonar/_tmp/fileCache9894501323313377586.tmp' .371 DEBUG: GET 200 test/api/plugins/download?plugin=web&acceptCompressions=pack200 | time=5ms .391 DEBUG: Download plugin 'javascript' to '/home/git/.sonar/_tmp/fileCache9167691006087137913.tmp' .395 DEBUG: GET 200 test/api/plugins/download?plugin=javascript&acceptCompressions=pack200 | time=4ms .472 DEBUG: Download plugin 'java' to '/home/git/.sonar/_tmp/fileCache10769823191791236369.tmp' .477 DEBUG: GET 200 test/api/plugins/download?plugin=java&acceptCompressions=pack200 | time=5ms .568 DEBUG: Download plugin 'kotlin' to '/home/git/.sonar/_tmp/fileCache4570082045460007958.tmp' .573 DEBUG: GET 200 test/api/plugins/download?plugin=kotlin&acceptCompressions=pack200 | time=5ms .648 DEBUG: Download plugin 'php' to '/home/git/.sonar/_tmp/fileCache6948316052206463965.tmp' .660 DEBUG: GET 200 test/api/plugins/download?plugin=php&acceptCompressions=pack200 | time=12ms .712 DEBUG: Download plugin 'pli' to '/home/git/.sonar/_tmp/fileCache8411244080714866055.tmp' .717 DEBUG: GET 200 test/api/plugins/download?plugin=pli&acceptCompressions=pack200 | time=5ms .739 DEBUG: Download plugin 'plsql' to '/home/git/.sonar/_tmp/fileCache1566427368564159135.tmp' .744 DEBUG: GET 200 test/api/plugins/download?plugin=plsql&acceptCompressions=pack200 | time=5ms .772 DEBUG: Download plugin 'python' to '/home/git/.sonar/_tmp/fileCache13880823776753820337.tmp' .776 DEBUG: GET 200 test/api/plugins/download?plugin=python&acceptCompressions=pack200 | time=4ms .806 DEBUG: Download plugin 'rpg' to '/home/git/.sonar/_tmp/fileCache10857809721110111630.tmp' .810 DEBUG: GET 200 test/api/plugins/download?plugin=rpg&acceptCompressions=pack200 | time=4ms .834 DEBUG: Download plugin 'ruby' to '/home/git/.sonar/_tmp/fileCache11658394943359390171.tmp' .838 DEBUG: GET 200 test/api/plugins/download?plugin=ruby&acceptCompressions=pack200 | time=4ms 06:30:00 .937 DEBUG: Download plugin 'sonarscala' to '/home/git/.sonar/_tmp/fileCache1643442536384409931.tmp' 06:30:00 .944 DEBUG: GET 200 test/api/plugins/download?plugin=sonarscala&acceptCompressions=pack200 | time=7ms 06:30:00 06:30:00.033 DEBUG: Download plugin 'swift' to '/home/git/.sonar/_tmp/fileCache5216192032359675165.tmp' 06:30:00 06:30:00.048 DEBUG: GET 200 test/api/plugins/download?plugin=swift&acceptCompressions=pack200 | time=15ms 06:30:00 06:30:00.077 DEBUG: Download plugin 'typescript' to '/home/git/.sonar/_tmp/fileCache2848495715132413194.tmp' 06:30:00 06:30:00.082 DEBUG: GET 200 test/api/plugins/download?plugin=typescript&acceptCompressions=pack200 | time=5ms 06:30:00 06:30:00.105 DEBUG: Download plugin 'tsql' to '/home/git/.sonar/_tmp/fileCache1941286220990704645.tmp' 06:30:00 06:30:00.109 DEBUG: GET 200 test/api/plugins/download?plugin=tsql&acceptCompressions=pack200 | time=4ms 06:30:00 06:30:00.137 DEBUG: Download plugin 'vbnet' to '/home/git/.sonar/_tmp/fileCache1407817077081014549.tmp' 06:30:00 06:30:00.141 DEBUG: GET 200 test/api/plugins/download?plugin=vbnet&acceptCompressions=pack200 | time=4ms 06:30:00 06:30:00.177 DEBUG: Download plugin 'vb' to '/home/git/.sonar/_tmp/fileCache11984821800798182168.tmp' 06:30:00 06:30:00.182 DEBUG: GET 200 test/api/plugins/download?plugin=vb&acceptCompressions=pack200 | time=5ms 06:30:00 06:30:00.212 DEBUG: Download plugin 'xml' to '/home/git/.sonar/_tmp/fileCache16396760739316677505.tmp' 06:30:00 06:30:00.216 DEBUG: GET 200 test/api/plugins/download?plugin=xml&acceptCompressions=pack200 | time=4ms 06:30:00 06:30:00.241 DEBUG: Download plugin 'scmsvn' to '/home/git/.sonar/_tmp/fileCache6281693205189373788.tmp' 06:30:00 06:30:00.245 DEBUG: GET 200 test/api/plugins/download?plugin=scmsvn&acceptCompressions=pack200 | time=4ms 06:30:00 06:30:00.316 DEBUG: Download plugin 'security' to '/home/git/.sonar/_tmp/fileCache11867068198477140602.tmp' 06:30:00 06:30:00.321 DEBUG: GET 200 test/api/plugins/download?plugin=security&acceptCompressions=pack200 | time=5ms 06:30:00 06:30:00.356 DEBUG: Download plugin 'securitycsharpfrontend' to '/home/git/.sonar/_tmp/fileCache8745550157297051726.tmp' 06:30:00 06:30:00.384 DEBUG: GET 200 test/api/plugins/download?plugin=securitycsharpfrontend&acceptCompressions=pack200 | time=28ms 06:30:00 06:30:00.420 DEBUG: Download plugin 'securityjavafrontend' to '/home/git/.sonar/_tmp/fileCache14204732494468574178.tmp' 06:30:00 06:30:00.425 DEBUG: GET 200 test/api/plugins/download?plugin=securityjavafrontend&acceptCompressions=pack200 | time=5ms 06:30:00 06:30:00.445 DEBUG: Download plugin 'securityphpfrontend' to '/home/git/.sonar/_tmp/fileCache14829808745541131931.tmp' 06:30:00 06:30:00.449 DEBUG: GET 200 test/api/plugins/download?plugin=securityphpfrontend&acceptCompressions=pack200 | time=4ms 06:30:00 06:30:00.471 INFO: Load/download plugins (done) | time=2289ms 06:30:01 06:30:00.912 DEBUG: Plugins: 06:30:01 06:30:00.912 DEBUG: Cobertura 2.0 (cobertura) 06:30:01 06:30:00.912 DEBUG: SonarCSS 1.1.1.1010 (cssfamily) 06:30:01 06:30:00.912 DEBUG: Svn 1.9.0.1295 (scmsvn) 06:30:01 06:30:00.912 DEBUG: SonarPLSQL 3.4.1.2576 (plsql) 06:30:01 06:30:00.912 DEBUG: SonarScala 1.5.0.315 (sonarscala) 06:30:01 06:30:00.912 DEBUG: SonarC# 7.15.0.8572 (csharp) 06:30:01 06:30:00.912 DEBUG: Vulnerability Analysis 7.9.0.5105 (security) 06:30:01 06:30:00.912 DEBUG: SonarJava 5.13.1.18282 (java) 06:30:01 06:30:00.912 DEBUG: LDAP 2.2.0.608 (ldap) 06:30:01 06:30:00.912 DEBUG: SonarHTML 3.1.0.1615 (web) 06:30:01 06:30:00.912 DEBUG: SonarFlex 2.5.1.1831 (flex) 06:30:01 06:30:00.912 DEBUG: SonarXML 2.0.1.2020 (xml) 06:30:01 06:30:00.912 DEBUG: SonarTS 1.9.0.3766 (typescript) 06:30:01 06:30:00.912 DEBUG: Checkstyle 4.29 (checkstyle) 06:30:01 06:30:00.912 DEBUG: SonarVB 7.15.0.8572 (vbnet) 06:30:01 06:30:00.913 DEBUG: SonarSwift 4.1.0.3087 (swift) 06:30:01 06:30:00.913 DEBUG: SonarCFamily 6.3.0.11371 (cpp) 06:30:01 06:30:00.913 DEBUG: SonarPython 1.14.1.3143 (python) 06:30:01 06:30:00.913 DEBUG: GitHub Authentication for SonarQube 1.5.0.870 (authgithub) 06:30:01 06:30:00.913 DEBUG: JaCoCo 1.0.2.475 (jacoco) 06:30:01 06:30:00.913 DEBUG: SonarGo 1.1.1.2000 (go) 06:30:01 06:30:00.913 DEBUG: SonarKotlin 1.5.0.315 (kotlin) 06:30:01 06:30:00.913 DEBUG: SonarRPG 2.3.0.1187 (rpg) 06:30:01 06:30:00.913 DEBUG: SonarPLI 1.10.0.1880 (pli) 06:30:01 06:30:00.913 DEBUG: SonarTSQL 1.4.0.3334 (tsql) 06:30:01 06:30:00.913 DEBUG: SonarVB6 2.6.0.1875 (vb) 06:30:01 06:30:00.913 DEBUG: SonarApex 1.5.0.315 (sonarapex) 06:30:01 06:30:00.913 DEBUG: SonarJS 5.2.1.7778 (javascript) 06:30:01 06:30:00.913 DEBUG: SonarRuby 1.5.0.315 (ruby) 06:30:01 06:30:00.913 DEBUG: Vulnerability Rules for C# 7.9.0.5105 (securitycsharpfrontend) 06:30:01 06:30:00.913 DEBUG: Vulnerability Rules for Java 7.9.0.5105 (securityjavafrontend) 06:30:01 06:30:00.913 DEBUG: License for SonarLint 7.9.1 (license) 06:30:01 06:30:00.913 DEBUG: Groovy 1.6 (groovy) 06:30:01 06:30:00.913 DEBUG: SonarCOBOL 4.4.0.3403 (cobol) 06:30:01 06:30:00.913 DEBUG: Git 1.8.0.1574 (scmgit) 06:30:01 06:30:00.913 DEBUG: SonarPHP 3.2.0.4868 (php) 06:30:01 06:30:00.913 DEBUG: SonarABAP 3.8.0.2034 (abap) 06:30:01 06:30:00.913 DEBUG: Vulnerability Rules for PHP 7.9.0.5105 (securityphpfrontend) 06:30:01 06:30:00.950 INFO: Loaded core extensions: developer-scanner 06:30:01 06:30:00.966 DEBUG: Installed core extension: developer-scanner 06:30:01 06:30:01.428 INFO: Process project properties 06:30:01 06:30:01.434 DEBUG: Process project properties (done) | time=6ms 06:30:01 06:30:01.435 INFO: Execute project builders 06:30:01 06:30:01.435 DEBUG: Execute project builder: org.sonar.plugins.csharp.CSharpGlobalProtobufFileProcessor 06:30:01 06:30:01.437 DEBUG: Execute project builder: org.sonar.plugins.vbnet.VbNetGlobalProtobufFileProcessor 06:30:01 06:30:01.438 INFO: Execute project builders (done) | time=3ms 06:30:01 06:30:01.440 INFO: Project key: mycomponent-test 06:30:01 06:30:01.440 INFO: Base dir: /test/tes/testy/workspace/mycomponent/tests 06:30:01 06:30:01.440 INFO: Working dir: /test/tes/testy/workspace/mycomponent/tests/.scannerwork 06:30:01 06:30:01.440 DEBUG: Project global encoding: UTF-8, default locale: en_US 06:30:01 06:30:01.441 DEBUG: Creating module hierarchy 06:30:01 06:30:01.441 DEBUG: Init module 'mycomponent-test' 06:30:01 06:30:01.441 DEBUG: Base dir: /test/tes/testy/workspace/mycomponent/tests 06:30:01 06:30:01.442 DEBUG: Working dir: /test/tes/testy/workspace/mycomponent/tests/.scannerwork 06:30:01 06:30:01.442 DEBUG: Module global encoding: UTF-8, default locale: en_US 06:30:01 06:30:01.450 INFO: Load project settings for component key: 'mycomponent-test' 06:30:01 06:30:01.482 DEBUG: GET 200 test/api/settings/values.protobuf?component=mycomponent-test | time=32ms 06:30:01 06:30:01.484 INFO: Load project settings for component key: 'mycomponent-test' (done) | time=34ms 06:30:01 06:30:01.490 INFO: Load project branches 06:30:01 06:30:01.502 DEBUG: GET 200 test/api/project_branches/list?project=mycomponent-test | time=12ms 06:30:01 06:30:01.506 INFO: Load project branches (done) | time=16ms 06:30:01 06:30:01.507 INFO: Load project pull requests 06:30:01 06:30:01.516 DEBUG: GET 200 test/api/project_pull_requests/list?project=mycomponent-test | time=8ms 06:30:01 06:30:01.519 INFO: Load project pull requests (done) | time=12ms 06:30:01 06:30:01.519 INFO: Load branch configuration 06:30:01 06:30:01.520 INFO: Load branch configuration (done) | time=1ms 06:30:01 06:30:01.541 DEBUG: Available languages: 06:30:01 06:30:01.541 DEBUG: CSS => "css" 06:30:01 06:30:01.541 DEBUG: PL/SQL => "plsql" 06:30:01 06:30:01.541 DEBUG: Scala => "scala" 06:30:01 06:30:01.541 DEBUG: C# => "cs" 06:30:01 06:30:01.541 DEBUG: Java => "java" 06:30:01 06:30:01.541 DEBUG: HTML => "web" 06:30:01 06:30:01.541 DEBUG: JSP => "jsp" 06:30:01 06:30:01.541 DEBUG: Flex => "flex" 06:30:01 06:30:01.541 DEBUG: XML => "xml" 06:30:01 06:30:01.541 DEBUG: TypeScript => "ts" 06:30:01 06:30:01.541 DEBUG: VB.NET => "vbnet" 06:30:01 06:30:01.541 DEBUG: Swift => "swift" 06:30:01 06:30:01.541 DEBUG: C => "c" 06:30:01 06:30:01.542 DEBUG: C++ => "cpp" 06:30:01 06:30:01.542 DEBUG: Objective-C => "objc" 06:30:01 06:30:01.542 DEBUG: Python => "py" 06:30:01 06:30:01.542 DEBUG: Go => "go" 06:30:01 06:30:01.542 DEBUG: Kotlin => "kotlin" 06:30:01 06:30:01.542 DEBUG: RPG => "rpg" 06:30:01 06:30:01.542 DEBUG: PL/I => "pli" 06:30:01 06:30:01.542 DEBUG: T-SQL => "tsql" 06:30:01 06:30:01.542 DEBUG: Vb => "vb" 06:30:01 06:30:01.542 DEBUG: Apex => "apex" 06:30:01 06:30:01.542 DEBUG: JavaScript => "js" 06:30:01 06:30:01.542 DEBUG: Ruby => "ruby" 06:30:01 06:30:01.542 DEBUG: Groovy => "grvy" 06:30:01 06:30:01.542 DEBUG: COBOL => "cobol" 06:30:01 06:30:01.542 DEBUG: PHP => "php" 06:30:01 06:30:01.542 DEBUG: * ABAP => "abap" 06:30:01 06:30:01.545 INFO: Load quality profiles 06:30:01 06:30:01.623 DEBUG: GET 200 test/api/qualityprofiles/search.protobuf?projectKey=mycomponent-test | time=77ms 06:30:01 06:30:01.638 INFO: Load quality profiles (done) | time=93ms 06:30:01 06:30:01.642 INFO: Detected Jenkins 06:30:01 06:30:01.644 INFO: Load active rules

06:30:02 06:30:02.489 INFO: Load active rules (done) | time=845ms 06:30:02 06:30:02.557 DEBUG: Declared extensions of language CSS were converted to sonar.lang.patterns.css : /*.css,*/.less,/*.scss 06:30:02 06:30:02.557 DEBUG: Declared extensions of language PL/SQL were converted to sonar.lang.patterns.plsql : /*.sql,*/.pks,/*.pkb 06:30:02 06:30:02.557 DEBUG: Declared extensions of language Scala were converted to sonar.lang.patterns.scala : /*.scala 06:30:02 06:30:02.558 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : */.cs 06:30:02 06:30:02.558 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : /*.java,/*.jav 06:30:02 06:30:02.558 DEBUG: Declared extensions of language HTML were converted to sonar.lang.patterns.web : */.html,/*.xhtml,/*.cshtml,*/.vbhtml,/*.aspx,/*.ascx,*/.rhtml,/*.erb,/*.shtm,*/.shtml 06:30:02 06:30:02.558 DEBUG: Declared extensions of language JSP were converted to sonar.lang.patterns.jsp : /*.jsp,/*.jspf,*/.jspx 06:30:02 06:30:02.558 DEBUG: Declared extensions of language Flex were converted to sonar.lang.patterns.flex : /*.as 06:30:02 06:30:02.558 DEBUG: Declared extensions of language XML were converted to sonar.lang.patterns.xml : /*.xml,*/.xsd,/*.xsl 06:30:02 06:30:02.558 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : /*.ts,*/.tsx 06:30:02 06:30:02.559 DEBUG: Declared extensions of language VB.NET were converted to sonar.lang.patterns.vbnet : /*.vb 06:30:02 06:30:02.559 DEBUG: Declared extensions of language Swift were converted to sonar.lang.patterns.swift : /*.swift 06:30:02 06:30:02.559 DEBUG: Declared extensions of language C were converted to sonar.lang.patterns.c : */.c,/*.h 06:30:02 06:30:02.559 DEBUG: Declared extensions of language C++ were converted to sonar.lang.patterns.cpp : /*.cc,*/.cpp,/*.cxx,/*.c++,*/.hh,/*.hpp,/*.hxx,*/.h++,/*.ipp 06:30:02 06:30:02.559 DEBUG: Declared extensions of language Objective-C were converted to sonar.lang.patterns.objc : /*.m 06:30:02 06:30:02.559 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : */.py 06:30:02 06:30:02.559 DEBUG: Declared extensions of language Go were converted to sonar.lang.patterns.go : /*.go 06:30:02 06:30:02.559 DEBUG: Declared extensions of language Kotlin were converted to sonar.lang.patterns.kotlin : /*.kt 06:30:02 06:30:02.560 DEBUG: Declared extensions of language RPG were converted to sonar.lang.patterns.rpg : */.rpg,/*.rpgle,/*.rpg,*/.rpgle 06:30:02 06:30:02.560 DEBUG: Declared extensions of language PL/I were converted to sonar.lang.patterns.pli : /*.pli 06:30:02 06:30:02.560 DEBUG: Declared extensions of language T-SQL were converted to sonar.lang.patterns.tsql : /*.tsql 06:30:02 06:30:02.560 DEBUG: Declared extensions of language Vb were converted to sonar.lang.patterns.vb : */.vb,/*.bas,/*.frm,*/.ctl,/*.vb,/*.bas,*/.frm,/*.ctl 06:30:02 06:30:02.560 DEBUG: Declared extensions of language Apex were converted to sonar.lang.patterns.apex : /*.cls,*/.trigger 06:30:02 06:30:02.560 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : /*.js,/*.jsx,*/.vue 06:30:02 06:30:02.560 DEBUG: Declared extensions of language Ruby were converted to sonar.lang.patterns.ruby : /*.rb 06:30:02 06:30:02.560 DEBUG: Declared extensions of language Groovy were converted to sonar.lang.patterns.grvy : /*.groovy 06:30:02 06:30:02.560 DEBUG: Declared extensions of language COBOL were converted to sonar.lang.patterns.cobol : 06:30:02 06:30:02.561 DEBUG: Declared extensions of language PHP were converted to sonar.lang.patterns.php : */.php,/*.php3,/*.php4,*/.php5,/*.phtml,/*.inc 06:30:02 06:30:02.561 DEBUG: Declared extensions of language ABAP were converted to sonar.lang.patterns.abap : */.abap,/*.ab4,/*.flow,*/.asprog 06:30:02 06:30:02.562 DEBUG: Will ignore generated code 06:30:02 06:30:02.563 DEBUG: Will ignore generated code 06:30:02 06:30:02.564 INFO: Indexing files... 06:30:02 06:30:02.565 INFO: Project configuration: 06:30:02 06:30:02.565 INFO: Excluded sources: /database//., /models//., /exceptions//., /**/init.py 06:30:02 06:30:02.587 DEBUG: readpipe [git, --version],/usr/bin 06:30:02 06:30:02.601 DEBUG: readpipe may return 'git version 1.8.3.1' 06:30:02 06:30:02.601 DEBUG: remaining output: 06:30:02 06:30:02 06:30:02.602 DEBUG: readpipe [git, config, --system, --edit],/usr/bin 06:30:02 06:30:02.604 DEBUG: readpipe may return '/etc/gitconfig' 06:30:02 06:30:02.604 DEBUG: remaining output: 06:30:02

06:30:03 06:30:02.718 INFO: ------------- Run sensors on module mycomponent-test 06:30:03 06:30:02.855 INFO: Load metrics repository 06:30:03 06:30:02.863 DEBUG: GET 200 test/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1 | time=8ms 06:30:03 06:30:02.869 INFO: Load metrics repository (done) | time=14ms 06:30:04 WARNING: An illegal reflective access operation has occurred 06:30:04 WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/home/git/.sonar/cache/a89f1943fc75b65becd9fb4ecab8d913/sonar-tsql-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) 06:30:04 WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1 06:30:04 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations 06:30:04 WARNING: All illegal access operations will be denied in a future release

06:30:04.685 DEBUG: Sensors : JavaXmlSensor -> HTML -> Python Squid Sensor -> Cobertura Sensor for Python coverage -> PythonXUnitSensor -> PylintSensor -> JaCoCo XML Report Importer -> JavaSecuritySensor -> CSharpSecuritySensor -> PhpSecuritySensor 06:30:04.686 INFO: Sensor JavaXmlSensor [java] 06:30:04.687 INFO: Sensor JavaXmlSensor [java] (done) | time=1ms 06:30:04.687 INFO: Sensor HTML [web] 06:30:04.696 INFO: Sensor HTML [web] (done) | time=9ms 06:30:04.696 INFO: Sensor Python Squid Sensor [python] 06:30:04.710 INFO: Load project repositories 06:30:04.720 DEBUG: GET 200 test/batch/project.protobuf?key=mycomponent-test | time=10ms 06:30:04.726 INFO: Load project repositories (done) | time=16ms 06:30:04.726 DEBUG: 'tests/tests.py' generated metadata with charset 'UTF-8' .500 INFO: Sensor Python Squid Sensor [python] (done) | time=804ms .500 INFO: Sensor Cobertura Sensor for Python coverage [python] .501 DEBUG: Using pattern './mycomponent-test/coverage.xml' to find reports .509 INFO: Python test coverage .511 INFO: Parsing report '/test/tes/testy/workspace/test-component/./test/coverage.xml' .529 INFO: ------------------------------------------------------------------------ .529 INFO: EXECUTION FAILURE .529 INFO: ------------------------------------------------------------------------ .529 INFO: Total time: 9.166s .608 INFO: Final Memory: 31M/115M .608 INFO: ------------------------------------------------------------------------ .608 ERROR: Error during SonarQube Scanner execution java.lang.IllegalStateException: Line 534 is out of range in the file test/tests.py (lines: 421) at org.sonar.api.internal.google.common.base.Preconditions.checkState(Preconditions.java:197) at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.validateLine(DefaultCoverage.java:93) at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.lineHits(DefaultCoverage.java:81) at org.sonar.plugins.python.coverage.CoberturaParser.collectFileData(CoberturaParser.java:147) at org.sonar.plugins.python.coverage.CoberturaParser.collectFileMeasures(CoberturaParser.java:102) at org.sonar.plugins.python.coverage.CoberturaParser.lambda$parseReport$0(CoberturaParser.java:65) at org.sonar.plugins.python.parser.StaxParser.parse(StaxParser.java:62) at org.sonar.plugins.python.parser.StaxParser.parse(StaxParser.java:53) at org.sonar.plugins.python.coverage.CoberturaParser.parseReport(CoberturaParser.java:69) at org.sonar.plugins.python.coverage.PythonCoverageSensor.parseReport(PythonCoverageSensor.java:137) at org.sonar.plugins.python.coverage.PythonCoverageSensor.execute(PythonCoverageSensor.java:90) at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85) at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59) at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138) at org.sonarsource.scanner.cli.Main.execute(Main.java:112) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61) .609 ERROR: .609 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging. 06:30:09 ❌ Exception in stage: run sonarqube scan 06:30:09 script returned exit code 1

To Reproduce How can we reproduce the problem? Please be specific.

  1. What version of Python are you using? 3.8
  2. What version of coverage.py are you using? coverage 5.0.3
  3. What versions of what packages do you have installed?

pip freeze

ansible==2.9.2 Babel==0.9.6 backports.ssl-match-hostname==3.5.0.1 boto3==1.10.41 botocore==1.13.41 cffi==1.6.0 chardet==2.2.1 cryptography==1.7.2 docutils==0.15.2 enum34==1.0.4 futures==3.3.0 httplib2==0.9.2 idna==2.4 iniparse==0.4 ipaddress==1.0.16 javapackages==1.0.0 Jinja2==2.7.2 jmespath==0.9.4 kitchen==1.1.1 lxml==3.2.1 MarkupSafe==0.11 paramiko==2.1.1 ply==3.4 pyasn1==0.1.9 pycparser==2.14 pycurl==7.19.0 pygobject==3.22.0 pygpgme==0.3 pyliblzma==0.5.3 pyparsing==1.5.6 python-dateutil==2.8.0 pyxattr==0.5.1 PyYAML==3.10 s3transfer==0.2.1 six==1.13.0 urlgrabber==3.10 urllib3==1.25.7 yum-axelget==1.0.4 yum-metadata-parser==1.1.4

pip3 freeze

boto3==1.10.41 botocore==1.13.41 docutils==0.15.2 jmespath==0.9.4 python-dateutil==2.8.0 s3transfer==0.2.1 six==1.13.0 urllib3==1.25.7

  1. What code are you running? can't provide
  2. What commands did you run? coverage xml -i -o project/coverage.xml

Expected behavior Expected to generate coverage.xml with exact number of lines same as source file.

nedbat commented 4 years ago

It's a bit hard to follow what is going on here. The pip freeze output doesn't mention coverage, for example. One possibility is that you have .pyc files generated by Python 3.8, but are using Python 3.5 to run the report. Could that be happening?

nedbat commented 3 years ago

If you come back to this and have more information, feel free to re-open it.

galexandre commented 3 years ago

Hi all,

I have exactly the same issue. I have a pipeline which execute the following lines:

coverage erase
coverage run -m nose
coverage report
coverage xml

On my computer the generated coverage.xml is good - no link to lines that do not exist. However, on my pipeline, the generated coverage.xml file point to a line that does not exist. I tried to resolve that with the .coveragerc file, but no luck so far. As this is something I can't reproduce on my computer, it is very hard for me to debug. Do you have any pointer to help me to resolve this issue?

galexandre commented 3 years ago

Solved! Installing the latest version available (5.5) resolved my issue.