Showing 53 of 126 total issues
Method sendCommand
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public void sendCommand(BitfinexCommand command) {
if (command instanceof SetConnectionFeaturesCommand) {
clients.values().forEach(c -> c.sendCommand(command));
return;
Method getCommand
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public String getCommand(final BitfinexWebsocketClient client) throws BitfinexCommandException {
final JSONObject orderJson = new JSONObject();
orderJson.put("type", bitfinexOrder.getOrderType().getBifinexString());
orderJson.put("symbol", bitfinexOrder.getCurrencyPair().toBitfinexString());
Method jsonToBitfinexApiKeyPermissions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private BitfinexApiKeyPermissions jsonToBitfinexApiKeyPermissions(final JSONObject jsonObject) {
final JSONObject caps = jsonObject.getJSONObject("caps");
JSONObject orders = caps.getJSONObject("orders");
boolean orderReadPermission = orders.getInt("read") == 1;
boolean orderWritePermission = orders.getInt("write") == 1;
Method jsonToBitfinexSubmittedOrder
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private BitfinexSubmittedOrder jsonToBitfinexSubmittedOrder(JSONArray array) {
final JSONArray orderJson = array.optJSONArray(4);
final long oid = orderJson.optLong(0, -1);
final long gid = orderJson.optLong(1, -1);
final long cid = orderJson.optLong(2, -1);
Method orderBook
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static BitfinexOrderBookSymbol orderBook(final String currency, final String profitCurrency,
final BitfinexOrderBookSymbol.Precision precision,
final BitfinexOrderBookSymbol.Frequency frequency, final int pricePoints) {
Method jsonToBitfinexSubmittedOrder
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private BitfinexSubmittedOrder jsonToBitfinexSubmittedOrder(final JSONArray json) {
final BitfinexSubmittedOrder order = new BitfinexSubmittedOrder();
order.setOrderId(json.getLong(0));
final String gid = json.optString(1, null);
if (gid != null) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getCommand
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
@Override
public String getCommand(final BitfinexWebsocketClient client) throws BitfinexCommandException {
final JSONObject orderJson = new JSONObject();
orderJson.put("type", bitfinexOrder.getOrderType().getBifinexString());
orderJson.put("symbol", bitfinexOrder.getCurrencyPair().toBitfinexString());
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return true;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;
Avoid too many return
statements within this method. Open
Open
return false;