Skip to content

#2449 bump maven-checkstyle-plugin from 3.1.0 to 3.2.0 + resolve chec…#2464

Merged
iluwatar merged 18 commits into
iluwatar:masterfrom
rahul-raj:master
Feb 4, 2023
Merged

#2449 bump maven-checkstyle-plugin from 3.1.0 to 3.2.0 + resolve chec…#2464
iluwatar merged 18 commits into
iluwatar:masterfrom
rahul-raj:master

Conversation

@rahul-raj
Copy link
Copy Markdown
Contributor

@rahul-raj rahul-raj commented Jan 28, 2023

The intent of this PR is tp upgrade the checkstyle version from 3.1.0 to 3.2.0 and resolve all checkstyle issues.

Checkstyle issues resolved ->

  • Multiple classes without JavaDoc comment in it.
  • Class files, Method names, variable names with consecutive caps. Renamed and refactored them accordingly.
  • Line space before attributes (such as @param) in the JavaDoc comment section.
  • Remove linespaces between import statements.
  • Adding space (' ') between semicolons in the loop, bring logical operators (such as &&) in new lines. Checkstyles related to formatting in general.

Note ->
Added <suppress checks="RequireEmptyLineBeforeBlockTagGroup" files=".*\.java"/> in the suppressions.
This is to ignore line space requirement on the JavaDoc section.

There are two reasons behind this new suppression rule:

  1. Need to change 300+ files for this minor checkstyle condition.
  2. When we press "enter" while in JavaDoc comment section, all IDEs (tested on Vscode & IntelliJ) insert a space and then goes to next line. So, maven think that it is on the same line and will result in checkstyle error. This will create some confusion to people while resolving the checkstyle issues.

For me, this is not super important and unnecessary . But, if you think, it is required, then let me know. I will then go ahead and make those changes.

Sorry about the multiple commits as there was an existing etc/ directory which was removed in the checkin and I added it back. Also, there was a file FileSelectorJFrame.java that was renamed to FileSelectorJframe.java in favor of checkstyle. But it wasn't checked-in for some strange reason. I fixed that as well.

this.eventListener = listener;
}

public final void removeListener(final ThreadCompleteListener listener) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12% of developers fix this issue

Var: Unnecessary 'final' modifier.


