The documentation of the project, instructs on how to e.g. exclude (or include) in an analysis process, say all files under a directory:
mydir/**/*
or all files with a specific extension (say .js) under a directory:
mydir/**/*.js
But what is the way to exclude all *.js files in the current (the root) directory.
I have tried the following patterns. do not seem to work:
sonar.coverage.exclusions=./*.js
sonar.coverage.exclusions=*.js
The multi-directory pattern, **, can be used at any point in the regex.
To exclude all .js files, you would use: **/*.js
To exclude .js files only in the current directory: *.js
However
You should not try to set these values in your analysis properties. Doing so correctly is tricky. Use the UI to set these values instead.
Related
It is possible to exclude files from zipping them with the 7zip -x switch, which allows wildcards too. So I can exclude all text files like this
7z a output.zip myfolder -x\!*.txt.
Now I want some txt files not to be excluded if they have a special name, like all text files named like this: *-KEYWORD.txt
I tried to use the exclude switch with the include switch together, like 7z a -xr\!*.txt -ir\!*KEYWORD.txt output.zip myfolder, but once the exclude switch is invoked, the include switch doesn't seem to reinclude excluded files again.
Is it possible to only include text files named like this, while excluding all other text files, inside the 7z syntax?
So this seems not to be possible in one command, especially not with the include and the exclude switch used both.
The solution I use in my script now is just to make two commands, the first excludes all files ending on *.txt, then another 7z command attaches all files like *-KEYWORD.txt to the package. It's not great but it works.
I'm writing a shell script that syncs files and I want to give users the ability to exclude certain files from syncing by creating a .syncignore file similar to Git's .gitignore file. According to the gitignore documentation, and my own experiments, these exclusion rules are more complicated than a simple glob match. Some examples:
If you have foo in your .gitignore file, it will exclude foo appearing anywhere in the path (e.g. ./foo, ./bar/foo, and ./bar/foo/baz would be excluded) but not partial matches of foo (e.g. ./foobar, ./bar/foobar/baz would NOT be excluded).
If you include a slash, then the rule is applied relative to the current directory. For example, if you have /foo in your .gitignore file, it will exclude ./foo but not ./bar/foo.
You can include wildcards. For example, foo* will exclude ./foo, ./foobar, and ./bar/foobar/baz.
Is there any easy way to replicate the exclusion rules for .gitignore in a shell script on OS X?
Use rsync to synchronize the files. Use its existing include/exclude pattern support. Put the rules in .rsync-filter and pass the -F flag to make it read the patterns from that file.
rsync man page
Just use git. Make sure you have git 2.3.0 or later on both sides, and use push-to-deploy.
Is there a way to exclude a file? I would like to exclude all *.config files. Everything else should be included.
Or if I could say include: *.aspx, *.ascx, *.xml, *.png, *.gif, *.html that would be fine.
To quote what Tod said in this forum post:
I'm not sure the component we use to FTP supports negated wildcards,
but you can simply add a Delete Files action before this that operates
on *.config
Alternatively (if you don't want to delete because you may re-use the
files), you can use the Synchronize/Transfer Files action to a
temporary directory (e.g. ~\Ftp) and use a !*.config mask on that to
not transfer the configs, then use the FTP action from ~\Ftp as the
source directory.
I have confused on SonarQube's wildcards usage. Say I want to ignore all xml files. Should I just put *.xml in the Global Source File Exclusions? But will it ignore xml files in different layers, for instance /foo/bar/file.xml and /foo/bar/folder/folder2/xml?
In your sonar-project.properties, you have two ways to ignore files:
sonar.exclusions=the/full/path/*.xml will ignore all .xml files in path.
sonar.exclusions=**/*.xml will ignore all .xml files in the folder and sub-folders where you are.
Here are the different wildcards:
* zero or more characters
** zero or more directories
? a single character
You can find more information on Sonar Documentation
Is there any way to specify in .vsprops file paths relative to .vsprops file directory?
For example, I have the followind directory stucture:
largesolution.sln
a/a.vcproj
b/c/c.vcproj
common/common.vsprops
Both a.vcproj and c.vcproj include common.vsprops, and I want to add some macro or set include directory relative to common folder regardless the solution directory both projects are included to. I've tried using $(InputDir) in .vsprops file, but it seems this macro is expanded as directory containing .vcproj, not .vsprops file.
Setting absolute paths or setting global include path in Visual C++ Directories is not a solution because different developers have different location of the source tree root. Setting paths relative to $(SolutionDir) does not suit because it is useful to have smaller solutions containig some subset ob projects (for example, a.vcproj only) somewhere outside main sources tree.
Of course, setting include directory in a.vcproj to $(ProjectDir)..\common works fine, but the result to be achieved is only including .vsprops and having paths set correctly.
You can use MSBuildThisFileDirectory macro.
For example:
You set Include Directories to "$(MSBuildThisFileDirectory)\include;$(IncludePath)" in common.props.
See http://msdn.microsoft.com/en-us/library/vstudio/ms164309.aspx for details.
Tested with MSVS2012 and MSVS2013.