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

Cannot find reports with relative Ant globbing #775

Closed
mjdetullio opened this issue Feb 11, 2016 · 3 comments
Closed

Cannot find reports with relative Ant globbing #775

mjdetullio opened this issue Feb 11, 2016 · 3 comments
Labels
Milestone

Comments

@mjdetullio
Copy link
Contributor

Environment:

  • SQ 5.3
  • 2ba787e (latest from master at time of writing)
  • Multi-module project

This multi-module project is analyzed using the SQ Gradle Scanner. When all said and done, the settings end up looking something like this:

sonar.modules=module1,module2
...
module2.sonar.sources=dir1,dir2,dir3,dir4
module2.sonar.exclusions=**/build/**,**/cppcheck.xml
module2.sonar.cxx.cppcheck.reportPath=**/cppcheck.xml

The reports most certainly exist in the tree (and they have correct ownership and 0644 perms):

$ find . -name cppcheck.xml
./module2/dir1/build/cppcheck.xml
./module2/dir2/cppcheck.xml
./module2/dir3/build/cppcheck.xml
./module2/dir4/build/cppcheck.xml

But here's what I get in the analysis:

-------------  Scan module2
Base dir: /path/to/project/module2
Working dir: /path/to/project/build/sonar/com.mycompany.project_module2
Source paths: dir1, dir2, dir3, dir4
Source encoding: ISO-8859-1, default locale: en_US
Index files
Excluded sources: 
  */build/**
  **/cppcheck.xml
82 files indexed
...
omitted for brevity
...
Sensor CxxCppCheckSensor
Using pattern '**/cppcheck.xml' to find reports
Unprocessed root directory '/path/to/project/module2'
Unprocessed report file '**/cppcheck.xml'
Processed root directory '/path/to/project/module2'
Processed report file '**/cppcheck.xml'
Cannot find a report for 'sonar.cxx.cppcheck.reportPath=**/cppcheck.xml'
Sensor CxxCppCheckSensor (done) | time=29ms

As you can see, the property makes its way to the sensor correctly but something goes wrong when actually searching for the files. There are no exceptions when walking the tree. I don't know exactly where the problem in the code is without attaching a debugger, but it's within this stack:

public static void GetReportForBaseDirAndPattern(String baseDirPath, String reportPath, List<File> reports) {
with CxxFileFinder.FindFiles turning up an empty Collection.

@jmecosta
Copy link
Member

Hi

This has been heavily refactored in this version so there might be
something still not working. Could you run with debug info on so we can
check what the lookup printing looks like.

On Thu, 11 Feb 2016 04:53 Matthew DeTullio [email protected] wrote:

Environment:

  • SQ 5.3
  • 2ba787e
    2ba787e
    (latest from master at time of writing)
  • Multi-module project

This multi-module project is analyzed using the SQ Gradle Scanner. When
all said and done, the settings end up looking something like this:

sonar.modules=module1,module2
...
module2.sonar.sources=dir1,dir2,dir3,dir4
module2.sonar.exclusions=/build/,/cppcheck.xml
module2.sonar.cxx.cppcheck.reportPath=
/cppcheck.xml

The reports most certainly exist in the tree (and they have correct
ownership and 0644 perms):

$ find . -name cppcheck.xml
./module2/dir1/build/cppcheck.xml
./module2/dir2/cppcheck.xml
./module2/dir3/build/cppcheck.xml
./module2/dir4/build/cppcheck.xml

But here's what I get in the analysis:

------------- Scan module2
Base dir: /path/to/project/module2
Working dir: /path/to/project/build/sonar/com.mycompany.project_module2
Source paths: dir1, dir2, dir3, dir4
Source encoding: ISO-8859-1, default locale: en_US
Index files
Excluded sources:
/build/*
/cppcheck.xml
82 files indexed
...
omitted for brevity
...
Sensor CxxCppCheckSensor
Using pattern '
/cppcheck.xml' to find reports
Unprocessed root directory '/path/to/project/module2'
Unprocessed report file '/cppcheck.xml'
Processed root directory '/path/to/project/module2'
Processed report file '
/cppcheck.xml'
Cannot find a report for 'sonar.cxx.cppcheck.reportPath=**/cppcheck.xml'
Sensor CxxCppCheckSensor (done) | time=29ms

As you can see, the property makes its way to the sensor correctly but
something goes wrong when actually searching for the files. There are no
exceptions when walking the tree. I don't know exactly where the problem in
the code is without attaching a debugger, but it's within this stack:

public static void GetReportForBaseDirAndPattern(String baseDirPath, String reportPath, List<File> reports) {

with CxxFileFinder.FindFiles turning up an empty Collection.


Reply to this email directly or view it on GitHub
#775.

@mjdetullio
Copy link
Contributor Author

The provided logs are the extent of the debug logs for the sensor.
On Feb 11, 2016 2:11 AM, "Jorge Costa" [email protected] wrote:

Hi

This has been heavily refactored in this version so there might be
something still not working. Could you run with debug info on so we can
check what the lookup printing looks like.

On Thu, 11 Feb 2016 04:53 Matthew DeTullio [email protected]
wrote:

Environment:

(latest from master at time of writing)

  • Multi-module project

This multi-module project is analyzed using the SQ Gradle Scanner. When
all said and done, the settings end up looking something like this:

sonar.modules=module1,module2
...
module2.sonar.sources=dir1,dir2,dir3,dir4
module2.sonar.exclusions=/build/,/cppcheck.xml
module2.sonar.cxx.cppcheck.reportPath=
/cppcheck.xml

The reports most certainly exist in the tree (and they have correct
ownership and 0644 perms):

$ find . -name cppcheck.xml
./module2/dir1/build/cppcheck.xml
./module2/dir2/cppcheck.xml
./module2/dir3/build/cppcheck.xml
./module2/dir4/build/cppcheck.xml

But here's what I get in the analysis:

------------- Scan module2
Base dir: /path/to/project/module2
Working dir: /path/to/project/build/sonar/com.mycompany.project_module2
Source paths: dir1, dir2, dir3, dir4
Source encoding: ISO-8859-1, default locale: en_US
Index files
Excluded sources:
/build/*
/cppcheck.xml
82 files indexed
...
omitted for brevity
...
Sensor CxxCppCheckSensor
Using pattern '
/cppcheck.xml' to find reports
Unprocessed root directory '/path/to/project/module2'
Unprocessed report file '/cppcheck.xml'
Processed root directory '/path/to/project/module2'
Processed report file '
/cppcheck.xml'
Cannot find a report for 'sonar.cxx.cppcheck.reportPath=**/cppcheck.xml'
Sensor CxxCppCheckSensor (done) | time=29ms

As you can see, the property makes its way to the sensor correctly but
something goes wrong when actually searching for the files. There are no
exceptions when walking the tree. I don't know exactly where the problem
in
the code is without attaching a debugger, but it's within this stack:

public static void GetReportForBaseDirAndPattern(String baseDirPath, String reportPath, List<File> reports) {

with CxxFileFinder.FindFiles turning up an empty Collection.


Reply to this email directly or view it on GitHub
#775.


Reply to this email directly or view it on GitHub
#775 (comment)
.

@jmecosta
Copy link
Member

Ok, This should be supported indeed, ** turns the scanner into a recursive scanner so it should have found the reports. We need to check the it test again

@mjdetullio mjdetullio changed the title Cannot find Cppcheck reports (multi-module project, Ant wildcard) Cannot find reports with Ant globbing Feb 13, 2016
@mjdetullio mjdetullio changed the title Cannot find reports with Ant globbing Cannot find reports with relative Ant globbing Feb 13, 2016
@guwirth guwirth added the bug label Feb 14, 2016
@guwirth guwirth added this to the M 0.9.5 milestone Feb 14, 2016
guwirth added a commit that referenced this issue Feb 15, 2016
Fix #775: Cannot find reports with relative Ant globbing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants