Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Fixed some warning / issues mentioned by SonarLint. #237

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

KingAlex1985
Copy link

@KingAlex1985 KingAlex1985 commented Dec 27, 2020

Description of change

Please write a summary of your changes and why you made them. Be sure to reference any related issues by adding fixes # (issue).

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Enhancement (a non-breaking change which adds functionality)

How the change has been tested

Only by Unit tests, if any existed.

Make sure to provide instructions for the maintainer as well as any relevant configurations.

Change checklist

Add an x to the boxes that are relevant to your changes, and delete any items that are not.

  • My code follows the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes

@kwek20
Copy link
Contributor

kwek20 commented Jan 31, 2021

@KingAlex1985 What made you change address.getAddress().getHash() to address.getAddressHash().getHashString()?
I find it personally not needed to call it getAddressHash, as you just need to know its an address, not a hash.
Id rather disable the lint warning if that was the reason :)

@KingAlex1985
Copy link
Author

Hello @kwek20,
yes I did the change because of the SonarLint mentioned issue, which is saying this:

==========================================

Rename field "address" (Address.java Line 5)

A field should not duplicate the name of its containing class
Code smell - Major - java:S1700

It's confusing to have a class member with the same name (case differences aside) as its enclosing class.
This is particularly so when you consider the common practice of naming a class instance for the class itself.

Best practice dictates that any field or member with the same name as the enclosing class be renamed
to be more descriptive of the particular aspect of the class it represents or holds.

==========================================

So that I have decided to name it "AddressHash".
But if this is not a good idea I can change it back, if you like?

Greetings
Alex

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants