Use basepom as parent instead of Sonatype OSS #377
Use basepom as parent instead of Sonatype OSS #377
Conversation
Build finished. See https://ci.fabric8.io/job/syndesis-rest-pullreq/599/ for more details. |
Your tests failed on CircleCI See https://circleci.com/gh/syndesisio/syndesis-rest/954?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link for more details. |
1 similar comment
Your tests failed on CircleCI See https://circleci.com/gh/syndesisio/syndesis-rest/954?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link for more details. |
This commit cannot be built See https://jenkins-syndesis-ci.b6ff.rh-idev.openshiftapps.com/job/syndesis-rest/job/PR-377/1/display/redirect for more details. |
Seems like that findbugs doesn't like the generated immutable classes (therefore the build breaks). Actually, I like the idea to apply common practices and enforce some rules, but I wonder whether we should invest energy right now into this if it is not yet clear in which direction syndesis is 'go'ing ? // @jimmidyson |
Yes, my point exactly, to see if this is an area we would like to invest in. Being a fan of the project(s) [basepom, syndesis] I'm biased, and I would like to make this as default, but it comes as a cost.
One thing to note is that basepom is configurable, and has skip properties for every check, so we can bypass findbugs with |
70af94c
to
e223bc6
Compare
This commit cannot be built See https://jenkins-syndesis-ci.b6ff.rh-idev.openshiftapps.com/job/syndesis-rest/job/PR-377/2/display/redirect for more details. |
Your tests failed on CircleCI See https://circleci.com/gh/syndesisio/syndesis-rest/961?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link for more details. |
1 similar comment
Your tests failed on CircleCI See https://circleci.com/gh/syndesisio/syndesis-rest/961?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link for more details. |
Build finished. See https://ci.fabric8.io/job/syndesis-rest-pullreq/608/ for more details. |
This changes the parent POM for the project to basepom[1] and with that brings about a handful of Maven plugin configurations with the ambition to increase the code quality and minimize issues that are caused by misaligned, duplicate or unwanted dependencies. Things of note that are now turned on: - static code checking (findbugs, pmd, checkstyle) - dependency analysis (declared but unused, used but undeclared, version misalignment, duplicate classes and resources) - running tests in parallel and random order - character encodings are set uniformly to UTF-8 (for instance file.encoding when running tests) - JAR manifests contain a wealth of information (versions, git information, like branch, hash...) [1] https://github.com/basepom/basepom
e223bc6
to
7a899ce
Compare
@@ -32,16 +32,28 @@ | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.camel</groupId> | |||
<artifactId>camel-catalog</artifactId> |
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.
Used dependencies need to be declared
@@ -29,7 +29,7 @@ | |||
|
|||
public class ConnectorCatalog { | |||
|
|||
private final static Logger log = LoggerFactory.getLogger(ConnectorCatalog.class); | |||
private static final Logger log = LoggerFactory.getLogger(ConnectorCatalog.class); |
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.
JLS declaration order must be followed
@@ -32,6 +32,16 @@ | |||
<dependencies> | |||
<dependency> | |||
<groupId>io.syndesis</groupId> | |||
<artifactId>core</artifactId> |
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.
Used dependencies need to be declared
@@ -15,9 +15,13 @@ | |||
*/ | |||
package io.syndesis.controllers.integration; | |||
|
|||
import java.util.*; | |||
import java.util.Arrays; |
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.
No stars in imports
This commit cannot be built See https://jenkins-syndesis-ci.b6ff.rh-idev.openshiftapps.com/job/syndesis-rest/job/PR-377/3/display/redirect for more details. |
@@ -34,7 +38,7 @@ | |||
); | |||
} | |||
|
|||
class DemoHandler implements StatusChangeHandler { | |||
static class DemoHandler implements StatusChangeHandler { |
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.
Inner classes that do not reference outer need to be static
@@ -16,8 +16,15 @@ | |||
package io.syndesis.controllers.integration; | |||
|
|||
import java.io.IOException; | |||
import java.util.*; | |||
import java.util.concurrent.*; | |||
import java.util.Date; |
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.
No stars in imports
@@ -48,7 +56,7 @@ | |||
private ExecutorService executor; | |||
private ScheduledExecutorService scheduler; | |||
|
|||
private final static long SCHEDULE_INTERVAL_IN_SECONDS = 60; | |||
private static final long SCHEDULE_INTERVAL_IN_SECONDS = 60; |
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.
JLS declaration order
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 really a fan of enforcing JLS ordering as imo it doesn't add much value and is just nit picking.
@@ -15,9 +15,14 @@ | |||
*/ | |||
package io.syndesis.controllers.integration; | |||
|
|||
import java.util.*; | |||
import java.util.Arrays; |
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.
No stars in imports
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.
Actually I almost never look at imports so don't mind much how they look like. But I'm fine with any import rule as along as IDEA supports it.
@@ -16,12 +16,20 @@ | |||
package io.syndesis.controllers.integration.online; | |||
|
|||
import java.io.IOException; | |||
import java.util.*; | |||
import java.util.ArrayList; |
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.
No stars in imports
@@ -49,7 +57,7 @@ | |||
private final GitHubService gitHubService; | |||
private final ProjectGenerator projectConverter; | |||
|
|||
private final static Logger log = LoggerFactory.getLogger(ActivateHandler.class); | |||
private static final Logger log = LoggerFactory.getLogger(ActivateHandler.class); |
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.
JLS declaration order
@@ -15,14 +15,17 @@ | |||
*/ | |||
package io.syndesis.controllers.integration.online; | |||
|
|||
import java.util.Arrays; |
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.
No stars in imports
@@ -100,16 +100,19 @@ protected boolean reservationCheck(HttpServerExchange exchange) { | |||
responseHeaders.put(new HttpString(CorsHeaders.ACCESS_CONTROL_ALLOW_ORIGIN), origin); | |||
|
|||
String value = requestHeaders.getFirst(CorsHeaders.ACCESS_CONTROL_REQUEST_HEADERS); | |||
if (value != null) | |||
if (value != null) { |
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.
Java != C
@@ -37,6 +47,8 @@ | |||
public class LocalProcessVerifier { | |||
|
|||
private final ProjectGenerator projectGenerator; | |||
|
|||
@SuppressFBWarnings("UWF_NULL_FIELD") | |||
private String localMavenRepoLocation = null; // "/tmp/syndesis-local-mvn-repo"; |
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.
❓ only when debugging? always stays null
?
@@ -164,7 +176,7 @@ private String getConnectorClasspath(Connector connector) throws IOException, In | |||
} | |||
|
|||
private String parseClasspath(InputStream inputStream) throws IOException { | |||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); | |||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); |
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.
charsets, so you don't shoot yourself in the foot
This will be it for the first iteration of this. Please see the comments I provided to help you review. Thanks 🤗 |
This commit cannot be built See https://jenkins-syndesis-ci.b6ff.rh-idev.openshiftapps.com/job/syndesis-rest/job/PR-377/5/display/redirect for more details. |
dcfa8ba
to
73fc73b
Compare
This commit cannot be built See https://jenkins-syndesis-ci.b6ff.rh-idev.openshiftapps.com/job/syndesis-rest/job/PR-377/6/display/redirect for more details. |
This increases the time budget for running individual tests from 30s to 300s in an effort to allow the tests to run on the _internal_ (hosted on openshiftapps.com) Jenkins.
73fc73b
to
c91ed34
Compare
This commit cannot be built See https://jenkins-syndesis-ci.b6ff.rh-idev.openshiftapps.com/job/syndesis-rest/job/PR-377/7/display/redirect for more details. |
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.
Thanks, @zregvart for working on cleaning up the code base. I agree with most of the rules (except when they get too nit-picky lick JLS order enforcement).
BTW, for f-m-p and d-m-p we use a Sonarqube integration in order to achieve something similar.
From my POV this PR looks good and I'm +1 for merging it.
@@ -48,7 +56,7 @@ | |||
private ExecutorService executor; | |||
private ScheduledExecutorService scheduler; | |||
|
|||
private final static long SCHEDULE_INTERVAL_IN_SECONDS = 60; | |||
private static final long SCHEDULE_INTERVAL_IN_SECONDS = 60; |
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 really a fan of enforcing JLS ordering as imo it doesn't add much value and is just nit picking.
@@ -15,9 +15,14 @@ | |||
*/ | |||
package io.syndesis.controllers.integration; | |||
|
|||
import java.util.*; | |||
import java.util.Arrays; |
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.
Actually I almost never look at imports so don't mind much how they look like. But I'm fine with any import rule as along as IDEA supports it.
I don't think that the rules force any import ordering, just forbids usage of star imports. The only concern I have is the |
JLS ordering doesn't refer to the ordering of the imports but the order in which you provide 'public final static ...' modifiers. I always fail in remembering the "proper" order (as its not really important to me). |
On other projects (like Camel) there is a checkstyle rule that the imports need to be sorted in a certain way, I was commenting that this checkstyle configuration doesn't have that...
Yeah, I have those as muscle memory now, and my IDE (sorry Eclipse) fixes those auto magically if I put them out of JLS order, this might be a good alternative for IDEA intellij-plugin-save-actions or built in functionality. In Eclipse I have a radical cleanup on save setup, that will turn ugly unformatted code into code that looks like Juergen Hoeller wrote it :) |
I'm pretty sure that IntelliJ has something like this, too. I only question the value of this rule, which is tedious if it has to be fixed (causing an additional turn around). When I look at a declaration line I always read it from left to right and the order of the modifiers is of no value to me at all. It's just a rule for the rule's sake. But yeah, if we agree on it, I will be a good citizen then of course, too ;-) |
Is this in addition to the productization base pom we use? I thought most of stuff is in there too? |
Not sure if the productization changes parent pom. Some of the stuff is like I think that it is a good thing to have some checks in place (and base-pom provides properties to skip the ones we don't want) before the codebase gets too big, later it will be much more difficult. It will bring about some frustration at first, but it can be tweaked with (subjective) minimal effort, so my (subjective) opinion is that it's worth it. And I'm willing to carry this and and help with any issues that come up. |
retest this please |
I quite like this :) Considering the deprecation warning on https://github.com/sonatype/oss-parents, we should migrate to a different parent, but should we fork basepom into syndesisio org so we can use that as a parent rather than basepom directly? Should be pretty easy to keep up to date as we need to, but gives us the option to diverge if we need to as well. Thoughts @zregvart @rhuss? I'd like to get this resolved and merged today or tomorrow if possible and applied to all our Maven projects. |
@jimmidyson @zregvart I think we should only fork when we indeed require some customization. Otherwise its just more work. But +1 for merging this PR as soon as possible. |
I don't think we would benefit much from our own fork., so I would not fork basepom, it's easy to tweak and override (IMHO), and we should probably just track it and upgrade to newer versions when convenient. |
Pull request approved by @jimmidyson - applying approved label |
Merged - let's see how it goes and tweak as we need to going forward. Thanks @zregvart! |
This is can be contentious. Basepom is a project by one of Maven's most prolific commiters it embodies best practices and, contentiously enough, enforces most of them.
I propose changing Syndesis parent's parent to Basepom. Using Basepom is either hit-or-miss as it can be quite annoying in enforcing the right way of using dependency management and enforcing style checks.
I've used it before and I'm a big fan, but then again I do love to self immolate myself with every check imaginable.
Creating a WIP PR to test the grounds with just a couple of changes done (doesn't build ATM).