[MINOR] removed shoulds (#924)

* removed shoulds

* added P2P and RPC to coding conventions

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Sally MacFarlane 6 years ago committed by GitHub
parent de56bcde42
commit 3090bfbaf5
  1. 4
      CODING-CONVENTIONS.md
  2. 32
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

@ -66,7 +66,7 @@ To create understandable, self-documenting code:
- Keep methods and classes short and focused on a single responsibility. Preferable maximum lengths: - Keep methods and classes short and focused on a single responsibility. Preferable maximum lengths:
* Lambdas: 1 - 3 lines * Lambdas: 1 - 3 lines
* Methods: less than 50 lines * Methods: less than 50 lines
* Anonymous classes: less than a 50 lines * Anonymous classes: less than 50 lines
* Inner classes: not much more than 50 lines * Inner classes: not much more than 50 lines
* Classes: a few hundred lines * Classes: a few hundred lines
- Be thoughtfully organised in terms of method order, package structure, and module usage - Be thoughtfully organised in terms of method order, package structure, and module usage
@ -78,6 +78,8 @@ To create understandable, self-documenting code:
* tx -> Transaction * tx -> Transaction
* IBFT -> Istanbul Byzantine Fault Tolerant (a consensus protocol) * IBFT -> Istanbul Byzantine Fault Tolerant (a consensus protocol)
* EVM -> Ethereum Virtual Machine * EVM -> Ethereum Virtual Machine
* P2P -> Peer to Peer
* RPC -> Remote Procedure Call
# 3.2 Creating Code for Constant Refactoring and Evolving Design # 3.2 Creating Code for Constant Refactoring and Evolving Design

@ -148,7 +148,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
// Completely disables P2P within Pantheon. // Completely disables P2P within Pantheon.
@Option( @Option(
names = {"--p2p-enabled"}, names = {"--p2p-enabled"},
description = "Enable/disable all P2P functionality (default: ${DEFAULT-VALUE})", description = "Enable P2P functionality (default: ${DEFAULT-VALUE})",
arity = "1") arity = "1")
private final Boolean p2pEnabled = true; private final Boolean p2pEnabled = true;
@ -236,8 +236,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
@Option( @Option(
names = {"--rpc-http-enabled"}, names = {"--rpc-http-enabled"},
description = description = "Set to start the JSON-RPC HTTP service (default: ${DEFAULT-VALUE})")
"Set if the JSON-RPC HTTP service should be started (default: ${DEFAULT-VALUE})")
private final Boolean isRpcHttpEnabled = false; private final Boolean isRpcHttpEnabled = false;
@Option( @Option(
@ -268,19 +267,18 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
arity = "1..*", arity = "1..*",
converter = RpcApisConverter.class, converter = RpcApisConverter.class,
description = description =
"Comma separated APIs to enable on JSON-RPC HTTP service (default: ${DEFAULT-VALUE})") "Comma separated list of APIs to enable on JSON-RPC HTTP service (default: ${DEFAULT-VALUE})")
private final Collection<RpcApi> rpcHttpApis = DEFAULT_JSON_RPC_APIS; private final Collection<RpcApi> rpcHttpApis = DEFAULT_JSON_RPC_APIS;
@Option( @Option(
names = {"--rpc-http-authentication-enabled"}, names = {"--rpc-http-authentication-enabled"},
description = description =
"Set if the JSON-RPC HTTP service should require authentication (default: ${DEFAULT-VALUE})") "Require authentication for the JSON-RPC HTTP service (default: ${DEFAULT-VALUE})")
private final Boolean isRpcHttpAuthenticationEnabled = false; private final Boolean isRpcHttpAuthenticationEnabled = false;
@Option( @Option(
names = {"--rpc-ws-enabled"}, names = {"--rpc-ws-enabled"},
description = description = "Set to start the JSON-RPC WebSocket service (default: ${DEFAULT-VALUE})")
"Set if the JSON-RPC WebSocket service should be started (default: ${DEFAULT-VALUE})")
private final Boolean isRpcWsEnabled = false; private final Boolean isRpcWsEnabled = false;
@Option( @Option(
@ -304,7 +302,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
arity = "1..*", arity = "1..*",
converter = RpcApisConverter.class, converter = RpcApisConverter.class,
description = description =
"Comma separated APIs to enable on JSON-RPC WebSocket service (default: ${DEFAULT-VALUE})") "Comma separated list of APIs to enable on JSON-RPC WebSocket service (default: ${DEFAULT-VALUE})")
private final Collection<RpcApi> rpcWsApis = DEFAULT_JSON_RPC_APIS; private final Collection<RpcApi> rpcWsApis = DEFAULT_JSON_RPC_APIS;
private Long rpcWsRefreshDelay; private Long rpcWsRefreshDelay;
@ -333,12 +331,12 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
@Option( @Option(
names = {"--rpc-ws-authentication-enabled"}, names = {"--rpc-ws-authentication-enabled"},
description = description =
"Set if the JSON-RPC WebSocket service should require authentication (default: ${DEFAULT-VALUE})") "Require authentication for the JSON-RPC WebSocket service (default: ${DEFAULT-VALUE})")
private final Boolean isRpcWsAuthenticationEnabled = false; private final Boolean isRpcWsAuthenticationEnabled = false;
@Option( @Option(
names = {"--metrics-enabled"}, names = {"--metrics-enabled"},
description = "Set if the metrics exporter should be started (default: ${DEFAULT-VALUE})") description = "Set to start the metrics exporter (default: ${DEFAULT-VALUE})")
private final Boolean isMetricsEnabled = false; private final Boolean isMetricsEnabled = false;
@Option( @Option(
@ -357,8 +355,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
@Option( @Option(
names = {"--metrics-push-enabled"}, names = {"--metrics-push-enabled"},
description = description = "Enable the metrics push gateway integration (default: ${DEFAULT-VALUE})")
"Set if the metrics push gateway integration should be started (default: ${DEFAULT-VALUE})")
private final Boolean isMetricsPushEnabled = false; private final Boolean isMetricsPushEnabled = false;
@Option( @Option(
@ -406,7 +403,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
@Option( @Option(
names = {"--miner-enabled"}, names = {"--miner-enabled"},
description = "Set if node should perform mining (default: ${DEFAULT-VALUE})") description = "Set if node will perform mining (default: ${DEFAULT-VALUE})")
private final Boolean isMiningEnabled = false; private final Boolean isMiningEnabled = false;
@Option( @Option(
@ -435,13 +432,12 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
@Option( @Option(
names = {"--permissions-nodes-enabled"}, names = {"--permissions-nodes-enabled"},
description = "Set if node level permissions should be enabled (default: ${DEFAULT-VALUE})") description = "Enable node level permissions (default: ${DEFAULT-VALUE})")
private final Boolean permissionsNodesEnabled = false; private final Boolean permissionsNodesEnabled = false;
@Option( @Option(
names = {"--permissions-accounts-enabled"}, names = {"--permissions-accounts-enabled"},
description = description = "Enable account level permissions (default: ${DEFAULT-VALUE})")
"Set if account level permissions should be enabled (default: ${DEFAULT-VALUE})")
private final Boolean permissionsAccountsEnabled = false; private final Boolean permissionsAccountsEnabled = false;
@Option( @Option(
@ -452,7 +448,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
@Option( @Option(
names = {"--privacy-enabled"}, names = {"--privacy-enabled"},
description = "Set if private transaction should be enabled (default: ${DEFAULT-VALUE})") description = "Enable private transactions (default: ${DEFAULT-VALUE})")
private final Boolean privacyEnabled = false; private final Boolean privacyEnabled = false;
@Option( @Option(
@ -774,7 +770,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
privacyParameters.setPublicKeyUsingFile(privacyPublicKeyFile()); privacyParameters.setPublicKeyUsingFile(privacyPublicKeyFile());
} else { } else {
throw new ParameterException( throw new ParameterException(
commandLine, "Please specify Enclave public Key file path to Enable Privacy"); commandLine, "Please specify Enclave public key file path to enable privacy");
} }
privacyParameters.setPrivacyAddress(privacyPrecompiledAddress); privacyParameters.setPrivacyAddress(privacyPrecompiledAddress);
} }

Loading…
Cancel
Save