sonarqube scanner for msbuild can't exclude external libraries - msbuild

I've been trying for a number of days now to exclude some files from a sonarqube scan. I have tried editing the exclusions list in the sonarqube UI, and passing them as a /d:exclusions parameter to SonarScanner-start.bat but nothing is working. This is the file I'm trying to exclude : Content/bootstrap/js/bootstrap-datepicker.js. Sonarqube insists on reporting this as a critical bug in the UI, despite my best efforts. Please can someone let me know how I can exclude this from the analysis.

The name of the property is sonar.exclusions and I suspect if you set it like this it should work:
/d:sonar.exclusions=**/bootstrap-datepicker.js
There are some examples for patterns here:
https://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-Patterns
If this does not help, please, edit your answer to include the full command line of SonarQube.Scanner.MsBuild.

Related

sonar.issue.ignore.allfile not working?

SonarQube Scanner for MSBuild 4.0.2
SonarQube Server 6.7.1
SonarC# 6.7.1
I am trying to exclude files with a specific pattern, e.g. when I find a hint to a 3rd party contribution in a source.
I pass following parameters
/d:sonar.issue.ignore.allfile=ExcludeStuff
/d:sonar.issue.ignore.allfile.ExcludeStuff.fileRegexp="Vendor.*Name"
So I am seeking to catch all files that have "VendorName", "Vendor Name" or "Vendor Name" in their content.
In the SonarScanner end step I get outputs like
INFO: '<filename...>' generating issue exclusions
for almost all files -- I have failed understand which files produce that output. I do not see a relation to the regex pattern.
Eventually the summary is always that all files are indexed and none are excluded.
So here are my specific questions:
How can I tell whether or not a files is excluded for all issues?
What is the correct syntax of the regex?
Is there a working example / documentation on the sonar.issue.ignore.allfile stuff?
I cannot use sonar.exclusions because due to the path structure I would need absolute paths which are -- for whatever reason -- not available in the scanner anymore.
I spent quite some time doing research on the sonar.issue.ignore.allfile usage without success. Perhaps I have missed it, but I would gladly take any advice.

Intellij - Find path to src directory

I am creating an IntelliJ plugin and I am using JavaParser for one of my features. My plugin will allow users to click a gutter icon next to a method and automatically navigate to the tests associated with that method.
To achieve this, temporerily I have used the line:
typeSolver.add(new JavaParserTypeSolver(new File("/home/webby/IdeaProjects/project00/src/")));
My problem is that I need to pass the source folder of the given module into this type solver. Is there any way I can find the source folder programmatically? Perhaps from an actionEvent?
I have tried things along the lines of the following:
actionEvent.getData(PlatformDataKeys.PROJECT).getBasePath()
This gives me: '/home/webby/IdeaProjects/project00/' but I'm struggling to see how I can get the source folder? I feel there should be a fairly straight forward way of doing this using IntelliJ's SDK but I have not found anything in the documentation or anywhere else online.
Any and all solutions welcome!
Many Thanks,
James
You can use
ModuleRootManager.getInstance(module).getSourceRoots()
to access sources roots of a module. Refer to IntelliJ SDK Docs for details.
BTW IntelliJ IDEA provides special API to syntax trees of Java files, it works more efficiently and better integrates with other IDE features than external JavaParsers.
And it's better to ask questions about IntelliJ IDEA API on a special forum.

Lexical or preprocessor Issue: while using flite1.4-iphone library for TTS?

I'm using
flite1.4-iphone
in my application for text to speech. I'm following this link- see here
but i get the error
Lexical or preprocessor Issue: flite.h not found
Yes i searched google for this and apply all the solutions that i found like- close Xcode and reopen, clean project etc etc, but still cant found solution.
Can anyone help me please?
Thanks.
The problem is that the compiler cannot find flite.h; looking at sfoster/iPhone TTS, it seems the file is supplied in the flite-1.4-iphone/include/ directory.
To make the compiler find the file, add the directory where flite.h is in (e.g., $(SRCROOT)/flite-1.4-iphone/include/ to the project's Header Search Paths. (see this SO Q&A for details on how to modify the path).

C#, Gendarme, Sonar and Jenkins : Exclude generated files from Gendarme

I'm working with gendarme for .net called by Sonar (launched by Jenkins).
I've a lot of AvoidVisibleFieldsRule violations. The main violations are found in the generated files. As I can't do anything on it, i would like to exclude *.designer.cs from the scan.
I can't find a way to do that. There is a properties in Sonar to exclude generated files but it doesn't seem to be applied for gendarme.
Is there a way to do such a thing ?
Thanks for all
Gendarme expects you provide an ignore list,
http://www.mono-project.com/Gendarme.FAQ
https://github.com/mono/mono-tools/blob/master/gendarme/self-test.ignore
The ignore file format is bit of weird, but you can learn it by experiments.
Indeed that is actually not normal at all. Generated code is excluded by the plugin with the standard configuration. What version of the C# plugins are you using ?
Anyway, the configuration property you can try is "sonar.exclusions" (see http://docs.codehaus.org/display/SONAR/Advanced+parameters).
If you do not solve your problem right away, the best thing would be to drop a mail to the user mailing list (see http://www.sonarsource.org/support/support/) and send the verbose output of your build. To get this output simply add "-X" to the command line.
Hope it helps

TeamCity's AssemblyInfo patcher's number format

I once had TeamCity + WiX + MSBuild Community Tasks working. Now that I've upgraded to WiX 3.5, I can't remember how I had configured it. :) As I was poking through TeamCity, I came across the "AssemblyInfo Patcher". I thought, "Great! This will make my life much easier!". I used %build.vcs.number.1% for the format and built my installer.
While the patcher did pull in the vcs number, it used it for the major number in the version. So instead of 1.0.0.xxxx, it made the version xxxx.0.0.0.
I looked through JetBrain's documentation site and came up with nothing related to changing this to a more appropriate setting. I also looked for regex support, but didn't find anything.
Can anyone suggest a good solution, or should I just go back to trying to configure my original set of tools?
The assembly info patcher only patches the complete version string at once. But the system variable build.number can be generated from the "general" page of the build configuration, like this:
When you specify %build.number% as your AssemblyInfo version, it will pick up the combined number from your General settings page.
Try including the full intended version number as part of your format:
1.0.0.%build.vcs.number.1%
Hmmm haven't seen AssemblyInfo Patcher but you can do it manually using MsBuild and Regex:
http://jonalb.com/post/2010/10/04/Automatic-Versioning-using-TeamCity-an-MSBuild.aspx