chuchu Valued Contributor.
Valued Contributor.
9009 views

How to exclude files and folders when using Fortify with MSBuild

Jump to solution

Hi,

I translate my sources with msbuild using the following command:

sourceanalyzer -b sample msbuild sample.sln /maxcpucount:1

When this is done I analyze the source:

sourceanalyzer -b sample -scan -f result.fpr

Because the sample.sln solution contains a lot of test projects I have a lot of findings in test code which I’m not interested in. How can I exclude the test projects? I’ve tried the –exclude switch with no luck.

My sample.sln is part of a bigger project and fortify also produces findings in xml files which are not part of my solution. How can I exclude them?

With best regards,
Chris

 

Labels (1)
0 Likes
1 Solution

Accepted Solutions
ska Trusted Contributor.
Trusted Contributor.

Re: How to exclude files and folders when using Fortify with MSBuild

Jump to solution

Yeah the -exclude arg will not work if you do a wild cards (**) in the middle like that.  It would have to be like

-exclude "path/to/my/dir" to exclude everything under /dir or

-exclude "path/to/my/dir/**/*.class" to exclude all class files under /dir for example

I believe this will be modified in the latest/upcoming version (so you would be able to do that) but for now you can not do -exclude "path/to/**/my/dir"

3 Replies
ska Trusted Contributor.
Trusted Contributor.

Re: How to exclude files and folders when using Fortify with MSBuild

Jump to solution

What version of SCA are you using? Also, what was the command that you used with -exclude that didn't work?

0 Likes
chuchu Valued Contributor.
Valued Contributor.

Re: How to exclude files and folders when using Fortify with MSBuild

Jump to solution

I used something like this:

sourceanalyzer -b sln1 -exclude "D:\MyWorkspace\**\sdk.*\**\*" devenv sln1.sln /REBUILD debug

 

to exclude all folder which start with

sdk.

This doesn't work. When I specify the whole folder it works.

 

0 Likes
ska Trusted Contributor.
Trusted Contributor.

Re: How to exclude files and folders when using Fortify with MSBuild

Jump to solution

Yeah the -exclude arg will not work if you do a wild cards (**) in the middle like that.  It would have to be like

-exclude "path/to/my/dir" to exclude everything under /dir or

-exclude "path/to/my/dir/**/*.class" to exclude all class files under /dir for example

I believe this will be modified in the latest/upcoming version (so you would be able to do that) but for now you can not do -exclude "path/to/**/my/dir"

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.