Skip to content

Instantly share code, notes, and snippets.

@devops-school
Created July 19, 2022 18:16
Show Gist options
  • Select an option

  • Save devops-school/c685ea583be3f7ea4d7fd962b4690842 to your computer and use it in GitHub Desktop.

Select an option

Save devops-school/c685ea583be3f7ea4d7fd962b4690842 to your computer and use it in GitHub Desktop.
Example of sonar-project.properties file
sonar.projectKey=org.sonarqube:sonarqube-scanner
sonar.projectName=Example of SonarQube Scanner Usage
sonar.projectVersion=1.0
sonar.sources=src,copybooks
sonar.sourceEncoding=UTF-8
## Cobol Specific Properties
# comma-separated paths to directories with copybooks
sonar.cobol.copy.directories=copybooks
# comma-separated list of suffixes
sonar.cobol.file.suffixes=cbl,cpy
sonar.cobol.copy.suffixes=cpy
## Flex Specific Properties
# retrieve code coverage data from the Cobertura report
sonar.flex.cobertura.reportPath=coverage-report/coverage-cobertua-flex.xml
# PL/I Specific Properties
sonar.pli.marginLeft=2
sonar.pli.marginRight=0
sonar.projectKey=notarisation
sonar.projectName=notarisation
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**,src/main.ts,**/*.spec.js,public/**
sonar.tests=tests
sonar.test.inclusions=**/*.spec.ts,**/*.e2e-spec.ts
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.testExecutionReportPaths=coverage/sonar-report.xml
sonar.login=EBSI_sonar
##########################
# Required configuration #
##########################
sonar.projectKey=my-project
sonar.projectName=My project
sonar.projectVersion=1.0
sonar.language=objc
# Project description
sonar.projectDescription=Fake description
# Path to source directories
sonar.sources=srcDir1,srcDir2
# Path to test directories (comment if no test)
sonar.tests=testSrcDir
# Xcode project configuration (.xcodeproj or .xcworkspace)
# -> If you have a project: configure only sonar.objectivec.project
# -> If you have a workspace: configure sonar.objectivec.workspace and sonar.objectivec.project
# and use the later to specify which project(s) to include in the analysis (comma separated list)
sonar.objectivec.project=myApplication.xcodeproj
# sonar.objectivec.workspace=myApplication.xcworkspace
# Scheme to build your application
sonar.objectivec.appScheme=myApplication
# Scheme to build and run your tests (comment following line of you don't have any tests)
sonar.objectivec.testScheme=myApplicationTests
##########################
# Optional configuration #
##########################
# Encoding of the source code
sonar.sourceEncoding=UTF-8
# JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml
# Change it only if you generate the file on your own
# The XML files have to be prefixed by TEST- otherwise they are not processed
# sonar.junit.reportsPath=sonar-reports/
# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml
# Change it only if you generate the file on your own
# sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml
# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml
# Change it only if you generate the file on your own
# sonar.objectivec.oclint.report=sonar-reports/oclint.xml
# Paths to exclude from coverage report (tests, 3rd party libraries etc.)
# sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2
sonar.objectivec.excludedPathsFromCoverage=.*Tests.*
# Project SCM settings
# sonar.scm.enabled=true
# sonar.scm.url=scm:git:https://...
sonar.projectKey=org.sonarqube:sonarqube-scanner
sonar.projectName=Example of SonarQube Scanner Usage
sonar.projectVersion=1.0
sonar.sources=src,copybooks
sonar.sourceEncoding=UTF-8
## Cobol Specific Properties
# comma-separated paths to directories with copybooks
sonar.cobol.copy.directories=copybooks
# comma-separated list of suffixes
sonar.cobol.file.suffixes=cbl,cpy
sonar.cobol.copy.suffixes=cpy
## Flex Specific Properties
# retrieve code coverage data from the Cobertura report
sonar.flex.cobertura.reportPath=coverage-report/coverage-cobertua-flex.xml
# PL/I Specific Properties
sonar.pli.marginLeft=2
sonar.pli.marginRight=0
# This file is used to scan the project for issues automatically
# Browse the result here: https://sonarcloud.io/organizations/simgrid/projects?sort=-size
sonar.organization=simgrid
sonar.projectKey=simgrid_simgrid
sonar.projectName=SimGrid
sonar.projectVersion=3.31.1
sonar.links.homepage=https://simgrid.org
sonar.links.issue=https://framagit.org/simgrid/simgrid/issues
sonar.links.scm=https://framagit.org/simgrid/simgrid/
# Comma-separated paths to directories with sources (required)
sonar.sources=src,examples,include,teshsuite
# Disable some rules on some files
sonar.issue.ignore.multicriteria=j1,j2,j3,j4,jni1,jni2,c1,c2a,c2b,c3,c5a,c5b,c6a,c6b,c7,c8,c9,c10a,c10b,c10c,cex1a,cex1b,cex2a,cex2b,cex3,cex4,cxx17a,cxx17b,cxx17c,cxx17d,cxx17e,cxx17f,f1,p1,s1,s2,s3,s4,s5
# The Object.finalize() method should not be overridden
# But we need to clean the native memory with JNI
sonar.issue.ignore.multicriteria.j1.ruleKey=java:S1113
sonar.issue.ignore.multicriteria.j1.resourceKey=**/*.java
# Throwable.printStackTrace(...) should not be called
# But we don't have no better mechanism, and our Java apps are not rocket science
sonar.issue.ignore.multicriteria.j2.ruleKey=java:S1148
sonar.issue.ignore.multicriteria.j2.resourceKey=**/*.java
# Using command line arguments is security-sensitive
# But the authors of the applications using our library will be their only users, so there is no security concern
sonar.issue.ignore.multicriteria.j3.ruleKey=java:S4823
sonar.issue.ignore.multicriteria.j3.resourceKey=**/*.java
# Standard outputs should not be used directly to log anything
# But this file is used before SimGrid is initialized
sonar.issue.ignore.multicriteria.j4.ruleKey=java:S106
sonar.issue.ignore.multicriteria.j4.resourceKey=src/bindings/java/org/simgrid/NativeLib.java
# "reinterpret_cast" should not be used
# But this is exactly intended to store a pointer into a long -- what we do here
sonar.issue.ignore.multicriteria.jni1.ruleKey=cpp:S3630
sonar.issue.ignore.multicriteria.jni1.resourceKey=src/bindings/java/*.cpp
# Unused function parameters should be removed
# But JNI mandates these parameters
sonar.issue.ignore.multicriteria.jni2.ruleKey=cpp:S1172
sonar.issue.ignore.multicriteria.jni2.resourceKey=src/bindings/java/*.cpp
# Pointers should not be cast to integral types
# But we need that for jMSG, smpi and other places
sonar.issue.ignore.multicriteria.c1.ruleKey=cpp:S1767
sonar.issue.ignore.multicriteria.c1.resourceKey=**/*.cpp
# Preprocessor operators "#" and "##" should not be used
# This poses portability issues, but we test on a large panel of architectures on purpose
# Until after Augustin goes to rehab, we cannot remove them all
sonar.issue.ignore.multicriteria.c2a.ruleKey=c:PPStringifyAndPastingUsage
sonar.issue.ignore.multicriteria.c2a.resourceKey=**/*
sonar.issue.ignore.multicriteria.c2b.ruleKey=cpp:PPStringifyAndPastingUsage
sonar.issue.ignore.multicriteria.c2b.resourceKey=**/*
# Macro names should comply with a naming convention
# But the macros in this file are named after the MPI standard
sonar.issue.ignore.multicriteria.c3.ruleKey=c:PPMacroName
sonar.issue.ignore.multicriteria.c3.resourceKey=include/smpi/smpi_extended_traces.h
# Replace alternative operator "not" with "!"
# I like it better, so please leave me alone
sonar.issue.ignore.multicriteria.c5a.ruleKey=cpp:S3659
sonar.issue.ignore.multicriteria.c5a.resourceKey=**/*.cpp
sonar.issue.ignore.multicriteria.c5b.ruleKey=cpp:S3659
sonar.issue.ignore.multicriteria.c5b.resourceKey=**/*.hpp
# Dynamically allocated memory should be released
# We have better ways to detect memleaks in SimGrid
# This is not disabled in example/ because our code should be nice looking
sonar.issue.ignore.multicriteria.c6a.ruleKey=cpp:S3584
sonar.issue.ignore.multicriteria.c6a.resourceKey=src/**/*.cpp
sonar.issue.ignore.multicriteria.c6b.ruleKey=cpp:S3584
sonar.issue.ignore.multicriteria.c6b.resourceKey=teshsuite/**/*.cpp
# Macros should not be used to define constants
# *.h includes are meant to be usable in C
sonar.issue.ignore.multicriteria.c7.ruleKey=cpp:S5028
sonar.issue.ignore.multicriteria.c7.resourceKey=**/*.h
# Deprecated code should be removed
# We do have a process to remove deprecated code
sonar.issue.ignore.multicriteria.c8.ruleKey=*:S1133
sonar.issue.ignore.multicriteria.c8.resourceKey=**/*
# Lambda return types should be implicit
# I don't see the point in general, plus we mostly use them when forced, to disambiguate
sonar.issue.ignore.multicriteria.c9.ruleKey=cpp:S3574
sonar.issue.ignore.multicriteria.c9.resourceKey=**/*
# Standard outputs should not be used directly to log anything
# Irrelevant for parsing examples
sonar.issue.ignore.multicriteria.c10a.ruleKey=cpp:S106
sonar.issue.ignore.multicriteria.c10a.resourceKey=teshsuite/s4u/evaluate-*-time/*.cpp
sonar.issue.ignore.multicriteria.c10b.ruleKey=cpp:S106
sonar.issue.ignore.multicriteria.c10b.resourceKey=teshsuite/s4u/is-router/*.cpp
sonar.issue.ignore.multicriteria.c10c.ruleKey=cpp:S106
sonar.issue.ignore.multicriteria.c10c.resourceKey=teshsuite/platforms/*.cpp
# Declarations should be placed in a namespace
# But examples are intended to remain small and simple
sonar.issue.ignore.multicriteria.cex1a.ruleKey=cpp:GlobalNamespaceMembers
sonar.issue.ignore.multicriteria.cex1a.resourceKey=examples/**/*.cpp
sonar.issue.ignore.multicriteria.cex1b.ruleKey=cpp:GlobalNamespaceMembers
sonar.issue.ignore.multicriteria.cex1b.resourceKey=examples/**/*.hpp
# Functions which do not return should be declared as "noreturn"
# But examples are intended to remain small and simple
sonar.issue.ignore.multicriteria.cex2a.ruleKey=c:S5271
sonar.issue.ignore.multicriteria.cex2a.resourceKey=examples/**/*.c
sonar.issue.ignore.multicriteria.cex2b.ruleKey=cpp:S5271
sonar.issue.ignore.multicriteria.cex2b.resourceKey=examples/**/*.cpp
# Unused function parameters should be removed, but not in examples
sonar.issue.ignore.multicriteria.cex3.ruleKey=c:S1172
sonar.issue.ignore.multicriteria.cex3.resourceKey=examples/**/*.c
# no need for constness precision in examples
sonar.issue.ignore.multicriteria.cex4.ruleKey=c:S995
sonar.issue.ignore.multicriteria.cex4.resourceKey=examples/**/*.c
# Ignore these C++17 rules in public headers, where we still support C++14
# C++17: Concise syntax should be used for concatenatable namespaces
sonar.issue.ignore.multicriteria.cxx17a.ruleKey=cpp:S5812
sonar.issue.ignore.multicriteria.cxx17a.resourceKey=include/**/*
# C++17: "if","switch", and range-based for loop initializer should be used to reduce scope of variables
sonar.issue.ignore.multicriteria.cxx17b.ruleKey=cpp:S6004
sonar.issue.ignore.multicriteria.cxx17b.resourceKey=include/**/*.hpp
# C++17: Structured binding should be used
sonar.issue.ignore.multicriteria.cxx17c.ruleKey=cpp:S6005
sonar.issue.ignore.multicriteria.cxx17c.resourceKey=include/**/*.hpp
# C++17: "std::string_view" should be used to pass a read-only string to a function
sonar.issue.ignore.multicriteria.cxx17d.ruleKey=cpp:S6009
sonar.issue.ignore.multicriteria.cxx17d.resourceKey=include/**/*.hpp
# C++17: Redundant class template arguments should not be used
sonar.issue.ignore.multicriteria.cxx17e.ruleKey=cpp:S6012
sonar.issue.ignore.multicriteria.cxx17e.resourceKey=include/**/*.hpp
# C++17: The "_t" and "_v" version of type traits should be used instead of "::type" and "::value"
sonar.issue.ignore.multicriteria.cxx17f.ruleKey=cpp:S6020
sonar.issue.ignore.multicriteria.cxx17f.resourceKey=include/**/*.hpp
# "reinterpret_cast" should not be used
# But we need this to interface C and Fortran
sonar.issue.ignore.multicriteria.f1.ruleKey=cpp:S3630
sonar.issue.ignore.multicriteria.f1.resourceKey=src/smpi/bindings/smpi_f77*.cpp
# In Python, Using command line arguments is security-sensitive
# But we are cautionous with it
sonar.issue.ignore.multicriteria.p1.ruleKey=python:S4823
sonar.issue.ignore.multicriteria.p1.resourceKey=**/*.py
# In MPI, there are C function pointers
sonar.issue.ignore.multicriteria.s1.ruleKey=cpp:S5205
sonar.issue.ignore.multicriteria.s1.resourceKey=src/smpi/**/*.cpp
# MPI standard has long prototypes
sonar.issue.ignore.multicriteria.s2.ruleKey=cpp:S107
sonar.issue.ignore.multicriteria.s2.resourceKey=src/smpi/**/*.cpp
# MPI standard uses void*
sonar.issue.ignore.multicriteria.s3.ruleKey=cpp:S5008
sonar.issue.ignore.multicriteria.s3.resourceKey=src/smpi/**/*.cpp
# MPI standard uses const, sometimes const_cast is needed
sonar.issue.ignore.multicriteria.s4.ruleKey=cpp:S859
sonar.issue.ignore.multicriteria.s4.resourceKey=src/smpi/**/*.cpp
# Pointer and reference parameters should be "const" if the corresponding object is not modified
# AFAICT, the "constness" is required by the MPI standard and cannot be fixed.
sonar.issue.ignore.multicriteria.s5.ruleKey=cpp:S995
sonar.issue.ignore.multicriteria.s5.resourceKey=src/smpi/bindings/*.cpp
# Exclude some files from the analysis:
# - our unit tests
# - the tests that we borrowed elsewhere (MPICH and MBI)
# - Flex-generated files
# - Collectives that we borrowed elsewhere (mpich, openMPI and other implems)
# - the NAS, that are included in our examples
# - The Catch2 library, that is included in our unit tests
# - The xxHash library, used by the MC
# - MSG along with its examples and teshsuite
sonar.exclusions=src/include/catch.hpp,src/include/xxhash.hpp,src/*_unit.c*,teshsuite/smpi/mpich3-test/**,**/*_dtd.c,**/*_dtd.h,**/*yy.c,src/xbt/automaton/parserPromela.tab.*,src/smpi/colls/**/*,examples/smpi/NAS/*,examples/smpi/gemm/gemm.c,src/msg/**,include/msg/**,examples/deprecated/**,teshsuite/msg/**
# Exclude our examples from the duplication detection.
# Examples are expected to be somehow repetitive
sonar.cpd.exclusions=examples/**,teshsuite/**
# The build-wrapper output dir
sonar.cfamily.build-wrapper-output=bw-outputs
# Allow multithreaded execution
sonar.cfamily.threads=4
# Where the coverage files are located
# See https://docs.sonarqube.org/pages/viewpage.action?pageId=5312222
sonar.cfamily.gcov.reportsPath=Testing/CoverageInfo
# Files to ignore from coverage analysis:
# - foreign test suites
# - examples in smpi/mc (coverage doesn't work with model checker)
# - XML files
# - Python files used to generate either simcalls or deployment files
# - Any java source code (it's deprecated now)
# - MSG (deprecated too)
sonar.coverage.exclusions=teshsuite/smpi/mpich3-test/**,teshsuite/smpi/MBI/**,examples/smpi/mc/**,**/*.xml,**/generate.py,**/*.java,src/bindings/java/**,src/msg/**,include/msg/**,examples/deprecated/**,teshsuite/msg/**
# Encoding of the source files
sonar.sourceEncoding=UTF-8
# Version of the used prog languages
sonar.java.source=8
sonar.java.binaries=CMakeFiles/simgrid-java_jar.dir,examples/deprecated/java
sonar.java.libraries=
sonar.python.version=3
### NOTE: the following properties are overridden by Jenkins configuration
###
#sonar.java.binaries
#sonar.cfamily.build-wrapper-output
#sonar.cfamily.gcov.reportsPath
#sonar.python.coverage.reportPaths
#sonar.coverage.jacoco.xmlReportPaths
#sonar.cfamily.threads
#sonar.cfamily.cache.enabled
#sonar.cfamily.cache.path
sonar-project.properties
# must be unique in a given SonarQube instance
sonar.projectKey=my:project
# --- optional properties ---
# defaults to project key
#sonar.projectName=My project
# defaults to 'not provided'
#sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Defaults to .
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment