├── .github
└── FUNDING.yml
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── _config.yml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── src
└── main
│ ├── java
│ └── se
│ │ └── bjurr
│ │ └── violations
│ │ └── comments
│ │ └── github
│ │ └── plugin
│ │ └── gradle
│ │ ├── ViolationCommentsToGitHubGradlePlugin.java
│ │ ├── ViolationCommentsToGitHubPluginExtension.java
│ │ └── ViolationCommentsToGitHubTask.java
│ └── resources
│ └── META-INF
│ └── gradle-plugins
│ └── se.bjurr.violations.violation-comments-to-github-gradle-plugin.properties
└── violation-comments-to-github-gradle-plugin-example
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── reports
├── checkstyle
└── main.xml
└── findbugs
└── main.xml
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [tomasbjerre]
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .classpath
2 | .project
3 | .settings
4 | generated-src
5 | build
6 | target
7 | bin
8 | temp
9 | .gradle
10 | .couscous
11 | couscous.phar
12 | .okhttpcache
13 | out
14 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: java
3 | jdk:
4 | - openjdk8
5 | script:
6 | - ./gradlew build -i -s
7 | after_script:
8 | - find -name TEST* -exec cat {} \;
9 | notifications:
10 | email: false
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # violation-comments-to-github-gradle-plugin changelog
2 |
3 | Changelog of violation-comments-to-github-gradle-plugin.
4 |
5 | ## 1.70.0 (2023-03-26)
6 |
7 | ### Features
8 |
9 | - stepping violations-lib ([1a18e](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/1a18ec54c878635) Tomas Bjerre)
10 |
11 | ## 1.69.0 (2022-03-27)
12 |
13 | ### Features
14 |
15 | - stepping lib versions ([229f9](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/229f9c930f5a213) Tomas Bjerre)
16 |
17 | ## 1.68.3 (2021-04-04)
18 |
19 | ### Other changes
20 |
21 | **new build script**
22 |
23 |
24 | [f7a34](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/f7a3445ebb2af95) Tomas Bjerre *2021-04-04 15:41:45*
25 |
26 |
27 | ## 1.68.2 (2021-04-04)
28 |
29 | ### Other changes
30 |
31 | **new build script**
32 |
33 |
34 | [57b90](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/57b901f57b314f7) Tomas Bjerre *2021-04-04 15:33:44*
35 |
36 |
37 | ## 1.68.1 (2021-04-04)
38 |
39 | ### Other changes
40 |
41 | **new build script**
42 |
43 |
44 | [a4291](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a42910935accd6c) Tomas Bjerre *2021-04-04 15:18:55*
45 |
46 |
47 | ## 1.67 (2020-09-20)
48 |
49 | ### Other changes
50 |
51 | **violations-lib 1.128**
52 |
53 |
54 | [62dda](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/62dda4b87491fca) Tomas Bjerre *2020-09-20 13:39:35*
55 |
56 |
57 | ## 1.66 (2020-07-05)
58 |
59 | ## 1.65 (2020-04-28)
60 |
61 | ### Other changes
62 |
63 | **Correcting line in single file comments tomasbjerre/violation-comments-to-github-lib#9**
64 |
65 |
66 | [1e6fa](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/1e6faf00063e2ec) Tomas Bjerre *2020-04-28 17:24:31*
67 |
68 |
69 | ## 1.61 (2020-02-03)
70 |
71 | ### Other changes
72 |
73 | **CPPCheckParser with auto closed tags tomasbjerre/violations-lib#82**
74 |
75 |
76 | [fcee3](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/fcee3f1cda5e232) Tomas Bjerre *2020-02-03 16:29:30*
77 |
78 |
79 | ## 1.60 (2020-01-03)
80 |
81 | ### Other changes
82 |
83 | **Add support for sonar issue report formats >= v7.5 tomasbjerre/violations-lib#80**
84 |
85 |
86 | [2c81e](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/2c81e17231f2e8a) Tomas Bjerre *2020-01-03 07:24:09*
87 |
88 | **doc**
89 |
90 |
91 | [da2e1](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/da2e18fe0237398) Tomas Bjerre *2019-10-09 17:00:37*
92 |
93 | **Create FUNDING.yml**
94 |
95 |
96 | [da073](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/da0735c7e1d9528) Tomas Bjerre *2019-09-28 06:57:05*
97 |
98 |
99 | ## 1.59 (2019-08-29)
100 |
101 | ### Other changes
102 |
103 | **Removing newline before fingerprint**
104 |
105 |
106 | [ffd63](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/ffd630e57a4e0fc) Tomas Bjerre *2019-08-29 18:43:12*
107 |
108 |
109 | ## 1.57 (2019-08-03)
110 |
111 | ### Other changes
112 |
113 | **Changing name of JSHINT parser to JSLINT**
114 |
115 |
116 | [4354a](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/4354aba678a964d) Tomas Bjerre *2019-08-03 11:35:07*
117 |
118 |
119 | ## 1.56 (2019-06-16)
120 |
121 | ### Other changes
122 |
123 | **commentOnlyChangedFiles**
124 |
125 |
126 | [c9b6e](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/c9b6e41082c2dfb) Tomas Bjerre *2019-06-16 16:45:21*
127 |
128 |
129 | ## 1.55 (2019-03-31)
130 |
131 | ### Other changes
132 |
133 | **maxNumberOfComments**
134 |
135 |
136 | [ec3d8](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/ec3d84cea483c09) Tomas Bjerre *2019-03-31 16:53:44*
137 |
138 |
139 | ## 1.54 (2019-03-30)
140 |
141 | ### Other changes
142 |
143 | **Correcting Sonar severity**
144 |
145 |
146 | [a614b](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a614bd7e7ef6fc4) Tomas Bjerre *2019-03-30 08:19:36*
147 |
148 |
149 | ## 1.53 (2019-03-23)
150 |
151 | ### Other changes
152 |
153 | **Sonar Report**
154 |
155 |
156 | [76bc2](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/76bc2107098d03e) Tomas Bjerre *2019-03-23 15:13:47*
157 |
158 |
159 | ## 1.52 (2019-03-07)
160 |
161 | ### Other changes
162 |
163 | **golangci-lint**
164 |
165 |
166 | [7ee80](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/7ee80c42b9cd63e) Tomas Bjerre *2019-03-07 16:13:13*
167 |
168 |
169 | ## 1.51 (2019-01-03)
170 |
171 | ### Other changes
172 |
173 | **Correcting AnsibleLint parsing**
174 |
175 |
176 | [292f6](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/292f6340fa32f0d) Tomas Bjerre *2019-01-03 17:50:56*
177 |
178 |
179 | ## 1.50 (2018-10-06)
180 |
181 | ### Other changes
182 |
183 | **Including entire rule in Flake8**
184 |
185 |
186 | [0f109](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/0f109adf282c439) Tomas Bjerre *2018-10-06 07:02:53*
187 |
188 | **Automating reporters in readme**
189 |
190 |
191 | [bd66d](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/bd66d94a59c9878) Tomas Bjerre *2018-09-23 12:04:44*
192 |
193 | **Doc**
194 |
195 |
196 | [cdb07](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/cdb07332758fd91) Tomas Bjerre *2018-09-22 18:23:05*
197 |
198 | **Documenting parsers as a table**
199 |
200 |
201 | [5a0e1](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5a0e1f386f5a217) Tomas Bjerre *2018-09-22 08:43:50*
202 |
203 |
204 | ## 1.49 (2018-09-21)
205 |
206 | ### Other changes
207 |
208 | **Bumping version**
209 |
210 |
211 | [8b763](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/8b763dc9a35f52d) Tomas Bjerre *2018-09-21 00:04:43*
212 |
213 | **Correcting Kotlin parsers**
214 |
215 |
216 | [552a9](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/552a90913eaa510) Tomas Bjerre *2018-09-21 00:02:30*
217 |
218 |
219 | ## 1.47 (2018-09-20)
220 |
221 | ### Other changes
222 |
223 | **Kotlin Maven and Gradle parsers**
224 |
225 |
226 | [a232a](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a232a964a1e3966) Tomas Bjerre *2018-09-20 14:33:49*
227 |
228 |
229 | ## 1.46 (2018-09-18)
230 |
231 | ### Other changes
232 |
233 | **More information in log**
234 |
235 |
236 | [fcb5f](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/fcb5f0272f3deff) Tomas Bjerre *2018-09-18 10:16:46*
237 |
238 |
239 | ## 1.45 (2018-09-17)
240 |
241 | ### Other changes
242 |
243 | **Fix optional rule in YAMLLint**
244 |
245 |
246 | [00e3a](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/00e3af80a7c1d2e) Tomas Bjerre *2018-09-17 13:58:24*
247 |
248 |
249 | ## 1.44 (2018-09-15)
250 |
251 | ### Other changes
252 |
253 | **YAMLLint**
254 |
255 |
256 | [6f51d](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/6f51d7d7558f02c) Tomas Bjerre *2018-09-15 08:20:02*
257 |
258 |
259 | ## 1.43 (2018-09-13)
260 |
261 | ### Other changes
262 |
263 | **Correcting ownerName and CPD**
264 |
265 |
266 | [094b5](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/094b5e3fbe344f4) Tomas Bjerre *2018-09-12 21:03:42*
267 |
268 | **Updating readme with parsers**
269 |
270 |
271 | [8e8d3](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/8e8d31c605d05db) Tomas Bjerre *2018-09-12 17:07:15*
272 |
273 |
274 | ## 1.42 (2018-07-04)
275 |
276 | ### Other changes
277 |
278 | **GCC, ARM GCC and Doxygen**
279 |
280 |
281 | [5f747](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5f747eb9323f60e) Tomas Bjerre *2018-07-04 18:36:39*
282 |
283 |
284 | ## 1.41 (2018-07-04)
285 |
286 | ### Other changes
287 |
288 | **Custom template**
289 |
290 |
291 | [5a793](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5a793ed88ab958c) Tomas Bjerre *2018-07-04 07:41:55*
292 |
293 | **NullAway #33**
294 |
295 |
296 | [8f9ce](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/8f9ceb6ba48122d) Tomas Bjerre *2018-04-14 05:10:11*
297 |
298 |
299 | ## 1.40 (2018-02-13)
300 |
301 | ### Other changes
302 |
303 | **PCLint**
304 |
305 |
306 | [f34e6](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/f34e6fbabb5f045) Tomas Bjerre *2018-02-13 20:03:28*
307 |
308 |
309 | ## 1.39 (2018-02-13)
310 |
311 | ### Other changes
312 |
313 | **PCLint**
314 |
315 |
316 | [9a7a8](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/9a7a88a6c8e3bb5) Tomas Bjerre *2018-02-13 19:28:34*
317 |
318 |
319 | ## 1.38 (2018-01-14)
320 |
321 | ### Other changes
322 |
323 | **Google error-prone**
324 |
325 |
326 | [d5001](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/d5001f3f84ae604) Tomas Bjerre *2018-01-14 12:18:30*
327 |
328 |
329 | ## 1.37 (2017-12-31)
330 |
331 | ### Other changes
332 |
333 | **Relocating to correct Java identifier**
334 |
335 |
336 | [f0075](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/f007508ac8e9791) Tomas Bjerre *2017-12-31 12:04:44*
337 |
338 | **Doc**
339 |
340 |
341 | [22a15](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/22a1544c874edf6) Tomas Bjerre *2017-12-25 20:14:15*
342 |
343 |
344 | ## 1.36 (2017-12-25)
345 |
346 | ### Other changes
347 |
348 | **Fixing encoding issues**
349 |
350 |
351 | [064dd](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/064dd6691978ad5) Tomas Bjerre *2017-12-25 20:11:16*
352 |
353 | **Doc**
354 |
355 |
356 | [e7f8b](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/e7f8b4f68ea125a) Tomas Bjerre *2017-12-22 20:04:43*
357 |
358 |
359 | ## 1.35 (2017-12-22)
360 |
361 | ### Other changes
362 |
363 | **Bumping version to fix faulty release**
364 |
365 |
366 | [06682](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/0668238ea3922c1) Tomas Bjerre *2017-12-22 19:59:18*
367 |
368 | **Doc**
369 |
370 |
371 | [89744](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/8974428ca05637e) Tomas Bjerre *2017-12-22 15:49:51*
372 |
373 |
374 | ## 1.34 (2017-12-22)
375 |
376 | ### Other changes
377 |
378 | **DocFX parsing JSON with Gson, not ScriptEngine**
379 |
380 |
381 | [5c55a](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5c55a1b24553ece) Tomas Bjerre *2017-12-22 12:44:40*
382 |
383 | **Doc**
384 |
385 |
386 | [581e5](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/581e5a4e3099d4a) Tomas Bjerre *2017-12-21 14:56:29*
387 |
388 |
389 | ## 1.33 (2017-12-21)
390 |
391 | ### Other changes
392 |
393 | **DocFX**
394 |
395 |
396 | [a1ddb](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a1ddbe7ac4acefe) Tomas Bjerre *2017-12-21 14:42:21*
397 |
398 | **Doc**
399 |
400 |
401 | [546af](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/546af62a308a519) Tomas Bjerre *2017-12-07 17:21:30*
402 |
403 |
404 | ## 1.32 (2017-12-07)
405 |
406 | ### Other changes
407 |
408 | **Refactoring build scripts**
409 |
410 |
411 | [5cb83](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5cb83d082286b9a) Tomas Bjerre *2017-12-07 16:58:34*
412 |
413 | **Accepting PMD files without ruleset-tag #15**
414 |
415 |
416 | [b942c](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/b942c8ed7951538) Tomas Bjerre *2017-12-07 16:34:43*
417 |
418 | **Doc**
419 |
420 |
421 | [21b24](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/21b244f0b2fcf1b) Tomas Bjerre *2017-10-28 10:53:53*
422 |
423 |
424 | ## 1.31 (2017-10-28)
425 |
426 | ### Other changes
427 |
428 | **Update plugin-publish-plugin**
429 |
430 | * Hiya, I was doing a quick scan of the gradle plugin portal and noticed you were using an old version of the plugin-publish-plugin.
431 | * There was a bug in versions prior to 0.9.7, where artifacts would silently not be pushed into the repo, which means the latest version of your plugin will not work properly when people apply it to their build.
432 | * Upgrading the plugin will fix this, but this will require pushing a new version of your plugin :-/
433 | * Thanks (and sorry about that)
434 |
435 | [6506d](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/6506dab078359e4) Tim Yates *2017-10-23 09:13:04*
436 |
437 | **Doc**
438 |
439 |
440 | [b7a53](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/b7a5394a9f2239a) Tomas Bjerre *2017-10-13 11:47:57*
441 |
442 |
443 | ## 1.30 (2017-10-13)
444 |
445 | ### Other changes
446 |
447 | **Resharper WikiUrl**
448 |
449 |
450 | [38932](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/389321daa17e901) Tomas Bjerre *2017-10-13 11:28:01*
451 |
452 |
453 | ## 1.29 (2017-10-09)
454 |
455 | ### Other changes
456 |
457 | **Added handling for empty IssueType Description attributes for Resharper**
458 |
459 |
460 | [0727e](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/0727e1aff6867ab) Tomas Bjerre *2017-10-09 16:50:56*
461 |
462 | **Doc**
463 |
464 |
465 | [2b32b](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/2b32b49755400aa) Tomas Bjerre *2017-09-02 20:14:02*
466 |
467 |
468 | ## 1.28 (2017-09-02)
469 |
470 | ### Other changes
471 |
472 | **Keeping comments and adjusting checkstyle**
473 |
474 | * Checkstyle now allows empty source attribute.
475 | * Comments can optionaly be kept and not removed when new comments are added.
476 | * Will no longer re-create identical comments.
477 |
478 | [95529](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/955290d9eba1ede) Tomas Bjerre *2017-09-02 12:00:25*
479 |
480 | **doc**
481 |
482 |
483 | [fffb3](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/fffb3176e592ef0) Tomas Bjerre *2017-07-15 10:15:21*
484 |
485 |
486 | ## 1.27 (2017-07-15)
487 |
488 | ### Other changes
489 |
490 | **Violations-lib 1.29 with reporter field**
491 |
492 |
493 | [1b133](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/1b1333d3619486f) Tomas Bjerre *2017-07-15 10:12:31*
494 |
495 | **Updating doc on Infer**
496 |
497 |
498 | [3c1c8](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/3c1c81816836042) Tomas Bjerre *2017-06-23 12:52:01*
499 |
500 | **Doc**
501 |
502 |
503 | [38acf](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/38acf430923b0b3) Tomas Bjerre *2017-06-13 17:59:26*
504 |
505 |
506 | ## 1.26 (2017-04-11)
507 |
508 | ### Other changes
509 |
510 | **URL in Klocwork**
511 |
512 |
513 | [360d7](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/360d76d8594d863) Tomas Bjerre *2017-04-11 18:26:27*
514 |
515 | **doc**
516 |
517 |
518 | [0c164](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/0c164148c3acdaa) Tomas Bjerre *2017-04-10 20:15:11*
519 |
520 |
521 | ## 1.25 (2017-04-10)
522 |
523 | ### Other changes
524 |
525 | **SbtScalac**
526 |
527 |
528 | [5f034](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5f0348ac638cd9e) Tomas Bjerre *2017-04-10 18:27:06*
529 |
530 | **doc**
531 |
532 |
533 | [9d41e](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/9d41e5236355dc8) Tomas Bjerre *2017-03-30 17:51:03*
534 |
535 |
536 | ## 1.24 (2017-03-30)
537 |
538 | ### Other changes
539 |
540 | **Klocwork parser**
541 |
542 |
543 | [bb353](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/bb35325902933ea) Tomas Bjerre *2017-03-30 17:45:12*
544 |
545 | **doc**
546 |
547 |
548 | [02ca1](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/02ca143c3f98532) Tomas Bjerre *2017-03-17 21:36:24*
549 |
550 |
551 | ## 1.23 (2017-03-17)
552 |
553 | ### Other changes
554 |
555 | **Allowing filter comments on severity**
556 |
557 |
558 | [5dc5c](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5dc5c197ee1e030) Tomas Bjerre *2017-03-17 21:15:05*
559 |
560 | **doc**
561 |
562 |
563 | [6fddb](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/6fddb650ec2298b) Tomas Bjerre *2017-02-19 21:43:34*
564 |
565 | **Commenting with file name from server**
566 |
567 |
568 | [19a0b](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/19a0bcf4d777c84) Tomas Bjerre *2017-02-19 21:36:52*
569 |
570 | **doc**
571 |
572 |
573 | [0a486](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/0a486124e967890) Tomas Bjerre *2017-02-18 22:02:28*
574 |
575 |
576 | ## 1.22 (2017-02-18)
577 |
578 | ### Other changes
579 |
580 | **CLang, RubyCop, GoLint, GoVet, PHPMD, PHPCS**
581 |
582 |
583 | [f0abe](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/f0abebc8a55585e) Tomas Bjerre *2017-02-18 21:54:36*
584 |
585 | **doc**
586 |
587 |
588 | [cf226](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/cf2262b611a085b) Tomas Bjerre *2017-02-16 21:04:04*
589 |
590 |
591 | ## 1.21 (2017-02-16)
592 |
593 | ### Other changes
594 |
595 | **Finding findbugsmessages and correcting codenarc**
596 |
597 |
598 | [791e3](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/791e35e32f6e15d) Tomas Bjerre *2017-02-16 20:57:33*
599 |
600 | **Set theme jekyll-theme-slate**
601 |
602 |
603 | [40a45](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/40a4511b6ea8120) Tomas Bjerre *2017-02-07 20:16:36*
604 |
605 |
606 | ## 1.20 (2017-02-06)
607 |
608 | ### Other changes
609 |
610 | **Removing Guava dependency**
611 |
612 |
613 | [b4b51](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/b4b51e1b534b80f) Tomas Bjerre *2017-02-06 18:35:23*
614 |
615 | **doc**
616 |
617 |
618 | [a6381](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a6381ac22710717) Tomas Bjerre *2017-02-06 18:05:38*
619 |
620 |
621 | ## 1.19 (2017-02-06)
622 |
623 | ### Other changes
624 |
625 | **Adding MyPy and PyDocStyle parsers**
626 |
627 |
628 | [90687](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/906878821dd84c6) Tomas Bjerre *2017-02-06 17:50:49*
629 |
630 |
631 | ## 1.18 (2016-11-06)
632 |
633 | ### Other changes
634 |
635 | **Codenarc, Cpd, Gendarme, Jcereport, Simian, ZptLint**
636 |
637 |
638 | [d1f1c](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/d1f1c87ceac44ba) Tomas Bjerre *2016-11-06 07:06:13*
639 |
640 | **doc**
641 |
642 |
643 | [85c83](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/85c8336aa42ea64) Tomas Bjerre *2016-11-01 19:13:02*
644 |
645 |
646 | ## 1.17 (2016-11-01)
647 |
648 | ### Other changes
649 |
650 | **Bugfix, the big comment now includes only changed parts**
651 |
652 |
653 | [e85b2](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/e85b21b7e695e68) Tomas Bjerre *2016-11-01 19:10:31*
654 |
655 | **doc**
656 |
657 |
658 | [06925](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/06925f0374cb678) Tomas Bjerre *2016-10-27 17:28:27*
659 |
660 |
661 | ## 1.16 (2016-10-27)
662 |
663 | ### Other changes
664 |
665 | **Markdown in comments and not commenting unchanged files**
666 |
667 |
668 | [5b4bd](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5b4bd0e6cde92bf) Tomas Bjerre *2016-10-27 17:11:15*
669 |
670 | **doc**
671 |
672 |
673 | [59b49](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/59b49136a8330f0) Tomas Bjerre *2016-10-26 16:03:38*
674 |
675 |
676 | ## 1.15 (2016-10-26)
677 |
678 | ### Other changes
679 |
680 | **Handling CSS Lint reports without line or evidence**
681 |
682 |
683 | [3caaf](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/3caafe43b594a22) Tomas Bjerre *2016-10-26 16:01:54*
684 |
685 | **doc**
686 |
687 |
688 | [7f3ac](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/7f3ace71ae37c0f) Tomas Bjerre *2016-10-25 18:26:36*
689 |
690 |
691 | ## 1.14 (2016-10-25)
692 |
693 | ### Other changes
694 |
695 | **Changing rule format in PyLint to CODE(codeName)**
696 |
697 |
698 | [31a97](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/31a97929faec2e2) Tomas Bjerre *2016-10-25 18:25:02*
699 |
700 |
701 | ## 1.13 (2016-10-24)
702 |
703 | ### Other changes
704 |
705 | **PyLint parser**
706 |
707 |
708 | [8e301](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/8e3017c6c97bbbc) Tomas Bjerre *2016-10-24 17:34:15*
709 |
710 | **doc**
711 |
712 |
713 | [715a7](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/715a73bb6adf5d8) Tomas Bjerre *2016-10-03 17:20:50*
714 |
715 |
716 | ## 1.12 (2016-10-03)
717 |
718 | ### Other changes
719 |
720 | **Supporting StyleCop and fixing FxCop**
721 |
722 |
723 | [ad401](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/ad401decb23e67b) Tomas Bjerre *2016-10-03 17:15:25*
724 |
725 | **doc**
726 |
727 |
728 | [d8e22](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/d8e2235635fdea3) Tomas Bjerre *2016-10-01 13:29:56*
729 |
730 |
731 | ## 1.11 (2016-10-01)
732 |
733 | ### Other changes
734 |
735 | **FXCop**
736 |
737 |
738 | [733ee](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/733ee590012587d) Tomas Bjerre *2016-10-01 12:17:00*
739 |
740 | **doc**
741 |
742 |
743 | [ee244](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/ee2444887ce6cfd) Tomas Bjerre *2016-05-05 05:30:29*
744 |
745 |
746 | ## 1.10 (2016-05-05)
747 |
748 | ### Other changes
749 |
750 | **Doc**
751 |
752 |
753 | [2c9bb](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/2c9bbba76777fe1) Tomas Bjerre *2016-05-05 05:27:49*
754 |
755 | **Update violations-comments-to-github-lib version**
756 |
757 | * Updated to add ANDROIDLINT support
758 |
759 | [02b79](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/02b79902eec8987) panpanini *2016-05-05 04:05:28*
760 |
761 | **doc**
762 |
763 |
764 | [030ce](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/030ce94e63f6cf7) Tomas Bjerre *2016-05-03 18:28:05*
765 |
766 |
767 | ## 1.9 (2016-04-27)
768 |
769 | ### Other changes
770 |
771 | **Andoid lint**
772 |
773 |
774 | [3cc10](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/3cc1017bbca187a) Tomas Bjerre *2016-04-27 06:03:40*
775 |
776 | **Updating example**
777 |
778 |
779 | [56e05](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/56e05fe04aec38b) Tomas Bjerre *2016-04-07 18:02:58*
780 |
781 |
782 | ## 1.8 (2016-04-07)
783 |
784 | ### Other changes
785 |
786 | **Parsing FindBugs xml correctly**
787 |
788 |
789 | [a8dec](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a8dec939cbde98b) Tomas Bjerre *2016-04-07 16:48:07*
790 |
791 | **Updating README.md**
792 |
793 |
794 | [dc1e7](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/dc1e74418247cad) Tomas Bjerre *2016-03-11 16:48:52*
795 |
796 |
797 | ## 1.7 (2016-03-11)
798 |
799 | ### Other changes
800 |
801 | **Updating tags**
802 |
803 |
804 | [d3a71](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/d3a71142631b92b) Tomas Bjerre *2016-03-09 18:16:12*
805 |
806 |
807 | ## 1.6 (2016-03-09)
808 |
809 | ### Other changes
810 |
811 | **Commenting on correct commit in PR**
812 |
813 |
814 | [640a4](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/640a494ee715aa3) Tomas Bjerre *2016-03-09 17:43:04*
815 |
816 | **Updating example**
817 |
818 |
819 | [53340](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/533401920cc44ab) Tomas Bjerre *2016-03-08 17:38:56*
820 |
821 |
822 | ## 1.5 (2016-03-08)
823 |
824 | ### Other changes
825 |
826 | **Optionally comment only changed parts**
827 |
828 |
829 | [01f9d](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/01f9defe1d564ee) Tomas Bjerre *2016-03-08 17:37:38*
830 |
831 | **doc**
832 |
833 |
834 | [54d89](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/54d89fd7a4297cb) Tomas Bjerre *2016-03-06 21:32:04*
835 |
836 |
837 | ## 1.4 (2016-03-06)
838 |
839 | ### Other changes
840 |
841 | **Better logging**
842 |
843 |
844 | [a3881](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a3881df6d8822ab) Tomas Bjerre *2016-03-06 21:24:34*
845 |
846 | **Doc**
847 |
848 |
849 | [b5d28](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/b5d28e53fe40f90) Tomas Bjerre *2016-03-06 21:03:54*
850 |
851 |
852 | ## 1.3 (2016-03-06)
853 |
854 | ### Other changes
855 |
856 | **Adding some tags in pom**
857 |
858 |
859 | [ab8f0](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/ab8f0fb15c4c802) Tomas Bjerre *2016-03-06 17:38:10*
860 |
861 | **Updating example**
862 |
863 |
864 | [a7dfc](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/a7dfc4261a83acc) Tomas Bjerre *2016-03-06 17:11:38*
865 |
866 |
867 | ## 1.2 (2016-03-06)
868 |
869 | ### Other changes
870 |
871 | **Support PerlCritic, XMLLint, CPPLint, Flake8, Resharper and CPPCheck**
872 |
873 |
874 | [f5b24](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/f5b24101aaaf4c7) Tomas Bjerre *2016-03-06 13:59:01*
875 |
876 | **Updating example in README.md**
877 |
878 |
879 | [104ee](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/104eef36b4fe463) Tomas Bjerre *2016-03-05 15:36:26*
880 |
881 |
882 | ## 1.1 (2016-03-04)
883 |
884 | ### Other changes
885 |
886 | **Line number in comments**
887 |
888 |
889 | [12a60](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/12a60df32d4af27) Tomas Bjerre *2016-03-04 19:48:02*
890 |
891 | **1.1 in example**
892 |
893 |
894 | [5889a](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/5889a2813d6639c) Tomas Bjerre *2016-03-04 18:57:30*
895 |
896 |
897 | ## 1.0 (2016-03-04)
898 |
899 | ### Other changes
900 |
901 | **Initial**
902 |
903 |
904 | [809e5](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/commit/809e51cedb050a6) Tomas Bjerre *2016-03-04 18:36:30*
905 |
906 |
907 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2015 Tomas Bjerre
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Violation Comments to GitHub Gradle Plugin
2 |
3 | [](https://maven-badges.herokuapp.com/maven-central/se.bjurr.violations/violation-comments-to-github-gradle-plugin)
4 |
5 |
6 | --------------------
7 | Archived, see motivation here https://github.com/tomasbjerre/violation-comments-to-github-lib
8 | --------------------
9 |
10 |
11 |
12 | This is a Gradle plugin for [Violation Comments to GitHub Lib](https://github.com/tomasbjerre/violation-comments-to-github-lib).
13 |
14 | It can be used in Travis, or any other build server, to read results from static code analysis and comment pull requests in GitHub with them.
15 |
16 | The merge must be performed in order for the commented lines in the PR to match the lines reported by the analysis tools!
17 |
18 | Example of supported reports are available [here](https://github.com/tomasbjerre/violations-lib/tree/master/src/test/resources).
19 |
20 | A number of **parsers** have been implemented. Some **parsers** can parse output from several **reporters**.
21 |
22 | | Reporter | Parser | Notes
23 | | --- | --- | ---
24 | | [_ARM-GCC_](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm) | `CLANG` |
25 | | [_AndroidLint_](http://developer.android.com/tools/help/lint.html) | `ANDROIDLINT` |
26 | | [_Ansible-Later_](https://github.com/thegeeklab/ansible-later) | `ANSIBLELATER` | With `json` format
27 | | [_AnsibleLint_](https://github.com/willthames/ansible-lint) | `FLAKE8` | With `-p`
28 | | [_Bandit_](https://github.com/PyCQA/bandit) | `CLANG` | With `bandit -r examples/ -f custom -o bandit.out --msg-template "{abspath}:{line}: {severity}: {test_id}: {msg}"`
29 | | [_CLang_](https://clang-analyzer.llvm.org/) | `CLANG` |
30 | | [_CPD_](http://pmd.sourceforge.net/pmd-4.3.0/cpd.html) | `CPD` |
31 | | [_CPPCheck_](http://cppcheck.sourceforge.net/) | `CPPCHECK` | With `cppcheck test.cpp --output-file=cppcheck.xml --xml`
32 | | [_CPPLint_](https://github.com/theandrewdavis/cpplint) | `CPPLINT` |
33 | | [_CSSLint_](https://github.com/CSSLint/csslint) | `CSSLINT` |
34 | | [_Checkstyle_](http://checkstyle.sourceforge.net/) | `CHECKSTYLE` |
35 | | [_CloudFormation Linter_](https://github.com/aws-cloudformation/cfn-lint) | `JUNIT` | `cfn-lint . -f junit --output-file report-junit.xml`
36 | | [_CodeClimate_](https://codeclimate.com/) | `CODECLIMATE` |
37 | | [_CodeNarc_](http://codenarc.sourceforge.net/) | `CODENARC` |
38 | | [_Dart_](https://dart.dev/) | `MACHINE` | With `dart analyze --format=machine`
39 | | [_Dependency Check_](https://jeremylong.github.io/DependencyCheck/) | `SARIF` | Using `--format SARIF`
40 | | [_Detekt_](https://github.com/arturbosch/detekt) | `CHECKSTYLE` | With `--output-format xml`.
41 | | [_DocFX_](http://dotnet.github.io/docfx/) | `DOCFX` |
42 | | [_Doxygen_](https://www.stack.nl/~dimitri/doxygen/) | `CLANG` |
43 | | [_ERB_](https://www.puppetcookbook.com/posts/erb-template-validation.html) | `CLANG` | With `erb -P -x -T '-' "${it}" \| ruby -c 2>&1 >/dev/null \| grep '^-' \| sed -E 's/^-([a-zA-Z0-9:]+)/${filename}\1 ERROR:/p' > erbfiles.out`.
44 | | [_ESLint_](https://github.com/sindresorhus/grunt-eslint) | `CHECKSTYLE` | With `format: 'checkstyle'`.
45 | | [_Findbugs_](http://findbugs.sourceforge.net/) | `FINDBUGS` |
46 | | [_Flake8_](http://flake8.readthedocs.org/en/latest/) | `FLAKE8` |
47 | | [_FxCop_](https://en.wikipedia.org/wiki/FxCop) | `FXCOP` |
48 | | [_GCC_](https://gcc.gnu.org/) | `CLANG` |
49 | | [_GHS_](https://www.ghs.com/) | `GHS` |
50 | | [_Gendarme_](http://www.mono-project.com/docs/tools+libraries/tools/gendarme/) | `GENDARME` |
51 | | [_Generic reporter_]() | `GENERIC` | Will create one single violation with all the content as message.
52 | | [_GoLint_](https://github.com/golang/lint) | `GOLINT` |
53 | | [_GoVet_](https://golang.org/cmd/vet/) | `GOLINT` | Same format as GoLint.
54 | | [_GolangCI-Lint_](https://github.com/golangci/golangci-lint/) | `CHECKSTYLE` | With `--out-format=checkstyle`.
55 | | [_GoogleErrorProne_](https://github.com/google/error-prone) | `GOOGLEERRORPRONE` |
56 | | [_HadoLint_](https://github.com/hadolint/hadolint/) | `CHECKSTYLE` | With `-f checkstyle`
57 | | [_IAR_](https://www.iar.com/iar-embedded-workbench/) | `IAR` | With `--no_wrap_diagnostics`
58 | | [_Infer_](http://fbinfer.com/) | `PMD` | Facebook Infer. With `--pmd-xml`.
59 | | [_JACOCO_](https://www.jacoco.org/) | `JACOCO` |
60 | | [_JCReport_](https://github.com/jCoderZ/fawkez/wiki/JcReport) | `JCREPORT` |
61 | | [_JSHint_](http://jshint.com/) | `JSLINT` | With `--reporter=jslint` or the CHECKSTYLE parser with `--reporter=checkstyle`
62 | | [_JUnit_](https://junit.org/junit4/) | `JUNIT` | It only contains the failures.
63 | | [_KTLint_](https://github.com/shyiko/ktlint) | `CHECKSTYLE` |
64 | | [_Klocwork_](http://www.klocwork.com/products-services/klocwork/static-code-analysis) | `KLOCWORK` |
65 | | [_KotlinGradle_](https://github.com/JetBrains/kotlin) | `KOTLINGRADLE` | Output from Kotlin Gradle Plugin.
66 | | [_KotlinMaven_](https://github.com/JetBrains/kotlin) | `KOTLINMAVEN` | Output from Kotlin Maven Plugin.
67 | | [_Lint_]() | `LINT` | A common XML format, used by different linters.
68 | | [_MSBuildLog_](https://docs.microsoft.com/en-us/visualstudio/msbuild/obtaining-build-logs-with-msbuild?view=vs-2019) | `MSBULDLOG` | With `-fileLogger` use `.*msbuild\\.log$` as pattern or `-fl -flp:logfile=MyProjectOutput.log;verbosity=diagnostic` for a custom output filename
69 | | [_MSCpp_](https://visualstudio.microsoft.com/vs/features/cplusplus/) | `MSCPP` |
70 | | [_Mccabe_](https://pypi.python.org/pypi/mccabe) | `FLAKE8` |
71 | | [_MyPy_](https://pypi.python.org/pypi/mypy-lang) | `MYPY` |
72 | | [_NullAway_](https://github.com/uber/NullAway) | `GOOGLEERRORPRONE` | Same format as Google Error Prone.
73 | | [_PCLint_](http://www.gimpel.com/html/pcl.htm) | `PCLINT` | PC-Lint using the same output format as the Jenkins warnings plugin, [_details here_](https://wiki.jenkins.io/display/JENKINS/PcLint+options)
74 | | [_PHPCS_](https://github.com/squizlabs/PHP_CodeSniffer) | `CHECKSTYLE` | With `phpcs api.php --report=checkstyle`.
75 | | [_PHPPMD_](https://phpmd.org/) | `PMD` | With `phpmd api.php xml ruleset.xml`.
76 | | [_PMD_](https://pmd.github.io/) | `PMD` |
77 | | [_Pep8_](https://github.com/PyCQA/pycodestyle) | `FLAKE8` |
78 | | [_PerlCritic_](https://github.com/Perl-Critic) | `PERLCRITIC` |
79 | | [_PiTest_](http://pitest.org/) | `PITEST` |
80 | | [_ProtoLint_](https://github.com/yoheimuta/protolint) | `PROTOLINT` |
81 | | [_Puppet-Lint_](http://puppet-lint.com/) | `CLANG` | With `-log-format %{fullpath}:%{line}:%{column}: %{kind}: %{message}`
82 | | [_PyDocStyle_](https://pypi.python.org/pypi/pydocstyle) | `PYDOCSTYLE` |
83 | | [_PyFlakes_](https://pypi.python.org/pypi/pyflakes) | `FLAKE8` |
84 | | [_PyLint_](https://www.pylint.org/) | `PYLINT` | With `pylint --output-format=parseable`.
85 | | [_ReSharper_](https://www.jetbrains.com/resharper/) | `RESHARPER` |
86 | | [_RubyCop_](http://rubocop.readthedocs.io/en/latest/formatters/) | `CLANG` | With `rubycop -f clang file.rb`
87 | | [_SARIF_](https://github.com/oasis-tcs/sarif-spec) | `SARIF` | v2.x. Microsoft Visual C# can generate it with `ErrorLog="BuildErrors.sarif,version=2"`.
88 | | [_SbtScalac_](http://www.scala-sbt.org/) | `SBTSCALAC` |
89 | | [_Scalastyle_](http://www.scalastyle.org/) | `CHECKSTYLE` |
90 | | [_Semgrep_](https://semgrep.dev/) | `SEMGREP` | With `--json`.
91 | | [_Simian_](http://www.harukizaemon.com/simian/) | `SIMIAN` |
92 | | [_Sonar_](https://www.sonarqube.org/) | `SONAR` | With `mvn sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.report.export.path=sonar-report.json`. Removed in 7.7, see [SONAR-11670](https://jira.sonarsource.com/browse/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`.
93 | | [_Spotbugs_](https://spotbugs.github.io/) | `FINDBUGS` |
94 | | [_StyleCop_](https://stylecop.codeplex.com/) | `STYLECOP` |
95 | | [_SwiftLint_](https://github.com/realm/SwiftLint) | `CHECKSTYLE` | With `--reporter checkstyle`.
96 | | [_TSLint_](https://palantir.github.io/tslint/usage/cli/) | `CHECKSTYLE` | With `-t checkstyle`
97 | | [_Valgrind_](https://valgrind.org/) | `VALGRIND` | With `--xml=yes`.
98 | | [_XMLLint_](http://xmlsoft.org/xmllint.html) | `XMLLINT` |
99 | | [_XUnit_](https://xunit.net/) | `XUNIT` | It only contains the failures.
100 | | [_YAMLLint_](https://yamllint.readthedocs.io/en/stable/index.html) | `YAMLLINT` | With `-f parsable`
101 | | [_ZPTLint_](https://pypi.python.org/pypi/zptlint) | `ZPTLINT` |
102 |
103 | 51 parsers and 78 reporters.
104 |
105 | Missing a format? Open an issue [here](https://github.com/tomasbjerre/violations-lib/issues)!
106 |
107 | ## Usage ##
108 | There is a running example [here](https://github.com/tomasbjerre/violation-comments-to-github-gradle-plugin/tree/master/violation-comments-to-github-gradle-plugin-example).
109 |
110 | Here is and example:
111 |
112 | ```
113 | buildscript {
114 | repositories {
115 | maven {
116 | url "https://plugins.gradle.org/m2/"
117 | }
118 | }
119 | dependencies {
120 | classpath "se.bjurr.violations:violation-comments-to-github-gradle-plugin:X"
121 | }
122 | }
123 |
124 | apply plugin: "se.bjurr.violations.violation-comments-to-github-gradle-plugin"
125 |
126 | task violationCommentsToGitHub(type: se.bjurr.violations.comments.github.plugin.gradle.ViolationCommentsToGitHubTask) {
127 | repositoryOwner = "tomasbjerre";
128 | repositoryName = "violations-test"
129 | pullRequestId = System.properties['GITHUB_PULLREQUESTID']
130 | username = System.properties['GITHUB_USERNAME']
131 | password = System.properties['GITHUB_PASSWORD']
132 | oAuth2Token = System.properties['GITHUB_OAUTH2TOKEN']
133 | gitHubUrl = "https://api.github.com/"
134 | createCommentWithAllSingleFileComments = false
135 | createSingleFileComments = true
136 | commentOnlyChangedContent = true
137 | minSeverity = se.bjurr.violations.lib.model.SEVERITY.INFO //ERROR, INFO, WARN
138 | maxNumberOfViolations: 99999
139 | commentTemplate = """
140 | **Reporter**: {{violation.reporter}}{{#violation.rule}}
141 |
142 | **Rule**: {{violation.rule}}{{/violation.rule}}
143 | **Severity**: {{violation.severity}}
144 | **File**: {{violation.file}} L{{violation.startLine}}{{#violation.source}}
145 |
146 | **Source**: {{violation.source}}{{/violation.source}}
147 |
148 | {{violation.message}}
149 | """
150 | violations = [
151 | ["FINDBUGS", ".", ".*/findbugs/.*\\.xml\$", "Findbugs"],
152 | ["PMD", ".", ".*/pmd/.*\\.xml\$", "PMD"],
153 | ["CHECKSTYLE", ".", ".*/checkstyle/.*\\.xml\$", "Checkstyle"],
154 | ["JSHINT", ".", ".*/jshint/.*\\.xml\$", "JSHint"],
155 | ["CSSLINT", ".", ".*/csslint/.*\\.xml\$", "CssLint"]
156 | ]
157 | }
158 | ```
159 |
160 | To send violations, just run:
161 | ```
162 | ./gradlew violationCommentsToGitHub -DGITHUB_PULLREQUESTID=$GITHUB_PULL_REQUEST -DGITHUB_USERNAME=... -DGITHUB_PASSWORD=...
163 | ```
164 |
165 | Or if you want to use OAuth2:
166 | ```
167 | ./gradlew violationCommentsToGitHub -DGITHUB_PULLREQUESTID=$TRAVIS_PULL_REQUEST -DGITHUB_OAUTH2TOKEN=$GITHUB_OAUTH2TOKEN
168 | ```
169 |
170 | You may also have a look at [Violations Lib](https://github.com/tomasbjerre/violations-lib).
171 |
172 | ## Developer instructions
173 |
174 | To build the code you need to run `build.sh` in root of repo. You may also have a look at `.travis.yml`.
175 |
176 | To do a release you need to do `./gradlew release -Dgradle.publish.key=... -Dgradle.publish.secret=...` and release the artifact from [staging](https://oss.sonatype.org/#stagingRepositories). More information [here](http://central.sonatype.org/pages/releasing-the-deployment.html).
177 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-slate
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | buildscript {
4 | repositories {
5 | mavenCentral()
6 | mavenLocal()
7 | }
8 | dependencies {
9 | classpath 'se.bjurr.gradle:gradle-scripts:2.+'
10 | }
11 | }
12 | project.ext.buildConfig = [
13 | repoType: "GRADLE",
14 | gradlePlugin: [
15 | tags: ['violation', 'static code analysis', 'Checkstyle', 'CPPLint', 'CPPCheck', 'CSSLint', 'Findbugs', 'Flake8', 'PyLint', 'Pep8', 'Mccabe', 'PyFlakes', 'JSHint', 'Lint', 'PerlCritic', 'PMD', 'ReSharper', 'XMLLint']
16 | ],
17 | violations: [
18 | updateReadme: true
19 | ]
20 | ]
21 | apply from: project.buildscript.classLoader.getResource('main.gradle').toURI()
22 |
23 |
24 | dependencies {
25 | implementation 'se.bjurr.violations:violation-comments-to-github-lib:1.83.1'
26 | implementation 'se.bjurr.violations:violations-lib:1.156.3'
27 | }
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #Sun Mar 26 16:22:23 CEST 2023
2 | version=1.70.0
3 | description=Gradle plugin that will comment GitHub pull requests with results from static code analysis
4 | group=se.bjurr.violations
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomasbjerre/violation-comments-to-github-gradle-plugin/b6ebe9f2e63b3f38461f821ae476351cf6bff7cf/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/src/main/java/se/bjurr/violations/comments/github/plugin/gradle/ViolationCommentsToGitHubGradlePlugin.java:
--------------------------------------------------------------------------------
1 | package se.bjurr.violations.comments.github.plugin.gradle;
2 |
3 | import org.gradle.api.Plugin;
4 | import org.gradle.api.Project;
5 |
6 | public class ViolationCommentsToGitHubGradlePlugin implements Plugin {
7 | @Override
8 | public void apply(Project target) {
9 | target
10 | .getExtensions()
11 | .create("violationCommentsToGitHubPlugin", ViolationCommentsToGitHubPluginExtension.class);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/se/bjurr/violations/comments/github/plugin/gradle/ViolationCommentsToGitHubPluginExtension.java:
--------------------------------------------------------------------------------
1 | package se.bjurr.violations.comments.github.plugin.gradle;
2 |
3 | public class ViolationCommentsToGitHubPluginExtension {}
4 |
--------------------------------------------------------------------------------
/src/main/java/se/bjurr/violations/comments/github/plugin/gradle/ViolationCommentsToGitHubTask.java:
--------------------------------------------------------------------------------
1 | package se.bjurr.violations.comments.github.plugin.gradle;
2 |
3 | import static se.bjurr.violations.comments.github.lib.ViolationCommentsToGitHubApi.violationCommentsToGitHubApi;
4 | import static se.bjurr.violations.lib.ViolationsApi.violationsApi;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 | import java.util.Set;
9 | import java.util.TreeSet;
10 | import java.util.logging.Level;
11 | import org.gradle.api.DefaultTask;
12 | import org.gradle.api.logging.LogLevel;
13 | import org.gradle.api.tasks.TaskAction;
14 | import org.gradle.api.tasks.TaskExecutionException;
15 | import se.bjurr.violations.lib.ViolationsLogger;
16 | import se.bjurr.violations.lib.model.SEVERITY;
17 | import se.bjurr.violations.lib.model.Violation;
18 | import se.bjurr.violations.lib.reports.Parser;
19 | import se.bjurr.violations.lib.util.Filtering;
20 |
21 | public class ViolationCommentsToGitHubTask extends DefaultTask {
22 |
23 | private String repositoryOwner;
24 | private String repositoryName;
25 | /**
26 | * Travis will define TRAVIS_PULL_REQUEST as "false" if not a PR, and an integer if a PR. Having
27 | * this as String makes life easier =)
28 | */
29 | private String pullRequestId;
30 |
31 | private String oAuth2Token;
32 | private String username;
33 | private String password;
34 | private String gitHubUrl;
35 | private List> violations = new ArrayList<>();
36 | private boolean createCommentWithAllSingleFileComments = false;
37 | private boolean createSingleFileComments = true;
38 | private boolean commentOnlyChangedContent = true;
39 | private boolean commentOnlyChangedFiles = true;
40 | private SEVERITY minSeverity;
41 | private boolean keepOldComments;
42 | private String commentTemplate;
43 | private Integer maxNumberOfViolations;
44 |
45 | public void setCommentOnlyChangedFiles(final boolean commentOnlyChangedFiles) {
46 | this.commentOnlyChangedFiles = commentOnlyChangedFiles;
47 | }
48 |
49 | public void setMaxNumberOfViolations(final Integer maxNumberOfViolations) {
50 | this.maxNumberOfViolations = maxNumberOfViolations;
51 | }
52 |
53 | public void setKeepOldComments(final boolean keepOldComments) {
54 | this.keepOldComments = keepOldComments;
55 | }
56 |
57 | public void setCreateCommentWithAllSingleFileComments(
58 | final boolean createCommentWithAllSingleFileComments) {
59 | this.createCommentWithAllSingleFileComments = createCommentWithAllSingleFileComments;
60 | }
61 |
62 | public void setCreateSingleFileComments(final boolean createSingleFileComments) {
63 | this.createSingleFileComments = createSingleFileComments;
64 | }
65 |
66 | public void setCommentOnlyChangedContent(final boolean commentOnlyChangedContent) {
67 | this.commentOnlyChangedContent = commentOnlyChangedContent;
68 | }
69 |
70 | public void setGitHubUrl(final String gitHubUrl) {
71 | this.gitHubUrl = gitHubUrl;
72 | }
73 |
74 | public void setRepositoryName(final String repositoryName) {
75 | this.repositoryName = repositoryName;
76 | }
77 |
78 | public void setRepositoryOwner(final String repositoryOwner) {
79 | this.repositoryOwner = repositoryOwner;
80 | }
81 |
82 | public void setPullRequestId(final String pullRequestId) {
83 | this.pullRequestId = pullRequestId;
84 | }
85 |
86 | public void setViolations(final List> violations) {
87 | this.violations = violations;
88 | }
89 |
90 | public void setoAuth2Token(final String oAuth2Token) {
91 | this.oAuth2Token = oAuth2Token;
92 | }
93 |
94 | public void setUsername(final String username) {
95 | this.username = username;
96 | }
97 |
98 | public void setPassword(final String password) {
99 | this.password = password;
100 | }
101 |
102 | public void setMinSeverity(final SEVERITY minSeverity) {
103 | this.minSeverity = minSeverity;
104 | }
105 |
106 | public void setCommentTemplate(final String commentTemplate) {
107 | this.commentTemplate = commentTemplate;
108 | }
109 |
110 | @TaskAction
111 | public void gitChangelogPluginTasks() throws TaskExecutionException {
112 | this.getProject().getExtensions().findByType(ViolationCommentsToGitHubPluginExtension.class);
113 | if (this.pullRequestId == null || this.pullRequestId.equalsIgnoreCase("false")) {
114 | this.getLogger()
115 | .info("No pull request id defined, will not send violation comments to GitHub.");
116 | return;
117 | }
118 | final Integer pullRequestIdInt = Integer.valueOf(this.pullRequestId);
119 | if (this.oAuth2Token != null) {
120 | this.getLogger().info("Using OAuth2Token");
121 | } else if (this.username != null && this.password != null) {
122 | this.getLogger()
123 | .info("Using username/password: " + this.username.substring(0, 1) + ".../*********");
124 | } else {
125 | this.getLogger()
126 | .error(
127 | "No OAuth2 token and no username/email specified. Will not comment any pull request.");
128 | return;
129 | }
130 |
131 | this.getLogger()
132 | .info(
133 | "Will comment PR "
134 | + this.repositoryOwner
135 | + "/"
136 | + this.repositoryName
137 | + "/"
138 | + this.pullRequestId
139 | + " on "
140 | + this.gitHubUrl);
141 |
142 | final ViolationsLogger violationsLogger =
143 | new ViolationsLogger() {
144 | private LogLevel toGradleLogLevel(final Level level) {
145 | LogLevel gradleLevel = LogLevel.INFO;
146 | if (level == Level.FINE) {
147 | gradleLevel = LogLevel.DEBUG;
148 | } else if (level == Level.SEVERE) {
149 | gradleLevel = LogLevel.ERROR;
150 | } else if (level == Level.WARNING) {
151 | gradleLevel = LogLevel.WARN;
152 | }
153 | return gradleLevel;
154 | }
155 |
156 | @Override
157 | public void log(final Level level, final String string) {
158 | ViolationCommentsToGitHubTask.this
159 | .getLogger()
160 | .log(this.toGradleLogLevel(level), string);
161 | }
162 |
163 | @Override
164 | public void log(final Level level, final String string, final Throwable t) {
165 | ViolationCommentsToGitHubTask.this
166 | .getLogger()
167 | .log(this.toGradleLogLevel(level), string, t);
168 | }
169 | };
170 |
171 | Set allParsedViolations = new TreeSet<>();
172 | for (final List configuredViolation : this.violations) {
173 | final String reporter = configuredViolation.size() >= 4 ? configuredViolation.get(3) : null;
174 | final Set parsedViolations =
175 | violationsApi() //
176 | .withViolationsLogger(violationsLogger) //
177 | .findAll(Parser.valueOf(configuredViolation.get(0))) //
178 | .inFolder(configuredViolation.get(1)) //
179 | .withPattern(configuredViolation.get(2)) //
180 | .withReporter(reporter) //
181 | .violations();
182 | if (this.minSeverity != null) {
183 | allParsedViolations = Filtering.withAtLEastSeverity(allParsedViolations, this.minSeverity);
184 | }
185 | allParsedViolations.addAll(parsedViolations);
186 | }
187 |
188 | try {
189 | violationCommentsToGitHubApi()
190 | .withViolationsLogger(violationsLogger)
191 | .withoAuth2Token(this.oAuth2Token)
192 | .withUsername(this.username)
193 | .withPassword(this.password)
194 | .withPullRequestId(pullRequestIdInt)
195 | .withRepositoryName(this.repositoryName)
196 | .withRepositoryOwner(this.repositoryOwner)
197 | .withGitHubUrl(this.gitHubUrl)
198 | .withViolations(allParsedViolations)
199 | .withCreateCommentWithAllSingleFileComments(
200 | this.createCommentWithAllSingleFileComments) //
201 | .withCreateSingleFileComments(this.createSingleFileComments) //
202 | .withCommentOnlyChangedContent(this.commentOnlyChangedContent) //
203 | .withCommentOnlyChangedFiles(this.commentOnlyChangedFiles) //
204 | .withKeepOldComments(this.keepOldComments) //
205 | .withCommentTemplate(this.commentTemplate) //
206 | .withMaxNumberOfViolations(this.maxNumberOfViolations) //
207 | .toPullRequest();
208 | } catch (final Exception e) {
209 | this.getLogger().error("", e);
210 | }
211 | }
212 | }
213 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/gradle-plugins/se.bjurr.violations.violation-comments-to-github-gradle-plugin.properties:
--------------------------------------------------------------------------------
1 | implementation-class=se.bjurr.violations.comments.github.plugin.gradle.ViolationCommentsToGitHubGradlePlugin
2 |
--------------------------------------------------------------------------------
/violation-comments-to-github-gradle-plugin-example/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenLocal()
4 | mavenCentral()
5 | }
6 |
7 | dependencies {
8 | classpath "se.bjurr.violations:violation-comments-to-github-gradle-plugin:latest.integration"
9 | }
10 | }
11 |
12 | /**
13 | * When running in Travis, you may add custom environment variable GITHUB_OAUTH2TOKEN and do something like:
14 | * ./gradlew violationCommentsToGitHub -DGITHUB_PULLREQUESTID=$TRAVIS_PULL_REQUEST -DGITHUB_OAUTH2TOKEN=$GITHUB_OAUTH2TOKEN
15 | * Or define username/password variables:
16 | * ./gradlew violationCommentsToGitHub -DGITHUB_PULLREQUESTID=$TRAVIS_PULL_REQUEST -DGITHUB_USERNAME=$GITHUB_USERNAME -DGITHUB_PASSWORD=$GITHUB_PASSWORD
17 | */
18 | apply plugin: "se.bjurr.violations.violation-comments-to-github-gradle-plugin"
19 | task violationCommentsToGitHub(type: se.bjurr.violations.comments.github.plugin.gradle.ViolationCommentsToGitHubTask) {
20 | repositoryOwner = "tomasbjerre";
21 | repositoryName = "violations-test"
22 | pullRequestId = System.properties['GITHUB_PULLREQUESTID']
23 | username = System.properties['GITHUB_USERNAME']
24 | password = System.properties['GITHUB_PASSWORD']
25 | oAuth2Token = System.properties['GITHUB_OAUTH2TOKEN']
26 | gitHubUrl = "https://api.github.com/"
27 | createCommentWithAllSingleFileComments = true
28 | createSingleFileComments = true
29 | commentOnlyChangedContent = true
30 | minSeverity = se.bjurr.violations.lib.model.SEVERITY.INFO //ERROR, INFO, WARN
31 | keepOldComments = false
32 | commentTemplate = """
33 | **Reporter**: {{violation.reporter}}{{#violation.rule}}
34 |
35 | **Rule**: {{violation.rule}}{{/violation.rule}}
36 | **Severity**: {{violation.severity}}
37 | **File**: {{violation.file}} L{{violation.startLine}}{{#violation.source}}
38 |
39 | **Source**: {{violation.source}}{{/violation.source}}
40 |
41 | {{violation.message}}
42 | """
43 | violations = [
44 | ["FINDBUGS", ".", ".*/findbugs/.*\\.xml\$", "Findbugs"],
45 | ["PMD", ".", ".*/pmd/.*\\.xml\$", "PMD"],
46 | ["CHECKSTYLE", ".", ".*/checkstyle/.*\\.xml\$", "Checkstyle"],
47 | ["JSLINT", ".", ".*/jshint/.*\\.xml\$", "JSHint"],
48 | ["CSSLINT", ".", ".*/csslint/.*\\.xml\$", "CssLint"]
49 | ]
50 | }
51 |
--------------------------------------------------------------------------------
/violation-comments-to-github-gradle-plugin-example/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tomasbjerre/violation-comments-to-github-gradle-plugin/b6ebe9f2e63b3f38461f821ae476351cf6bff7cf/violation-comments-to-github-gradle-plugin-example/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/violation-comments-to-github-gradle-plugin-example/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Oct 18 08:40:15 CEST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
7 |
--------------------------------------------------------------------------------
/violation-comments-to-github-gradle-plugin-example/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >&-
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >&-
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/violation-comments-to-github-gradle-plugin-example/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/violation-comments-to-github-gradle-plugin-example/reports/checkstyle/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/violation-comments-to-github-gradle-plugin-example/reports/findbugs/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | /home/bjerre/workspace/violations-test/build/classes/main/se/bjurr/violations/lib/example/MyClass.class
6 | /home/bjerre/workspace/violations-test/build/classes/main/se/bjurr/violations/lib/example/OtherClass.class
7 | /home/bjerre/workspace/violations-test/build/classes/main/se/bjurr/violations/lib/example/CopyOfMyClass.class
8 | /home/bjerre/workspace/violations-test/src/main/java/se/bjurr/violations/lib/example/OtherClass.java
9 | /home/bjerre/workspace/violations-test/src/main/java/se/bjurr/violations/lib/example/MyClass.java
10 | /home/bjerre/workspace/violations-test/src/main/java/se/bjurr/violations/lib/example/CopyOfMyClass.java
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
--------------------------------------------------------------------------------