I have written Sonarqube file exclusion rules. But it doesn't seem working. The intention is to exclude all files contain "jquery" in the file name in one or more directories inside "static". below is the rule
/static/**/*jquery*.js
is the above rule written correctly? is it case sensitive?
The root of your path likely isn't "static", so instead of
/static/**/*jquery*.js
Try
**/static/**/*jquery*.js
Related
I have a gradle build which generates war file. I want to copy war file to my application servers' dropins directory which is somewhere outside of project directory. I have following copy task to do this.
task copyWarToDropins(type: Copy,dependsOn:[war]) {
from './build/libs/bds-service-token-1.0-SNAPSHOT.war'
into file('/apps/dropins') // want to copy to 'C:/apps/dropins' directory
rename { fileName -> 'bds-service-token.war' }
}
build.dependsOn copyWarToDropin
It evaluates /apps/dropins relative project directory and does copy there. I have tried many ways I can think of but could not make it copy to C:/apps/dropins directory.
Can someone please help?
First, please note that using into file(...) is redundant, as each call to into(...) will be evaluated via Project.file(...) anyhow.
As you can read in the documentation , file(...) handles strings in the following way:
A CharSequence, including String or GString. Interpreted relative to the project directory. A string that starts with file: is treated as a file URL.
So, one way to solve your problem could be using an absolute file URL.
However, if you continue to read the documentation, you will see that Java File objects are supported. So you could simply create such an object:
into new File('C:/your/absolute/path')
I want to tweak one Ansible module, I am using multiple modules. Now I want minor tweaks in one of them. How can I override default code?
I am not sure but my assumption is if I created a similar directory structure of modules in current directory, it will refer this code and for rest of module it will refer default code eg. for yum_repository module, default path is:
/usr/local/Cellar/ansible/2.4.1.0/libexec/lib/python2.7/site-packages/ansible/modules/packaging/os/yum_repository.py
but If I create the directory structure in my working directory as:
ansible/modules/packaging/os/ and keep edited file yum_repository.py there, it should refer this edited file.
Ansible will look for modules in ./library subdirectory of the playbook dir.
You can also use library parameter in the Ansible configuration file to specify a common directory for your modules.
I'm currently developing a magento theme. I'm using grunt-compass and grunt-watch to compile my scss files. I would like to speed up the process with excluding styles-IE8.scss for compiling (because it's not used in developing environment).
I could (of course) rename to _styles-IE8.scss and rename it back for production, but isn't there a better way to define which files to compile and which not?
If you are using grunt-contrib-compass, in your Gruntfile.js you can use the specify option to exclude files.
Lets you specify which files you want to compile. Useful if you don't want to compile the whole folder. Globbing supported. Ignores filenames starting with underscore. Paths are relative to the Gruntfile.
ex:
compass: {
options: {
specify: "!/path/to/styles-IE8.scss"
}
}
Then, depending on the environment you can set specify dynamically.
I am using OCLint on an Objective C project to obtain a SonarQube profile.
Now my IOS Objective C project contains a src directory with multiple sub src directories. In my sonar-project.properties file there is a following entry
sonar.sources=MySrcFolder/
Now within this src folder i want to run the sonar profile on multiple subfolders and exclude some third party src folders. Can anyone help me with this ? As it stands now, sonar runs the profile on all src in any of the above folders subfolders ?
You can do it only with sonar.sources property or with the sonar.exclusions and sonar.inclusions properties.
Example:
MySrcFolder
src1
src2
src3
src4
If you want to analyze only src1 and src3 then,
1) sonar.sources=MySrcFolder/src1,MySrcFolder/src3
OR
2)
sonar.sources=MySrcFolder
sonar.exclusions=src2/**,src4/**
OR
3)
sonar.sources=MySrcFolder
sonar.inclusions=src1/**,src3/**
Following rules are applied in the exclusions and inclusions properties:
* Match zero or more characters
** Match zero or more directories
? Match a single character
file: Prefix to define a pattern based on absolute path
For more details: http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus
Add below lines to sonar-scanner-v.x.x/conf/sonar-scanner.properties file. Use
Comma-separated paths to analysis multiple modules or projects.
sonar.sources= mainDir/subDir/src, mainDir/subDir/subDir/src,...
Or
Set base directory with **sonar.projectBaseDir** param.
Thanks to the param, you can give relative path to sonar.sources's params.
Then
Run sonar-scanner.bat file in mainDir or root in directory of above sources.
I want to run Sonar Runner only on some selected files only. I'm using SonarRunner Ant.
My project directory structure is :
MyProject
|
|-----src
|-----java
|-----A
|-----B
| |---<files>.java
|
|-----C
| |---<files>.java
|
|-----hello.java
Now I want to run Sonar Runner only on hello.java file.
sonar.sources=../../../MyProject/src // takes the source directory
sonar.sources=../../../MyProject/src/java/A/hello.java didn't work
sonar.exclusions=**/**/*.java // excludes all java files
// now I want to include only hello.java file
// didn't find any parameter for inclusion, but tried the following
sonar.inclusions=hello.java // didn't work
sonar.inclusions=java/A/hello.java // didn't work
Referred this article for analysis parameters.
One solution which crossed my mind is : exclusion of all the files but the required ones.
But here the structure is just a small part. In real I have more than 250 java files, and want to generate report for, say, 10 files only. Then, by this approach, excluding 240+ files doesn't look a good idea.
Is there anyway to generate sonar report on selected files, other than the mentioned approach?
If you're looking for specific files, you might try the same syntax as is listed to explicitly exclude files (Narrowing the Focus - at the bottom)
#Absolute Path
To define an absolute path, start the pattern with "file:"
#Exclude all the *.cs files included in /path_to_my_project/myProject/src/generated and its subdirectories
sonar.exclusions=file:/path_to_my_project/myProject/src/generated/**/*.cs
#Exclude all the java classes contained in a src/generated/java directory and its subdirectories
sonar.exclusions=file:**/src/generated/java/**/*.java