java-design-patterns icon indicating copy to clipboard operation
java-design-patterns copied to clipboard

SonarCloud reports issues

Open iluwatar opened this issue 5 years ago • 41 comments

The project is using SonarCloud static code analysis. The latest results are showing that it has found several blockers and critical severity code smells (major, minor, and info level we ignore). In this task, those are fixed or marked as false positives. To mark false positives, SuppressWarnings annotation should be used in code as explained in the linked documentation.

Links: Blocker and critical severity code smells in SonarCloud Sonar false positives


Note: When Submitting a PR please provide a hyperlinked list of all the issues that you are issuing a fix for. See this example

iluwatar avatar Oct 15 '19 17:10 iluwatar

Can I take this issue?

ykayacan avatar Oct 17 '19 23:10 ykayacan

Sure @ykayacan

iluwatar avatar Oct 18 '19 05:10 iluwatar

This issue is free for taking again.

iluwatar avatar Jun 14 '20 19:06 iluwatar

I would like to take this issue.

ImLynxie avatar Aug 15 '20 09:08 ImLynxie

Through out checking the files causing issues on SonarCloud, I've encountered test cases that are not properly named to the functionality that they are to be tested against.

Example`

In-correct naming convention of a test method.

@Test void test() throws Exception { App.main(new String[]{}); }

Correct naming convention of a test method.

@Test public void shouldExecuteAppWithoutException() { assertDoesNotThrow(() -> App.main(null)); }

A test method should describe what its testing directly in the naming, I will rename the test cases that I find throughout the refactoring process to match proper convention rules, if the test case is understandable as to what it's testing, but I would encourage that these test cases be looked at and properly named for other contributors making changes to certain files that the test cases test against, otherwise it causes a lot of confusion as to whether said contributor is testing the right thing.

ImLynxie avatar Aug 15 '20 11:08 ImLynxie

Ok @ToxicDreamz, assigned to you. I agree with your comment regarding test naming.

iluwatar avatar Aug 15 '20 17:08 iluwatar

I've already finished with the issue.

Request to run another SonarCloud report after merging, to see what else remains, and whether or not they can be modified so issues do not come up again.

ImLynxie avatar Aug 15 '20 18:08 ImLynxie

13 blockers and 24 criticals remaining: https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&resolved=false&severities=BLOCKER%2CCRITICAL

iluwatar avatar Aug 22 '20 10:08 iluwatar

HotelDaoImpl.java seems to be one of the hotspots we should fix: https://sonarcloud.io/component_measures?id=iluwatar_java-design-patterns&selected=iluwatar_java-design-patterns%3Atransaction-script%2Fsrc%2Fmain%2Fjava%2Fcom%2Filuwatar%2Ftransactionscript%2FHotelDaoImpl.java&view=list

iluwatar avatar Aug 22 '20 10:08 iluwatar

@iluwatar happy to be back again :) Can I help with this issue?

anuragagarwal561994 avatar Oct 02 '20 12:10 anuragagarwal561994

I will resolve the report:

https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&open=AW5RukINqcCiTG-gJi15&resolved=false&severities=CRITICAL

daniel-augusto avatar Oct 12 '20 01:10 daniel-augusto

Ok, assigned @anuragagarwal561994 and @daniel-augusto. Thanks guys!

iluwatar avatar Nov 08 '20 16:11 iluwatar

@iluwatar Can I help with this issue?

kanwarpreet25 avatar Dec 14 '20 09:12 kanwarpreet25

Sure if @anuragagarwal561994 is no longer working on it?

iluwatar avatar Dec 14 '20 18:12 iluwatar

No @iluwatar I didn't get time to look into this, you can re-assign

anuragagarwal561994 avatar Dec 16 '20 12:12 anuragagarwal561994

@iluwatar I will start working on it

kanwarpreet25 avatar Dec 17 '20 05:12 kanwarpreet25

No problem @anuragagarwal561994 @kanwarpreet25 you're good to go

iluwatar avatar Jan 13 '21 19:01 iluwatar

@iluwatar can I help with this and coordinate with @kanwarpreet25 @daniel-augusto ?

solid-network avatar Apr 01 '21 16:04 solid-network

@kanwarpreet25 has no public commits since Jul 28, 2019, f7e22a1 @daniel-augusto has no public commits to this repo since Oct 11, 2020 3a72abb

Are you guys working on this know?

solid-network avatar Apr 01 '21 16:04 solid-network

Thanks for helping out @joseosuna-engineer. I'm looking forward to your pull request!

iluwatar avatar Apr 01 '21 16:04 iluwatar

Thank you. I'm going to begin with this.

solid-network avatar Apr 01 '21 17:04 solid-network

@iluwatar @ohbus I have added this project to my own CircleCI and SonarCloud accounts to run SonarCloud before create a pull request.

My accounts: image

I changed two config files, :scream: .circleci/config.yml and pom.xml (my fork, another branch) I'm sure @iluwatar @ohbus that we can find a better approach using environment vars or some characteristic of CircleCI 2.1 Youtube

My strategy is:

  • to use this branch A only in my fork.
  • to create another branch B to commit my code.
  • to merge B to A and run CircleCI + SonarCloud
  • when code is okay create a pull request from B (that has original config files) to master

image

image

solid-network avatar Apr 01 '21 22:04 solid-network

I think the general approach presented above is going to work, but as pointed out there are chances to streamline the workflow. @joseosuna-engineer feel free to create another issue where you point out the exact spots we should change.

iluwatar avatar Apr 02 '21 15:04 iluwatar

@iluwatar I have created issue 1697

solid-network avatar Apr 07 '21 21:04 solid-network

The project is using SonarCloud static code analysis. The latest results are showing that it has found several blocker and critical severity code smells (major, minor and info level we ignore). In this task those are fixed or marked as false positives. To mark false positives, SuppressWarnings annotation should be used in code as explained in the linked documentation.

Links: Blocker and critical severity code smells in SonarCloud Sonar false positives

@iluwatar I want to ask you some things: 1.- This issue (1012) is not about all sonarcloud issues. is it? 2.- major, minor and info issues are not included here 3.- it is only about (blocker and critical) + code smell issues

image

4.- Do you want I add @java.lang.SuppressWarnings("squid:some-number") annotation for all in question number 3? or Do I have to do something like ykayacan: suppress false positives (test by example) and fix number 3 issues?

solid-network avatar Apr 07 '21 23:04 solid-network

@joseosuna-engineer

  1. No, it's about blocker and critical level issues only
  2. Yes
  3. Yes
  4. For false positives we can suppress the warnings as you suggested

iluwatar avatar Apr 18 '21 09:04 iluwatar

@iluwatar Thank you!

solid-network avatar Apr 23 '21 13:04 solid-network

Can I help to fix this issue? Has anyone solved this one? https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&open=AW3G0WaAwB6UiZzQNqwC&resolved=false&severities=BLOCKER

samuelpsouza avatar Jun 07 '21 01:06 samuelpsouza

@samuelpsouza Yes. Feel free to colaborate. @iluwatar I'm so sorry. I'm studying for a couple of certification test.

solid-network avatar Jun 07 '21 14:06 solid-network

@samuelpsouza Yes. Feel free to collaborate. @iluwatar I'm so sorry. I'm studying for a couple of certification tests.

Please @joseosuna-engineer, no need for an apology here.

You can mention a timeline for when you will be able to make the contributions or let us know in Gitter about the same as well.

And all the very best for your examinations! May you ace them ⭐

ohbus avatar Jun 07 '21 16:06 ohbus

Can I help to fix this issue? Has anyone solved this one? https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&open=AW3G0WaAwB6UiZzQNqwC&resolved=false&severities=BLOCKER

Thank you so much for your interest in our project @samuelpsouza through #1784

ohbus avatar Jun 07 '21 16:06 ohbus

Raised a PR for the following two Critical Code Smells: #1831

  1. https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&open=AXhD5LIoXfseSECKkezl&resolved=false&severities=CRITICAL&types=CODE_SMELL
  2. https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&open=AXhD5LIoXfseSECKkezm&resolved=false&severities=CRITICAL&types=CODE_SMELL

First time contributing to open source software. Please review and provide your feedback.

sims-keshri avatar Oct 04 '21 18:10 sims-keshri

Raised a PR for the following two Critical Code Smells: #1831

  1. https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&open=AXhD5LIoXfseSECKkezl&resolved=false&severities=CRITICAL&types=CODE_SMELL
  2. https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&open=AXhD5LIoXfseSECKkezm&resolved=false&severities=CRITICAL&types=CODE_SMELL

First time contributing to open source software. Please review and provide your feedback.

Please also review https://github.com/iluwatar/java-design-patterns/pull/1833 and https://github.com/iluwatar/java-design-patterns/pull/1832

sims-keshri avatar Oct 04 '21 18:10 sims-keshri

I would like to work on this issue and resolve some of the code smells/ critical issues in Sonar. Can I take this up? @iluwatar

parulagg27 avatar Oct 06 '21 07:10 parulagg27

Sure @parulagg27, go ahead

iluwatar avatar Oct 08 '21 17:10 iluwatar

We need assistance to resolve the remaining blocker and critical level SonarCloud issues

iluwatar avatar Oct 24 '21 15:10 iluwatar

I have resolved 1 blocker & 5 critical Sonar issues using this PR. Kindly review and merge. Screenshot 2021-10-30 at 11 27 15 PM Screenshot 2021-10-30 at 11 26 50 PM

interactwithankush avatar Oct 30 '21 18:10 interactwithankush

  • Resolved 1 blocker & 5 critical Sonar issues

  • Old sonar report :- here

  • Code Cov: Added an extensive test cases for Commander pattern.

  • PR Quality Gate is also green

@iluwatar @ohbus Kindly review and merge this PR

interactwithankush avatar Nov 12 '21 09:11 interactwithankush

hey can i work on this issue :)

ShivanshCharak avatar Jan 18 '22 17:01 ShivanshCharak

Ok, go ahead @ShivanshCharak

iluwatar avatar Jan 30 '22 18:01 iluwatar

Raised a pr for the following Critical code smell https://github.com/iluwatar/java-design-patterns/pull/1960

please also review a minor code smell https://github.com/iluwatar/java-design-patterns/pull/1959#issue-1118731779

ShivanshCharak avatar Feb 01 '22 09:02 ShivanshCharak