SonarLint CLI --src parameter doesn't work as expected

278 views
Skip to first unread message

gilbert...@googlemail.com

unread,
May 30, 2016, 5:03:42 PM5/30/16
to SonarLint
Hi,

c:\whatever>sonarlint -h
c:\tools\sonarlint-cli-1.0\bin\..
INFO:
INFO: usage: sonarlint [options]
INFO:
INFO: Options:
INFO:  -D,--define <arg>      Define property
INFO:  -e,--errors            Produce execution error messages
INFO:  -h,--help              Display help information
INFO:  -v,--version           Display version information
INFO:  -X,--debug             Produce execution debug output
INFO:  -i,--interactive       Run interactively
INFO:  --html-report <path>   HTML report output path (relative or absolute)
INFO:  --src <glob pattern>   GLOB pattern to identify source files
INFO:  --tests <glob pattern> GLOB pattern to identify test files
INFO:  --charset <name>       Character encoding of the source files

A test with an example project that has 81 Java sources under /src shows different
behaviour with using:

sonarlint -Dsonar.sources=/src (or -Dsonar.sources=src)
=> INFO: 81 files indexed
and
sonarlint --src **/src/**
=> INFO: 78 files indexed

The glob pattern **/src/** was the only one to make it work, all others
like f.e. */src/** resulted in :
WARN: No files to analyze

What's the reason for the missing 3 files not indexed, when using --src parameter ?

//Gilbert

Julien HENRY

unread,
May 31, 2016, 3:09:12 AM5/31/16
to gilbert...@googlemail.com, SonarLint
Hi,

sonar.sources is not used in SonarLint. So in fact in your first try your are simply analyzing all files of your project from the current dir, while your second attempt with sonarlint --src **/src/** will limit to the src folder.

I agree the glob syntax is not very simple to use, especially because it is matched against absolute path (that's why sonarlint --src src/**) is not working. Here is a ticket to try to simplify the syntax:

Thanks for the feedback,

Julien

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/7405e4aa-f60e-4ba5-a191-04f8f6e1fc56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages