Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed code smells after running sonarqube on the project#1429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
realDuYuanChao merged 4 commits intoTheAlgorithms:Developmentfromabhijaykumar:Development
Aug 25, 2020
Merged

Fixed code smells after running sonarqube on the project#1429

realDuYuanChao merged 4 commits intoTheAlgorithms:Developmentfromabhijaykumar:Development
Aug 25, 2020

Conversation

@abhijaykumar
Copy link
Contributor

Multiple code smells were found bySonarQube on the project. Some of them were violations of the below rules:

  • Local variable names in java must be with the default regular expression ^[a-z][a-zA-Z0-9]*$RSPEC-117
  • The diamond operator ("<>") should be used when the type of the maps are already definedRSPEC-2293
  • Package names being camel cased is a code smell, all package names must be lowercase
  • String literals should not be duplicatedRSPEC-1192
  • Generic types shouldn't be used raw (without type parameters) in variable declarations or return values. Doing so bypasses generic type checking, and defers the catch of unsafe code to runtime.RSPEC-3740
  • The dangling else problem appears when nested if/else statements are written without curly braces. In this case, else is associated with the nearest if but that is not always obvious and sometimes the indentation can also be misleading.RSPEC-5261

Here is the overall SonarQube report for the repo (Development) branch post the fixes.

image

This pull request brings down the code smells from 188 to 177.

- Local variable names in java must be with the  default regular expression ^[a-z][a-zA-Z0-9]*$https://rules.sonarsource.com/java/tag/convention/RSPEC-117- The diamond operator ("<>") should be used when the type of the maps are already definedhttps://rules.sonarsource.com/java/RSPEC-2293- Package names being camel cased is a code smell
-Generic types shouldn't be used raw (without type parameters) in variable declarations or return values. Doing so bypasses generic type checking, and defers the catch of unsafe code to runtime.https://rules.sonarsource.com/java/RSPEC-3740- The dangling else problem appears when nested if/else statements are written without curly braces. In this case, else is associated with the nearest if but that is not always obvious and sometimes the indentation can also be misleading.https://rules.sonarsource.com/java/tag/confusing/RSPEC-5261
@abhijaykumarabhijaykumar marked this pull request as draftAugust 21, 2020 15:36
@abhijaykumarabhijaykumar marked this pull request as ready for reviewAugust 21, 2020 15:36
@abhijaykumar
Copy link
ContributorAuthor

@yanglbme Please review this.
Thanks

@drabbit75
Copy link
Member

have the changed codes been compiled and tested? if so I think they can be merged.

@abhijaykumar
Copy link
ContributorAuthor

@drabbit75 Yes, all tests are passing after the changes. I was able to generate the code coverage report too.

Copy link
Member

@realDuYuanChaorealDuYuanChao left a comment

Choose a reason for hiding this comment

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

LGTM

@realDuYuanChao
Copy link
Member

@abhijaykumar cloud you reopen a new PR and fix build error? Thanks

@abhijaykumar
Copy link
ContributorAuthor

abhijaykumar commentedAug 25, 2020
edited
Loading

@abhijaykumar cloud you reopen a new PR and fix build error? Thanks

@shellhub Where's the build error? I rangradlew clean test and it builds fine.

@realDuYuanChao
Copy link
Member

@abhijaykumar
Copy link
ContributorAuthor

@shellhub Thanks. Looks like it passed for me since I'm on JDK11. I'll rebuild on JDK8 and create a new PR.

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

Reviewers

@realDuYuanChaorealDuYuanChaorealDuYuanChao approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@abhijaykumar@drabbit75@realDuYuanChao

[8]ページ先頭

©2009-2025 Movatter.jp