Suggested change
public final void removeListener(final ThreadCompleteListener listener) {
public final void removeListener(ThreadCompleteListener listener) {

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

completed();
}

public final void addListener(final ThreadCompleteListener listener) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12% of developers fix this issue

Var: Unnecessary 'final' modifier.


Suggested change
public final void addListener(final ThreadCompleteListener listener) {
public final void addListener(ThreadCompleteListener listener) {

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@Override
public void run() {
var currentTime = System.currentTimeMillis();
var endTime = currentTime + (eventTime * 1000);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0% of developers fix this issue

NarrowCalculation: This product of integers could overflow before being implicitly cast to a long.


Suggested change
var endTime = currentTime + (eventTime * 1000);
var endTime = currentTime + (eventTime * 1000L);

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

this.eventListener = listener;
}

public final void removeListener(final ThreadCompleteListener listener) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11% of developers fix this issue

UnnecessaryFinal: Since Java 8, it's been unnecessary to make local variables and parameters final for use in lambdas or anonymous classes. Marking them as final is weakly discouraged, as it adds a fair amount of noise for minimal benefit.


Suggested change
public final void removeListener(final ThreadCompleteListener listener) {
public final void removeListener( ThreadCompleteListener listener) {

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

completed();
}

public final void addListener(final ThreadCompleteListener listener) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11% of developers fix this issue

UnnecessaryFinal: Since Java 8, it's been unnecessary to make local variables and parameters final for use in lambdas or anonymous classes. Marking them as final is weakly discouraged, as it adds a fair amount of noise for minimal benefit.


Suggested change
public final void addListener(final ThreadCompleteListener listener) {
public final void addListener( ThreadCompleteListener listener) {

ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

this.touches(allBubbles.get(otherId))) { //the bubbles touch
if (allBubbles.get(otherId) != null //the bubble hasn't been popped yet
&& this.id != otherId //the two bubbles are not the same
&& this.touches(allBubbles.get(otherId))) { //the bubbles touch
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15% of developers fix this issue

NULL_DEREFERENCE: object returned by allBubbles.get(valueOf(otherId)) could be null and is dereferenced by call to touches(...) at line 73.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -31,10 +31,10 @@
* GHobbits.
*/
@Slf4j
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

22% of developers fix this issue

💬 19 similar findings have been found in this PR


UnnecessarilyFullyQualified: This fully qualified name is unambiguous to the compiler if imported.


Suggested change
@Slf4j
LoggerFactory

🔎 Expand here to view all instances of this finding
File Path Line Number
observer/src/main/java/com/iluwatar/observer/generic/GenWeather.java 33
observer/src/main/java/com/iluwatar/observer/generic/GenOrcs.java 33
event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/AsyncEvent.java 34
observer/src/main/java/com/iluwatar/observer/generic/GenWeather.java 33
observer/src/main/java/com/iluwatar/observer/generic/GenHobbits.java 33
event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/AsyncEvent.java 34
observer/src/main/java/com/iluwatar/observer/generic/GenOrcs.java 33
observer/src/main/java/com/iluwatar/observer/generic/GenOrcs.java 33
event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/AsyncEvent.java 34
event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/AsyncEvent.java 40

Showing 10 of 19 findings. Visit the Lift Web Console to see all.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@sonatype-lift
Copy link
Copy Markdown

sonatype-lift Bot commented Jan 28, 2023

🛠 Lift Auto-fix

Some of the Lift findings in this PR can be automatically fixed. You can download and apply these changes in your local project directory of your branch to review the suggestions before committing.1

# Download the patch
curl https://lift.sonatype.com/api/patch/github.com/iluwatar/java-design-patterns/2464.diff -o lift-autofixes.diff

# Apply the patch with git
git apply lift-autofixes.diff

# Review the changes
git diff

Want it all in a single command? Open a terminal in your project's directory and copy and paste the following command:

curl https://lift.sonatype.com/api/patch/github.com/iluwatar/java-design-patterns/2464.diff | git apply

Once you're satisfied commit and push your changes in your project.

Footnotes

  1. You can preview the patch by opening the patch URL in the browser.

@@ -162,15 +161,15 @@ public void mouseClicked(final MouseEvent e) {
apply.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10% of developers fix this issue

💬 2 similar findings have been found in this PR


UnnecessaryFinal: Since Java 8, it's been unnecessary to make local variables and parameters final for use in lambdas or anonymous classes. Marking them as final is weakly discouraged, as it adds a fair amount of noise for minimal benefit.


Suggested change
public void mouseClicked(final MouseEvent e) {
public void mouseClicked( MouseEvent e) {

🔎 Expand here to view all instances of this finding
File Path Line Number
presentation-model/src/main/java/com/iluwatar/presentationmodel/View.java 171
presentation-model/src/main/java/com/iluwatar/presentationmodel/View.java 133

Visit the Lift Web Console to find more details in your report.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -133,7 +132,7 @@ public void createView() {
@Override
public void mouseClicked(final MouseEvent e) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12% of developers fix this issue

💬 2 similar findings have been found in this PR


Var: Unnecessary 'final' modifier.


Suggested change
public void mouseClicked(final MouseEvent e) {
public void mouseClicked(MouseEvent e) {

🔎 Expand here to view all instances of this finding
File Path Line Number
presentation-model/src/main/java/com/iluwatar/presentationmodel/View.java 163
presentation-model/src/main/java/com/iluwatar/presentationmodel/View.java 171

Visit the Lift Web Console to find more details in your report.


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

81.3% 81.3% Coverage
0.0% 0.0% Duplication

@iluwatar iluwatar merged commit fb7ec9b into iluwatar:master Feb 4, 2023
@iluwatar
Copy link
Copy Markdown
Owner

iluwatar commented Feb 4, 2023

Looks good! Thank you for the contribution 🎉

@all-contributors please add @rahul-raj for code

@allcontributors
Copy link
Copy Markdown
Contributor

@iluwatar

I couldn't determine any contributions to add, did you specify any contributions?
Please make sure to use valid contribution names.

I've put up a pull request to add @rahul-raj! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants