iota-java icon indicating copy to clipboard operation
iota-java copied to clipboard

Fixed some warning / issues mentioned by SonarLint.

Open KingAlex1985 opened this issue 4 years ago • 2 comments

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.

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

KingAlex1985 avatar Dec 27 '20 09:12 KingAlex1985

@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 :)

kwek20 avatar Jan 31 '21 18:01 kwek20

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

KingAlex1985 avatar Feb 03 '21 20:02 KingAlex1985