Convex-Dev / convex

Convex Main Repository - Decentralised platform for the Internet of Value
https://convex.world
Other
95 stars 30 forks source link

RenameSuggestion #498

Closed AnonymousAccount4SE closed 1 year ago

AnonymousAccount4SE commented 1 year ago

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 convex-cli/src/main/java/convex/cli/peer/PeerManager.java */
public State aquireState(String remotePeerHostname, Hash stateHash) {
        InetSocketAddress remotePeerAddress = Utils.toInetSocketAddress(remotePeerHostname);
        Convex convex = null;
        State state = null;
        try {
            convex = Convex.connect(remotePeerAddress, address, keyPair);
            Future<State> bf = convex.acquire(stateHash, store);
            state = bf.get(TRANSACTION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
            convex.close();
        } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
            throw new Error("cannot aquire network state: " + e);
        }
        return state;

    }
public SignedData<Belief> aquireBelief(String remotePeerHostname, Hash beliefHash) {
        // sync the etch db with the network state
        Convex convex = null;
        SignedData<Belief> signedBelief = null;
        InetSocketAddress remotePeerAddress = Utils.toInetSocketAddress(remotePeerHostname);
        try {
            convex = Convex.connect(remotePeerAddress, address, keyPair);
            Future<SignedData<Belief>> cf = convex.acquire(beliefHash, store);
            signedBelief = cf.get(TRANSACTION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
            convex.close();
        } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
            throw new Error("cannot acquire belief: " + e);
        }

        return signedBelief;
    }

We considered "aquireState" and "aquireBelief" as non-descriptive because they contain a typo (i.e., aquire should be acquire).

We have corrected them and commited a pull request.

Do you agree with the judgment?

mikera commented 1 year ago

Thanks for spelling fix!