Conversation
--fixed check style findings.
@@ -0,0 +1,109 @@ | |||
<?xml version="1.0"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a lot of style checks..are there any presets available out there that we could simply reference here? just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 presets available :
http://checkstyle.sourceforge.net/style_configs.html Google and Sun, will check how to include them by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately it is not possible to have 2 configs . Issue is open in style checker :checkstyle/checkstyle#991
String id; | ||
String joke; | ||
List<String> categories; | ||
private String id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't say I like this one: who cares if it's not private? It's just a stupid java bean
api/build.gradle
Outdated
def dir = "${parent.projectDir}/code-analysis/check-style" | ||
toolVersion = '8.2' | ||
configProperties.configDir = dir | ||
configFile = file("$dir/check-style.xml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the default file location instead and just drop this line? I would like to reduce boilerplate configs as much as possible, let's stick with convention over configuration as much as possible please
api/build.gradle
Outdated
@@ -24,10 +24,30 @@ apply plugin: 'org.springframework.boot' | |||
|
|||
apply from: 'dotenv.gradle' | |||
|
|||
apply plugin: 'checkstyle' | |||
apply plugin: 'pmd' | |||
pmdTest.enabled = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In tests we usually have hard coded strings/ magic numbers, and style check fails in such case..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use inline directives to suppress the linting for such cases? tests are also code so we should treat them as such
README.md
Outdated
|
||
#### IntelliJ | ||
|
||
- Edit configurations > "Application" > Add task in "Before launch" section "checkstyleMain pmdMain" and place it as first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that necessary ? can we just use the plugin and be done with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you start using intellij idea Application run/debug then plugin is not executed.. couldn't find how to force it..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay let's think about that. But please remove these instructions from the documentation. its unnecessarily cumbersome
README.md
Outdated
|
||
- Edit configurations > "Application" > Add task in "Before launch" section "checkstyleMain pmdMain" and place it as first | ||
- Additionally you can download "CheckStyle plugin". Then open Settings > Other Settings > Checkstyle. Add path to check-style.xml file | ||
and provide link to check-style folder in "${configDir}". This will display errors in editor, but it wont affect build/run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it won affect build/run
sounds fine by me :) who doesn't love the local build failing due to a missing private modifier?
README.md
Outdated
|
||
#### Gradle | ||
|
||
- As default behaviour it is configured to call "checkstyleMain pmdMain" before "bootRun" task is executed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I like this one, it basically stops me from launching the dev mode unless all my modifiers are private and stuff.. Can we relax this one?
api/build.gradle
Outdated
toolVersion = '8.2' | ||
configProperties.configDir = dir | ||
configFile = file("$dir/check-style.xml") | ||
sourceSets = [] // used to skip tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
api/build.gradle
Outdated
pmd { | ||
toolVersion = '5.8.1' | ||
consoleOutput = true | ||
ruleSetFiles = files("${parent.projectDir}/code-analysis/pmd/pmd.xml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do a convention over configuration with this one as well. I do recall there being a default directory where pmd looks for its configs
</module> | ||
|
||
<module name="Header"> | ||
<property name="header" value="Copyright Swiss Reinsurance Company, Mythenquai 50/60, CH 8022 Zurich. All rights reserved."/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops you did it again
please be careful with this stuff
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> | ||
|
||
<suppressions> | ||
<!--Add exclusion here (e.g <suppress files="JokeResolver.java" checks="MethodLength"/>) --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we trying to teach how to use check-style
here? Please drop all unnecessary config files, thanks!
--removed pmd (only 1 check is really needed, not worth adding by default) --cleanup of checks --updated readme
1: Removed pmd checks (not worth it) |
I do not see a problem with the |
Changed to default location as we discussed offline |
Thanks, looks good to me. |
--added check style
--fixed check style findings.