Skip to content

Commit 1d13e23

Browse files
committed
Initial
0 parents  commit 1d13e23

File tree

27 files changed

+19339
-0
lines changed

27 files changed

+19339
-0
lines changed

.factorypath

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pom.xml.releaseBackup
2+
release.properties
3+
target
4+
.project
5+
.settings
6+
.classpath
7+
*.class
8+
*.log
9+
*.bak
10+
*~
11+
work*
12+
bin
13+
gradle
14+
gradlew
15+
.gradle
16+
build
17+
.okhttpcache
18+

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: java
2+
jdk:
3+
- openjdk7
4+
- oraclejdk7
5+
- oraclejdk8
6+
before_script:
7+
- mkdir -p ~/.m2
8+
- cp sandbox/settings.xml ~/.m2/settings.xml
9+
script:
10+
- ./build.sh
11+
notifications:
12+
email: false

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Violation Comments to GitLab changelog
2+
Changelog of Violation Comments to GitLab plugin for Jenkins.
3+
## Unreleased
4+
### No issue
5+
6+
**nytt**
7+
8+
9+
[1df54aa8168cdeb](https://github.com/repos/jenkinsci/violation-comments-to-gitlab-plugin/1df54aa8168cdebd79a7b4a2a9e759e57dd62c19) Tomas Bjerre *2017-03-02 19:48:50*
10+
11+

README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Violation Comments to GitLab Plugin
2+
3+
[![Build Status](https://jenkins.ci.cloudbees.com/job/plugins/job/violation-comments-to-gitlab-plugin/badge/icon)](https://jenkins.ci.cloudbees.com/job/plugins/job/violation-comments-to-gitlab-plugin/)
4+
5+
This is a Jenkins plugin for [Violation Comments to GitLab Lib](https://github.com/tomasbjerre/violation-comments-to-gitlab-lib). This plugin will find report files from static code analysis and comment GitLab pull requests with the content.
6+
7+
You can have a look at [violations-test](https://gitlab.com/tomas.bjerre85/violations-test/merge_requests/1) to see what the result may look like.
8+
9+
Available in Jenkins [here](https://wiki.jenkins-ci.org/display/JENKINS/Violation+Comments+to+GitLab+Plugin).
10+
11+
You can get the variables you need from the [GitLab plugin](https://github.com/jenkinsci/gitlab-plugin) or [GitLab Merge Request Builder Plugin](https://github.com/timols/jenkins-gitlab-merge-request-builder-plugin).
12+
13+
It supports:
14+
* [_AndoidLint_](http://developer.android.com/tools/help/lint.html)
15+
* [_Checkstyle_](http://checkstyle.sourceforge.net/)
16+
* [_ESLint_](https://github.com/sindresorhus/grunt-eslint) with `format: 'checkstyle'`.
17+
* [_PHPCS_](https://github.com/squizlabs/PHP_CodeSniffer) with `phpcs api.php --report=checkstyle`.
18+
* [_CLang_](https://clang-analyzer.llvm.org/)
19+
* [_RubyCop_](http://rubocop.readthedocs.io/en/latest/formatters/) with `rubycop -f clang file.rb`
20+
* [_CodeNarc_](http://codenarc.sourceforge.net/)
21+
* [_CPD_](http://pmd.sourceforge.net/pmd-4.3.0/cpd.html)
22+
* [_CPPLint_](https://github.com/theandrewdavis/cpplint)
23+
* [_CPPCheck_](http://cppcheck.sourceforge.net/)
24+
* [_CSSLint_](https://github.com/CSSLint/csslint)
25+
* [_Findbugs_](http://findbugs.sourceforge.net/)
26+
* [_Flake8_](http://flake8.readthedocs.org/en/latest/)
27+
* [_Pep8_](https://github.com/PyCQA/pycodestyle)
28+
* [_Mccabe_](https://pypi.python.org/pypi/mccabe)
29+
* [_PyFlakes_](https://pypi.python.org/pypi/pyflakes)
30+
* [_FxCop_](https://en.wikipedia.org/wiki/FxCop)
31+
* [_Gendarme_](http://www.mono-project.com/docs/tools+libraries/tools/gendarme/)
32+
* [_GoLint_](https://github.com/golang/lint)
33+
* [_GoVet_](https://golang.org/cmd/vet/) Same format as GoLint.
34+
* [_JSHint_](http://jshint.com/)
35+
* _Lint_ A common XML format, used by different linters.
36+
* [_JCReport_](https://github.com/jCoderZ/fawkez/wiki/JcReport)
37+
* [_MyPy_](https://pypi.python.org/pypi/mypy-lang)
38+
* [_PerlCritic_](https://github.com/Perl-Critic)
39+
* [_PiTest_](http://pitest.org/)
40+
* [_PyDocStyle_](https://pypi.python.org/pypi/pydocstyle)
41+
* [_PyLint_](https://www.pylint.org/)
42+
* [_PMD_](https://pmd.github.io/)
43+
* [_PHPPMD_](https://phpmd.org/) with `phpmd api.php xml ruleset.xml`.
44+
* [_ReSharper_](https://www.jetbrains.com/resharper/)
45+
* [_Simian_](http://www.harukizaemon.com/simian/)
46+
* [_StyleCop_](https://stylecop.codeplex.com/)
47+
* [_XMLLint_](http://xmlsoft.org/xmllint.html)
48+
* [_ZPTLint_](https://pypi.python.org/pypi/zptlint)
49+
50+
51+
# Screenshots
52+
53+
![Example comment](https://github.com/jenkinsci/violation-comments-to-gitlab-plugin/blob/master/sandbox/mergerequest-onecomment.png)
54+
55+
## Job DSL Plugin
56+
57+
This plugin can be used with the Job DSL Plugin.
58+
59+
```
60+
job('example') {
61+
publishers {
62+
violationsToGitLabRecorder {
63+
config {
64+
gitLabUrl("https://gitlab.com/")
65+
projectId(123)
66+
mergeRequestId(456)
67+
68+
commentOnlyChangedContent(true)
69+
createCommentWithAllSingleFileComments(true)
70+
71+
useApiToken(true)
72+
apiToken("")
73+
useApiTokenCredentials(false)
74+
apiTokenCredentialsId("id")
75+
apiTokenPrivate(true)
76+
authMethodHeader(true)
77+
ignoreCertificateErrors(true)
78+
79+
violationConfigs {
80+
violationConfig {
81+
reporter("FINDBUGS")
82+
pattern(".*/findbugs/.*\\.xml\$")
83+
}
84+
}
85+
}
86+
}
87+
}
88+
}
89+
```
90+
91+
## Pipeline Plugin
92+
93+
This plugin can be used with the Pipeline Plugin:
94+
95+
```
96+
node {
97+
98+
checkout([
99+
$class: 'GitSCM',
100+
branches: [[ name: '*/master' ]],
101+
doGenerateSubmoduleConfigurations: false,
102+
extensions: [],
103+
submoduleCfg: [],
104+
userRemoteConfigs: [[ url: 'https://gitlab.com/tomas.bjerre85/violations-test.git' ]]
105+
])
106+
107+
sh '''
108+
./gradlew build
109+
'''
110+
111+
step([
112+
$class: 'ViolationsToGitLabRecorder',
113+
config: [
114+
gitLabUrl: 'https://gitlab.com/',
115+
projectId: 123,
116+
mergeRequestId: 456,
117+
118+
commentOnlyChangedContent: true,
119+
createCommentWithAllSingleFileComments: true,
120+
121+
useApiToken: true,
122+
apiToken: '',
123+
useApiTokenCredentials: false,
124+
apiTokenCredentialsId: 'id',
125+
apiTokenPrivate: true,
126+
authMethodHeader: true,
127+
ignoreCertificateErrors: true,
128+
129+
violationConfigs: [
130+
[ pattern: '.*/checkstyle/.*\\.xml$', reporter: 'CHECKSTYLE' ],
131+
[ pattern: '.*/findbugs/.*\\.xml$', reporter: 'FINDBUGS' ],
132+
]
133+
]
134+
])
135+
}
136+
```
137+
138+
# Plugin development
139+
More details on Jenkins plugin development is available [here](https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial).
140+
141+
There is a ```/build.sh``` that will perform a full build and test the plugin. You may have a look at sandbox/settings.xml on how to configure your Maven settings.
142+
143+
A release is created like this. You need to clone from jenkinsci-repo, with https and have username/password in settings.xml.
144+
```
145+
mvn release:prepare release:perform
146+
```

build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
##
4+
## Setup
5+
##
6+
#echo Setting up Maven
7+
#mkdir -p ~/.m2
8+
#[ -f ~/.m2/settings.xml.backup ] || cp ~/.m2/settings.xml ~/.m2/settings.xml.backup
9+
#cp sandbox/settings.xml ~/.m2/settings.xml
10+
11+
##
12+
## Build plugin
13+
##
14+
echo Building plugin
15+
mvn -q package

debug.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
mvnDebug -q hpi:run -Djava.util.logging.config.file=logging.properties
3+

0 commit comments

Comments
 (0)