Sonarlint cli: Exclude specific directories (--src glob pattern)

1,653 views
Skip to first unread message

mahima...@gmail.com

unread,
Oct 20, 2016, 2:34:10 AM10/20/16
to SonarLint
Hi All,

In sonarlint cli, I'm trying to exclude specific directories in my source path.Can some one tell me how to exclude specific directory in glob pattern.


sonarlint.bat --src "{**/check/**,!**/excludedir/**}"

sonarlint cli is hanging when above command is used.


Can some one please suggest me what I was doing wrong here.

Note: In above example I want to scan check directory and exclude excludedir directory.

Julien HENRY

unread,
Oct 20, 2016, 3:05:23 AM10/20/16
to mahima...@gmail.com, SonarLint
Hi,

If you project is very big and the regexp is too complex, it may take too long to collect the list of files. I'm also not sure the "!" can be use to negate a pattern. Please try to use the --exclude parameter:

sonarlint.bat --src **/check/** --exclude **/excludedir/**

++

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/c1f541d5-acad-462c-84a8-1bd3aee73974%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mahima raju

unread,
Oct 20, 2016, 4:56:59 AM10/20/16
to Julien HENRY, SonarLint
Thanks Julien.It helps me a lot

Mahima raju

unread,
Oct 20, 2016, 7:14:25 AM10/20/16
to Julien HENRY, SonarLint

Hi Julien,

This works perfectly for 2.0, I'm getting following exception when I'm running in n sonarlint cli 1.0

D:\GScanOjetRules\sonarlint-cli-1.0\sonarlint-cli-1.0\bin>sonarlint.bat --src "**/checks/**" --exclude "**/checks/mahi/**"
D:\GScanOjetRules\sonarlint-cli-1.0\sonarlint-cli-1.0\bin\..
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
ERROR: Error parsing arguments: Unrecognized option: --exclude
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

Is there any workaround for this issue in 1.0


Thanks,
RaJ

Julien HENRY

unread,
Oct 20, 2016, 8:08:07 AM10/20/16
to Mahima raju, SonarLint
-- exclude was introduced in 2.0. Why would you stay on 1.0?

Mahima raju

unread,
Oct 20, 2016, 9:56:05 AM10/20/16
to Julien HENRY, SonarLint
We are on JDK 7 and Sonarlint 2.0 required JDK 8

Mahima raju

unread,
Oct 23, 2016, 10:58:43 PM10/23/16
to Julien HENRY, SonarLint
Hi Julien,

Please let me know is there any way to exclude specific directories in sonarlint 1.0

Thanks,
RaJ

Julien HENRY

unread,
Oct 24, 2016, 2:43:09 AM10/24/16
to Mahima raju, SonarLint
Hi RaJ,

No there isn't.

++

Julien
Reply all
Reply to author
Forward
0 new messages