Issue in file scope excluded still showing. Counted also in number of lines

Hi.
No matter what I exclude in the scope setting page (note all the tentatives to remove the dev folder and subcontent and notably the autopep8 file):

The number of line metric is still counting dev/lint/autopep8.py file and it list the issues in this file as well.

Hello @crazyhouse33,

Just to be sure: your dev folder exists at the root of your project? Otherwise you will have to specify the full path to the dev folder.

Tom

Yes, I would send screenshot of other sonarcloud pages but I am limited to one image by post.
dev and test are both in root of the project.

Actually, I found something unexpected on the code tab.

I can see a dev/lint directory at the root of the project(again sorry I cannot send screenshot.)

This is weird, the expected behavior would be to have a dev link showing up, and then when I would click on it the lint directory should be showing. Not directely dev/lint.

My project tree (sorry again for no screenshot):
dev:
drwxr-xr-x 2 jpepito jpepito 4096 mars 4 11:16 .githooks
drwxr-xr-x 2 jpepito jpepito 4096 mars 1 16:50 lint
-rwxr-xr-x 1 jpepito jpepito 279 mars 8 16:07 modifiedPre-commit.bash
-rwxr-xr-x 1 jpepito jpepito 54 mars 8 16:08 pre-push.bash
drwxr-xr-x 3 jpepito jpepito 4096 mars 2 20:36 .pytest_cache
-rw-r–r-- 1 jpepito jpepito 424 mars 1 17:44 readme.md

As you see there is no weird character neither in the dev directory name neither in the lint one.

Hello @crazyhouse33,

That’s interesting. Could you share the Scanner Context of the most recent Background Task?
You can find that by navigating to Your Project > Administration > Background Tasks and clicking on the wheel next to the most recent background task.

Thanks,
Tom

Hey Tom, thanks for the help.

Here is the copy past:

SonarCloud plugins:
  - SonarCSS 1.2.0.1325 (cssfamily)
  - SonarPLSQL 3.4.1.2576 (plsql)
  - SonarScala 1.7.0.883 (sonarscala)
  - SonarC# 8.5.0.15942 (csharp)
  - Vulnerability Analysis 8.2.1.1259 (security)
  - SonarJava 6.2.0.21135 (java)
  - SonarHTML 3.2.0.2082 (web)
  - SonarFlex 2.5.1.1831 (flex)
  - SonarXML 2.0.1.2020 (xml)
  - SonarTS 2.1.0.4359 (typescript)
  - SonarVB 8.5.0.15942 (vbnet)
  - SonarSwift 4.2.2.77 (swift)
  - SonarCFamily 6.7.0.15300 (cpp)
  - SonarPython 2.7.0.5975 (python)
  - JaCoCo 1.0.2.475 (jacoco)
  - Mercurial 1.1.2 (scmmercurial)
  - SonarGo 1.7.0.883 (go)
  - SonarKotlin 1.7.0.883 (kotlin)
  - SonarTSQL 1.4.0.3334 (tsql)
  - SonarApex 1.7.0.883 (sonarapex)
  - SonarJS 6.2.0.12043 (javascript)
  - SonarRuby 1.7.0.883 (ruby)
  - Vulnerability Rules for C# 8.2.1.1259 (securitycsharpfrontend)
  - Vulnerability Rules for Java 8.2.1.1259 (securityjavafrontend)
  - License for SonarLint 8.0.0.6109 (license)
  - SonarCOBOL 4.4.0.3403 (cobol)
  - Vulnerability Rules for Python 8.2.1.1259 (securitypythonfrontend)
  - Git 1.11.0.11 (scmgit)
  - SonarPHP 3.3.0.5166 (php)
  - SonarABAP 3.8.0.2034 (abap)
  - Vulnerability Rules for PHP 8.2.1.1259 (securityphpfrontend)
Global server settings:
  - email.from=noreply@sonarcloud.io
  - email.fromName=SonarCloud
  - email.prefix=[SonarCloud]
  - sonar.auth.bitbucket.enabled=true
  - sonar.auth.microsoft.enabled=true
  - sonar.core.id=1BD809FA-AWHW8ct9-T_TB3XqouNu
  - sonar.core.serverBaseURL=https://sonarcloud.io
  - sonar.core.startTime=2020-03-24T13:59:12+0100
  - sonar.dbcleaner.weeksBeforeDeletingAllSnapshots=480
  - sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByMonth=4
  - sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek=1
  - sonar.java.collectAnalysisErrors=true
  - sonar.leak.period=30
  - sonar.lf.enableGravatar=true
  - sonar.lf.logoWidthPx=105
  - sonar.organizations.anyoneCanCreate=true
  - sonar.organizations.createPersonalOrg=true
  - sonar.plsql.file.suffixes=sql,tab,pkb
  - sonar.tsql.file.suffixes=.tsql
Project server settings:
  - sonar.autoscan.enabled=true
  - sonar.coverage.exclusions=**
  - sonar.cpd.exclusions=test/**/*,dev/**/*,dev/*,test/*,dev,test,dev/lint/autopep8.py
  - sonar.exclusions=dev/**/*,test/**/*,dev,test,test/*,dev/*,dev/lint,dev/lint/*,dev/lint/autopep8.py
  - sonar.test.inclusions=test/**/*
Project scanner properties:
  - sonar.analysisUuid=AXENcuJXRrNPUlM08_mg
  - sonar.coverage.exclusions=**/*
  - sonar.exclusions=**/*.cs,**/*.c,**/*.h,**/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp,**/*.m,**/*.java,**/*.jav,**/*sql,**/*tab,**/*pkb,**/*.vb
  - sonar.host.url=https://sonarcloud.io/
  - sonar.java.binaries=/tmp/clone4731628577401108855
  - sonar.login=******
  - sonar.organization=crazyhouse33
  - sonar.password=******
  - sonar.projectBaseDir=/tmp/clone4731628577401108855
  - sonar.projectKey=crazyhouse33_templateSwitcher
  - sonar.scanner.app=ScannerCli
  - sonar.scanner.appVersion=3.2.0.1227
  - sonar.sourceEncoding=UTF-8
  - sonar.sources=.
  - sonar.test.exclusions=**/*.cs,**/*.c,**/*.h,**/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp,**/*.m,**/*.java,**/*.jav,**/*sql,**/*tab,**/*pkb,**/*.vb
  - sonar.working.directory=/tmp/clone4731628577401108855/.scannerwork

Thanks @crazyhouse33,

Could you try to unset the duplication exclusions? If those files are excluded from analysis (sonar.exclusions ) then we will not try to do duplication detection on them, so no need to set those.

When you launch the analysis without those properties set, could you then share the background task ID of the associated background task? This can also be found under Your Project > Administration > Background Tasks.

Thanks,
Tom

Hey Tom, I did as you told, and I have the same symtoms. (weird direct dev/lint in code section, issue about autopep8, 2k lines of autopep8 still counting)

Here is the result

 SonarCloud plugins:
  - SonarCSS 1.2.0.1325 (cssfamily)
  - SonarPLSQL 3.4.1.2576 (plsql)
  - SonarScala 1.7.0.883 (sonarscala)
  - SonarC# 8.5.0.15942 (csharp)
  - Vulnerability Analysis 8.2.1.1259 (security)
  - SonarJava 6.2.0.21135 (java)
  - SonarHTML 3.2.0.2082 (web)
  - SonarFlex 2.5.1.1831 (flex)
  - SonarXML 2.0.1.2020 (xml)
  - SonarTS 2.1.0.4359 (typescript)
  - SonarVB 8.5.0.15942 (vbnet)
  - SonarSwift 4.2.2.77 (swift)
  - SonarCFamily 6.7.0.15300 (cpp)
  - SonarPython 2.8.0.6204 (python)
  - JaCoCo 1.0.2.475 (jacoco)
  - Mercurial 1.1.2 (scmmercurial)
  - SonarGo 1.7.0.883 (go)
  - SonarKotlin 1.7.0.883 (kotlin)
  - SonarTSQL 1.4.0.3334 (tsql)
  - SonarApex 1.7.0.883 (sonarapex)
  - SonarJS 6.2.0.12043 (javascript)
  - SonarRuby 1.7.0.883 (ruby)
  - Vulnerability Rules for C# 8.2.1.1259 (securitycsharpfrontend)
  - Vulnerability Rules for Java 8.2.1.1259 (securityjavafrontend)
  - License for SonarLint 8.0.0.6188 (license)
  - SonarCOBOL 4.4.0.3403 (cobol)
  - Vulnerability Rules for Python 8.2.1.1259 (securitypythonfrontend)
  - Git 1.11.0.11 (scmgit)
  - SonarPHP 3.3.0.5166 (php)
  - SonarABAP 3.8.0.2034 (abap)
  - Vulnerability Rules for PHP 8.2.1.1259 (securityphpfrontend)
Global server settings:
  - email.from=noreply@sonarcloud.io
  - email.fromName=SonarCloud
  - email.prefix=[SonarCloud]
  - sonar.auth.bitbucket.enabled=true
  - sonar.auth.microsoft.enabled=true
  - sonar.core.id=1BD809FA-AWHW8ct9-T_TB3XqouNu
  - sonar.core.serverBaseURL=https://sonarcloud.io
  - sonar.core.startTime=2020-03-27T09:21:58+0100
  - sonar.dbcleaner.weeksBeforeDeletingAllSnapshots=480
  - sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByMonth=4
  - sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek=1
  - sonar.java.collectAnalysisErrors=true
  - sonar.leak.period=30
  - sonar.lf.enableGravatar=true
  - sonar.lf.logoWidthPx=105
  - sonar.organizations.anyoneCanCreate=true
  - sonar.organizations.createPersonalOrg=true
  - sonar.plsql.file.suffixes=sql,tab,pkb
  - sonar.tsql.file.suffixes=.tsql
Project server settings:
  - sonar.autoscan.enabled=true
  - sonar.coverage.exclusions=**
  - sonar.exclusions=dev/**/*,test/**/*,dev,test,test/*,dev/*,dev/lint,dev/lint/*,dev/lint/autopep8.py,dev/**,test/**
  - sonar.test.inclusions=test/**/*
Project scanner properties:
  - sonar.analysisUuid=AXEbuTDt-msM19ZpIoGc
  - sonar.coverage.exclusions=**/*
  - sonar.exclusions=**/*.cs,**/*.c,**/*.h,**/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp,**/*.m,**/*.java,**/*.jav,**/*sql,**/*tab,**/*pkb,**/*.vb
  - sonar.host.url=https://sonarcloud.io/
  - sonar.java.binaries=/tmp/clone7140316994654858768
  - sonar.login=******
  - sonar.organization=crazyhouse33
  - sonar.password=******
  - sonar.projectBaseDir=/tmp/clone7140316994654858768
  - sonar.projectKey=crazyhouse33_templateSwitcher
  - sonar.scanner.app=ScannerCli
  - sonar.scanner.appVersion=3.2.0.1227
  - sonar.sourceEncoding=UTF-8
  - sonar.sources=.
  - sonar.test.exclusions=**/*.cs,**/*.c,**/*.h,**/*.cc,**/*.cpp,**/*.cxx,**/*.c++,**/*.hh,**/*.hpp,**/*.hxx,**/*.h++,**/*.ipp,**/*.m,**/*.java,**/*.jav,**/*sql,**/*tab,**/*pkb,**/*.vb
  - sonar.working.directory=/tmp/clone7140316994654858768/.scannerwork

Hello @crazyhouse33,

Thanks for your help, this is obviously not the expected behaviour and we are currently looking it.
We’ll keep you updated.

Thanks,
Tom

Hi @crazyhouse33,

I’m investigating if this is indeed a bug, or if there is some way to configure this exclusion correctly using the UI.

For the time being, a workaround is to configure exclusions in a .sonarcloud.properties file like this, committed in the project root:

sonar.exclusions = **/autopep8.py

To exclude multiple patterns, separate them by commas.

I’ll come back to this thread when my investigation is concluded with a better solution or a bug ticket to track.

Hi Janos. I would rather avoid this solution. I really like the idea to configure everything on your API rather on adding files to my projects. You should not underestimate the importance of this feature. Anyway thanks for the work. I will keep an eye on the thread :slight_smile:

I confirm, currently it’s not possible to set this property using the UI.

I created a ticket to track the issue: SCCOMM-24

@crazyhouse33 This has now been fixed, the exclusions set in the UI are now taken into account.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.