You must perform the merge before build. If you don't perform the merge, the reported violations will refer to other lines then those in the pull request. The merge can be done with a shell script like this.
echo ---
echo --- Merging from $FROM in $FROMREPO to $TO in $TOREPO
echo ---
git clone $TOREPO
cd *
git reset --hard $TO
git status
git remote add from $FROMREPO
git fetch from
git merge $FROM
git --no-pager log --max-count=10 --graph --abbrev-commit
Your build command here!
With mvn sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.report.export.path=sonar-report.json. Removed in 7.7, see SONAR-11670 but can be retrieved with: curl --silent 'http://sonar-server/api/issues/search?componentKeys=unique-key&resolved=false' \| jq -f sonar-report-builder.jq > sonar-report.json.
-api-token, -at <string> <string>: any string [Required]
-api-token-private <boolean> <boolean>: true or false
Default: true
-comment-only-changed-content, -cocc <boolean> <boolean>: true or false
Default: true
-comment-only-changed-content-context, -coccc <integer> <integer>: 0 to 2,147,483,647
Default: 0
-comment-only-changed-files, -cocf <boolean> True if only changed
files should be commented.
False if all findings should
be commented.
<boolean>: true or false
Default: true
-comment-template <string> https://github.
com/tomasbjerre/violation-comments-lib
<string>: any string
Default:
-create-comment-with-all-single-file-comments, - <boolean>: true or false
ccwasfc <boolean> Default: false
-create-single-file-comments, -csfc <boolean> <boolean>: true or false
Default: true
-gitlab-url, -gu <string> <string>: any string
Default: https://gitlab.com/
-h, --help <argument-to-print-help-for> <argument-to-print-help-for>: an argument to print help for
Default: If no specific parameter is given the whole usage text is given
-ignore-certificate-errors <boolean> <boolean>: true or false
Default: true
-keep-old-comments <boolean> <boolean>: true or false
Default: false
-max-number-of-comments, -mnoc <integer> <integer>: -2,147,483,648 to 2,147,483,647
Default: 2,147,483,647
-mr-iid <string> Example: 1 [Required]
<string>: any string
-project-id, -pi <string> Can be the string or
the number. Like 'tomas.
bjerre85/violations-test' or '2732496'
<string>: any string
Default:
-proxy-password <string> <string>: any string
Default:
-proxy-server <string> <string>: any string
Default:
-proxy-user <string> <string>: any string
Default:
-severity, -s <SEVERITY> Minimum severity level
to report.
<SEVERITY>: {INFO | WARN | ERROR}
Default: INFO
-should-set-wip <boolean> <boolean>: true or false
Default: false
-show-debug-info Please run your
command with this parameter
and supply output when
reporting bugs.
Default: disabled
--violations, -v <string> The violations to look
for. <PARSER> <FOLDER>
<REGEXP PATTERN> <NAME> where
PARSER is one of:
ANDROIDLINT, CHECKSTYLE, CODENARC,
CLANG, CPD, CPPCHECK,
CPPLINT, CSSLINT, FINDBUGS,
FLAKE8, FXCOP, GENDARME, IAR,
JCREPORT, JSHINT, LINT,
KLOCWORK, KOTLINMAVEN,
KOTLINGRADLE, MSCPP, MYPY, GOLINT,
GOOGLEERRORPRONE, PERLCRITIC, PITEST,
PMD, PYDOCSTYLE, PYLINT,
RESHARPER, SBTSCALAC, SIMIAN,
SONAR, STYLECOP, XMLLINT,
YAMLLINT, ZPTLINT, DOCFX, PCLINT
Example: -v "JSHINT"
"." ".*/jshint.xmlquot;
"JSHint" [Supports Multiple occurrences]
<string>: any string
Default: Empty list