Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RenameSuggestion #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AnonymousAccount4SE
Copy link

Renaming Suggestion of Method Names to Make Them More Descriptive


Description

We have developed a tool (NameSpotter) for identifying non-descriptive method names, and using this tool we find several non-descriptive method names in your repository:

/* Non-descriptive Method Name in dashjoin-core/src/main/java/org/dashjoin/function/ERDiagram.java */
  String s(String s) {
    if (s == null)
      return "";
    else
      return s;
  }

We considered "s" as non-descriptive because it only contains one letter.
We proposed renaming the method name to "getStringSafely". Consequently, when we look at this method name, we will be informed that this method is designed to get string safely without causing NullPointerException.

  String q(String s) {
    if (s == null)
      return null;
    if (StringUtils.isAlphanumeric(s.replace('_', 'a')))
      return s;
    else
      return '"' + s + '"';
  }

We considered "q" as non-descriptive because it also only contains one letter.
We proposed renaming the method name to "isAlphanumeric", which reminds developers that this method implements functions related to an API method (StringUtils.isAlphanumeric).

  String t(String s) {
    if (s == null)
      return null;
    return s.replaceAll(" ", "_");
  }

We considered "t" as non-descriptive because it also only contains one letter.
We proposed renaming the method name to "replaceSpaceWithUnderScore", which explicitly delivers the main function of this method.

Do you agree with the judgment?

  • If not, could you please leave your valuable opinion?

  • If you do agree, the relevant modification has been submitted as a PR, and thanks for your precious time to consider it.

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

Successfully merging this pull request may close these issues.

None yet

1 participant