Unable to get Sonar-Qube to analyze project - sonarqube

I have seen the other 2 appends and added sonar.languages=COBOL to my sonar-project.properties file to no avail.
I think it's basically more a case of not understanding the documentation (or the latter never having been "idiot tested"").
My problem is as follows. My properties file contains the following entries:-
# sonar.sources=../../mfuser/seb/source/
sonar.sources=C:/mfuser/SEB/Source
sonar.cobol.file.suffixes=cbl,cpy
sonar.cobol.copy.suffixes=cpy
#
sonar.languages=COBOL
When I run the sonar-scanner bat file, I'm seeing output like this:-
WARN File C:\mfuser\seb\source\vvira20.cbl is ignored. It is not located in module basedir c:\sonar-scanner\bin
To me this gives the impression that I can point to the directory containing my COBOL code, but at the same time the actual code HAS to be in c:\sonar-scanner\bin. Surely, that can't be the case? If it is, what is the point with the sonar.sources entry in the properties file?
In addition, onece I get this working, is there some way of specifying a parm/wild card so as to analyze SPECIFIC files. I tried sonar.sources=C:/mfuser/SEB/Source/vno* but that didn't seem to make any difference.
Thanks

You ran sonar-scanner from its own directory instead of running from the project directory. As the documentation says:
Run the following command from the project base directory
sonar-scanner
This same documentation recommends to create the sonar-project.properties file at the root of the project directory and to set the "sonar.sources" property to a path which is relative to the sonar-project.properties file.
Alternatively, you may want to use the "sonar.projectBaseDir" property. See the documentation for analysis parameters.

Related

specify source files when using snakemake remote prefix

From the docs:
https://snakemake.readthedocs.io/en/stable/executable.html
Currently, this mode requires that the Snakemake workflow is stored in a git repository. Snakemake uses git to query necessary source files (the Snakefile, scripts, config, …) for workflow execution and encodes them into the kubernetes job.
However, what is not clear to me is how to specify source files as stated. srcdir returns the absolute path with the specified prefix prepended.
Could someone please point me to the relevant area of the docs please!
Thanks
I haven't worked with kubernetics and Snakemake, but I am assuming using the 'default' structure should work. You can easily generate this structure with the snakemake cookiecutter repo:
https://github.com/snakemake-workflows/cookiecutter-snakemake-workflow
Just make sure cookiecutter is installed and you can run this on the command-line:
cookiecutter https://github.com/snakemake-workflows/cookiecutter-snakemake-workflow
Or you can always just take a look at where files are stored in that repo and copy the structure.

SonarQube Local Analysis - specify properties file

I'm trying to run the analysis locally using Sonar-Scanner 2.6 pointing to SonarQube 5.4. The local solution folder contains the sonar-project.properties file used in the cloud analysis.
I am trying to create the properties file to be used locally, that is separate from the global sonar-project.properties file. This is the command that I ran:
sonar-scanner -D project.settings=sonar-project-local.properties
Expected behavior: Of the two files (sonar-project.properties and sonar-project-local.properties), sonar-scanner would choose the local one.
Observed behavior: If the file sonar-project.properties exists, sonar-scanner uses the global one and ignores the local one.
If I remove (rename) the global file from the directory, then the local file is recognized, and behavior is as expected.
Is this a bug? What is the way to solve this issue without messing with the global properties file?
Generally the answer would be the space in your command. So, not
-D project.settings=...
but
-Dproject.settings=...
But that property was dropped. You'll just need to shuffle the properties files in/out of the "correct" name.

Directory excluding in sonar-project.properties file doesn't work (for me)

I have excluded the directory in my project properties but sonar doesn't exclude it. Can anyone help me to find problem?
sonar.sources=./
sonar.exclusions=./utility/Excel/**
I realized that first I should have written directory name Like below to exclude all folders and file on that directory:
sonar.exclusions=utility/Excel/**/*
Second I should have used comma separated directory names to exclude more than one directory:
sonar.exclusions=utility/Excel/**/* , utility/mailer/**/*
Look at the Inclusions/Exclusions Patterns documentation , and try this: sonar.exclusions=utility/Excel/**.
Note: pointing sonar.sources to the current directory is usually a mistake, you should point it to the actual directories which contain the sources (more details in Analysis Parameters).

install4j how to specify install dir on Windows Gradle

I have trouble using install4j on Windows for the project tripleA.
See source at: https://github.com/gaborbernat/triplea/blob/installer/build.gradle
I'm using the Gradle Plugin however I'm unable to specify the install 4j home directory.
If I try using absolute path that is 'C:/Program Files/install4j6' i get a normalization error as it gets translated to:
"C:/data/tripleA/'C:/Program Files/install4j6'"
what am I missing here? why is file('C:/Program Files/install4j6') referring to "C:/data/tripleA/'C:/Program Files/install4j6'"?
Now if I use a relative path it says the folder does not exists.
Thanks,
Due to your build.gradle, the path is retrieved from properties file. It seems, that this path in your properties is placed within single quotes, as 'C:/Program Files/install4j6', and your gradle script logic get the value with this quotes.
That is the reason, file() doesn't recognize it as absolute path and tries to parse it as relative. Here is some code, which reproduces your exception:
task testFile {
File ff = file('\'d:/test.xml\'')
println ff.absolutePath
}
This will cause an error
Could not normalize path for file 'D:\path\to\your\project\'d:\test.xml''
So, you should try to change the property, to make it a plain string without quotes.

How to make sonar analysis for C++ work?

I'm trying to use sonar for static analysis on a c++ code. I've installed sonar and configured my project (it appears on the localhost sonar page, but i do not see any code violation for the respective code). I have the C++ community plugin installed.
My sonar-project.properties looks like this:
# required metadata
sonar.projectKey=DiceInvaders
sonar.projectName=Dice Invaders
sonar.projectVersion=1.0
# optional description
sonar.projectDescription=DiceInvaders by CS
# path to source directories (required)
sonar.sources=D:\\DiceInvaders\\Code
# path to test source directories (optional)
#sonar.tests=D:\\DiceInvaders\\Code
# path to project binaries (optional), for example directory of Java bytecode
#sonar.binaries=binDir
# optional comma-separated list of paths to libraries. Only path to JAR file is supported.
#sonar.libraries=path/to/library/*.jar,path/to/specific/library/myLibrary.jar,parent/*/*.jar
# The value of the property must be the key of the language.
sonar.language=c++
sonar.exclusions=**/*.ipch, **/**/*.rc
sonar.cxx.cppcheck.path = "C:\Program Files (x86)\Cppcheck\cppcheck.exe"
sonar.cxx.cppcheck.reportPath="D:\DiceInvaders\Code\cppcheck-reports\cppcheck.xml".
# Additional parameters
#sonar.my.property=value
I do not get any error when running sonar-runner from cmd.
If i run manually the cppcheck.exe tool on my project I can find violations. Why don't the violations appear on sonar's page?
Is there something else I should configure, am I doing something wrong?
I was able to make it work by running the cppcheck tool independently before sonnar-runner, and placing the generated xml report in the bin folder of sonnar-runner.
In the sonar-project.properties file I've specified the xml directly:
sonar.cxx.cppcheck.reportPath=cppcheck-result-1.xml
I had a similar problem, which was caused by a whitespace after 'sonar.language=cs'. Be sure that there is a linebreak immediately after 'cxx'. Hope it works.
The language key of the Sonar C++ Community plugin is not 'c++' but 'cxx'. See http://docs.codehaus.org/pages/viewpage.action?pageId=185073817.
So you must replace 'sonar.language=c++' by 'sonar.language=cxx'

Resources