SonarQube - Using wildcards to ignore all xml files - sonarqube

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

Related

Bash - Extract filenames without extensions and check if identically named files with a different extension exist

I have two folders with many files of the same naming format but differing extensions. I would like to loop through the files of the first folder and extract their filenames to check if a file of the same name exists in the other folder, then create one (with the other extension) if it doesn't. I can't get a grapple on bash for whatever reason, so I was wondering if there's a simple way to do this.

7z: Is it possible to exclude files conditionally?

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.

SonarQube: Ignore files in current (root) directory

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.

BuildMaster - FTP - How to include or exclude a file type

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.

Reading files from multiple directories in Logstash?

I read my log files (cron_log, auth_log, mail_log, etc) using this config:
file{
path => '/path/to/log/file/*_log'
}
So I read my log files and check:
if(path) ~= "cron" -----match--------
if(path) ~= "auth" -----match--------
Now I have a directories like: Server1 Server2 Server3......In Server 1 there are subdirectories: authlog cronlog.....Inside authlog there are subdirectories date wise (like 2014.05.26, 2014.05.27) which finally contain log file for the day, which I have to parse.
So presently I was having one config file which use to read files using *_log and I use to run that config file and all log files present in /path/to/log/file/*_log were parsed.
Now I have to read from many directories (as explained above).
Will I have to write separate config file for each directory??
What's the best way to achieve this using logstash??
Ruby globs interpret ** as including all subdirectories.
So, for example, you could give the file input a path such as:
/path/to/date/folders/**/*_log

Resources