Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

CLI Interface Refactor #1001

Merged
merged 5 commits into from
Feb 20, 2018
Merged

CLI Interface Refactor #1001

merged 5 commits into from
Feb 20, 2018

Conversation

ajlopez
Copy link
Contributor

@ajlopez ajlopez commented Jan 25, 2018

Some refactors, suggested by a linter (Sonar):

  • Private default constructor, to avoid creation
  • Constant string comparison, using constant.equals
  • Extract methods to process arguments

I think it could be improved. For example, to have a class that processes an array of arguments, and returns a map of key values... and separate the apply of those key values to SystemProperties. In this way, we could have tests with expected behavior and better code coverage

@zilm13
Copy link
Collaborator

zilm13 commented Jan 26, 2018

@ajlopez Could you, please, merge latest develop into your branch and push it. We had an issues with tests, now tests are fixed.

@coveralls
Copy link

coveralls commented Jan 26, 2018

Coverage Status

Coverage decreased (-0.03%) to 56.597% when pulling 29dec5e on ajlopez:cli_interface into 12acb7b on ethereum:develop.

Copy link
Collaborator

@zilm13 zilm13 left a comment

Choose a reason for hiding this comment

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

Looks great!
Just small fix and I will merge it.

}

private static Boolean interpret(String arg) {
if ("on".equals(arg) || "true".equals(arg) || "yes".equals(arg)) return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you replace both lines in favor of BooleanUtils.toBooleanObject(String) with throwing error when null returned. I guess it would be safer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Done

Copy link
Collaborator

@zilm13 zilm13 Feb 15, 2018

Choose a reason for hiding this comment

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

Add something like

if (resetFlag == null) {
    throw new Error(String.format("Can't interpret DB reset arguments: %s %s", arg, reset));
}

You've lost this case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, good catch... done

@zilm13 zilm13 merged commit 2bf1766 into ethereum:develop Feb 20, 2018
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.

3 participants