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

sonar.cxx.file.suffixes not working in the UI #2136

Closed
lg2de opened this issue May 4, 2021 · 10 comments · Fixed by #2144
Closed

sonar.cxx.file.suffixes not working in the UI #2136

lg2de opened this issue May 4, 2021 · 10 comments · Fixed by #2144
Labels
Milestone

Comments

@lg2de
Copy link

lg2de commented May 4, 2021

Describe the bug
I've updated my test system to V2 of this plugin to test whether #2121 fixes #2118.
I've updated configuration according to the wiki instructions.

The plugin does not process the input: "'CXX Cppcheck report import' skipped because there is no related file in current project"

Log extries
cppcheck execution:

[...]
Cppcheck 2.4.1
[...]
## analyzing ***.sln into C:\build\_work\105\TestResults\88484.cppcheck.***.sln.xml...
[...]

final analyzer step filtered by "cppcheck":

[...]
12:45:41.203  Dumping content of sonar-project.properties
------------------------------------------------------------------------
[...]
sonar.cxx.cppcheck.reportPath=C:\\build\\_work\\105\\TestResults\\88484.cppcheck**.xml
sonar.cxx.cppcheck.reportPaths=C:\\build\\_work\\105\\TestResults\\88484.cppcheck**.xml
[...]
12:46:07.592 DEBUG: 'CXX Cppcheck report import' skipped because there is no related file in current project
[...]

filtered by "cxx":

[...]
12:45:46.818 DEBUG: Plugins:
12:45:46.818 DEBUG:   * C++ (Community) 2.0.0.2634 (cxx)
[...]
12:45:48.787 DEBUG: Available languages:
12:45:48.787 DEBUG:   * CXX => "cxx"
[...]
12:45:56.044 DEBUG: Declared extensions of language CXX were converted to sonar.lang.patterns.cxx : **/*.cxx,.cpp,.cc,.c,.hxx,.hpp,.hh,.h
[...]
12:46:07.576 DEBUG: rule 'cxx:UndocumentedApi' file suffixes: [.h, .hh, .hpp, .H]
12:46:07.592 DEBUG: 'CXX verify analysis parameters' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'XSL transformation(s)' skipped because one of the required properties is missing
12:46:07.592 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
12:46:07.592 DEBUG: 'CXX' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX RATS report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Cppcheck report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Infer report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX PC-lint report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Dr. Memory report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX GCC compiler report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Visual C++ compiler report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Vera++ report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Valgrind report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Clang-Tidy report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX Clang Static Analyzer report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX other analyser report import' skipped because there is no related file in current project
12:46:07.592 DEBUG: 'CXX xUnit Test report import' skipped because one of the required properties is missing
12:46:07.608 DEBUG: 'CXX VSTest/NUnit Test report import' skipped because there is no related file in current project
12:46:07.608 DEBUG: 'CXX Bullseye coverage report import' skipped because there is no related file in current project
12:46:07.608 DEBUG: 'CXX Cobertura XML coverage report import' skipped because there is no related file in current project
12:46:07.608 DEBUG: 'CXX Testwell CTC++ TXT coverage report import' skipped because there is no related file in current project
12:46:07.608 DEBUG: 'CXX Visual Studio XML coverage report import' skipped because there is no related file in current project

Desktop (please complete the following information):

  • OS: Windows 10
  • SonarQube version: 8.8.0
  • cxx plugin version: sonar-cxx-plugin-2.0.0.2634.jar
  • sonar-scanner version: SonarScanner for MSBuild 5.0.4

Additional information
I've added old and new configuration format for "reportPath(s)" to better compatibility of our scripts.
According to the wiki instruction the old and the new parameter should work. But I do not receive the mentioned warning.

@guwirth
Copy link
Collaborator

guwirth commented May 4, 2021

Hi @lg2de,

sonar.cxx.cppcheck.reportPath=C:\\build\\_work\\105\\TestResults\\88484.cppcheck**.xml
sonar.cxx.cppcheck.reportPaths=C:\\build\\_work\\105\\TestResults\\88484.cppcheck**.xml
[...]
12:46:07.592 DEBUG: 'CXX Cppcheck report import' skipped because there is no related file in current project

Think should be 88484.cppcheck*.xml and not 88484.cppcheck**.xml. If possible I would also use / and not \\.

Ant-style pattern

Following matchFilePattern rules are applied:

? matches single character
* matches zero or more characters
** matches zero or more 'directories'
use always '/' as a directory separator
there must always be a root directory

Some examples of path patterns:

/**/*.cpp - matches all .cpp files in all directories (you have to define the root directory '/'), e.g. org/Foo.cpp or org/foo/Bar.cpp or org/foo/bar/Baz.cpp
/**/test/**/Foo.cpp - matches all 'Foo.cpp' files in directories with one 'test' directory in the path, e.g. org/test/Foo.cpp or org/bar/test/bar/Foo.cpp
org/T?st.cpp - matches org/Test.cpp and also org/Tost.cpp
org/*.cpp - matches all .cpp files in the org directory, e.g. org/Foo.cpp or org/Bar.cpp
org/** - matches all files underneath the org directory, e.g. org/Foo.cpp or org/foo/bar.jsp
org/**/Test.cpp - matches all Test.cpp files underneath the org directory, e.g. org/Test.cpp or org/foo/Test.cpp or org/foo/bar/Test.cpp
org/**/*.cpp - matches all .cpp files underneath the org directory, e.g. org/Foo.cpp or org/foo/Bar.cpp or org/foo/bar/Baz.cpp

Regards,

@guwirth guwirth added this to the 2.0.0 milestone May 4, 2021
@lg2de
Copy link
Author

lg2de commented May 4, 2021

I've changed the configuration from ** to *. The file is ignored anyway.
The path is build from Azure DevOps variable Common.TestResultsDirectory which is using backslash, so I cannot change from \\ to /.

@guwirth
Copy link
Collaborator

guwirth commented May 4, 2021

@lg2de
Copy link
Author

lg2de commented May 7, 2021

The problem is related to the setting sonar.cxx.file.suffixes and maybe all settings.
According to the upgrade guide I've configured sonar.cxx.file.suffixes to .cxx,.cpp,.cc,.c,.hxx,.hpp,.hh,.h, but "only" on the server.
This settings seams not to get active when only defined in the SonarQube server.
Only when explicitly configured on scanner command line or in the file sonar-project.properties the analysis is correct.

Do you have any idea?

@guwirth
Copy link
Collaborator

guwirth commented May 7, 2021

Thanks for the feedback @lg2de. I will have a look. In case you configure it only on the server, do you see in the log file:

19:02:05.078 DEBUG: Declared extensions of language CXX were converted to sonar.lang.patterns.cxx : **/*.cxx,**/*.cpp,**/*.cc,**/*.c,**/*.hxx,**/*.hpp,**/*.hh,**/*.h

@lg2de
Copy link
Author

lg2de commented May 7, 2021

Not exactly:

17:21:33.506 DEBUG: Declared extensions of language CXX were converted to sonar.lang.patterns.cxx :
**/*.cxx,.cpp,.cc,.c,.hxx,.hpp,.hh,.h

@guwirth
Copy link
Collaborator

guwirth commented May 8, 2021

@lg2de that is wrong. Looks like it is handled as one single string and not as an array of strings. Are you sure you added each file extension in a single field like below:
C8CFA89C-2D53-43A7-9DC7-5821C6F7C70E

@guwirth
Copy link
Collaborator

guwirth commented May 8, 2021

@lg2de think description is also confusing. It describes command line and not UI:

"Comma-separated list of suffixes for files to analyze (e.g. `.cxx,.cpp,.cc,.c,.hxx,.hpp,.hh,.h`)."

@guwirth guwirth changed the title V2 does not work with cppcheck sonar.cxx.file.suffixes not working in the UI May 8, 2021
@guwirth
Copy link
Collaborator

guwirth commented May 10, 2021

@lg2de
Copy link
Author

lg2de commented May 10, 2021

Confirmed, that correct configuration gets the plugin working fine.

Thanks for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants