Showing 255 of 255 total issues
Method onConnected
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void onConnected() {
LOGGER.info(String.format("Connector [%s] connected.", connectionId));
try {
ConnectorPriceService priceService =
- 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 createExperimentContexts
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void createExperimentContexts() {
Map<String, ParameterValues> parameters = ImmutableMap.<String, ParameterValues>builder()
.put("parameterA", ParameterValuesFactory.createList(ImmutableSet.of("a", "b")))
.put("parameterB", ParameterValuesFactory.createRange(-2, 2, 2))
Function createFunctionContext
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
createFunctionContext: function createFunctionContext(asObject) {
var varDeclarations = '';
var locals = this.stackVars.concat(this.registers.list);
if (locals.length > 0) {
Function invokePartialWrapper
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function invokePartialWrapper(partial, context, options) {
if (options.hash) {
context = Utils.extend({}, context, options.hash);
if (options.ids) {
options.ids[0] = true;
Function compile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
compile: function compile(program, options) {
this.sourceNode = [];
this.opcodes = [];
this.children = [];
this.options = options;
Function replaceStack
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
replaceStack: function replaceStack(callback) {
var prefix = ['('],
stack = undefined,
createdStack = undefined,
usedLiteral = undefined;
Method removeStrategy
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void removeStrategy(String instanceId, Optional<Throwable> exception) {
checkNotNullOrEmpty(instanceId);
Strategy strategy;
activeStrategiesLock.lock();
try {
Similar blocks of code found in 2 locations. Consider refactoring. Open
def __init__(self, instrument, time, ask, bid):
self.instrument = instrument
self.time = time
self.ask = ask
self.bid = bid
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 38.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def __init__(self, open, high, low, close):
self.open = open
self.high = high
self.low = low
self.close = close
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 38.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method updateTradesStatus
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private void updateTradesStatus(PriceTick priceTick) {
List<Trade> closingTrades = Lists.newArrayList();
for (int i = 0; i < activeTrades.size(); i++) {
Trade trade = activeTrades.get(i);
if (priceTick.getInstrument().equals(trade.getInstrumentId()) &&
- 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 onDisconnected
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void onDisconnected() {
try {
ConnectorPriceService priceService =
connectorManager.getConnectionIfPresent(connectionId).getPriceService();
- 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
Function execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute(self):
for _ in range(self.MAX_ITERATIONS):
prices_stage = self._get_prices_stage()
if not prices_stage.count() > 0:
return
- 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 newExperiment
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static Experiment newExperiment(Collection<PriceTick> priceTicks,
String strategyClassName, Map<String, String> strategyParameters,
Collection<InstrumentMapping> instrumentMapping, IndicatorService indicatorService,
InstrumentService instrumentService, long latencyMilliseconds) {
Method createOrderAtMarket
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static OrderRequest createOrderAtMarket(PriceTick priceTick, String orderConnectorId,
String orderInstrumentId, OrderDirection orderDirection, double takeProfit, double stopLoss,
double worstAcceptedPrice) {
Function DateShim
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
var DateShim = function Date(Y, M, D, h, m, s, ms) {
Function wrapProgram
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) {
Method newExperiment
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static Experiment newExperiment(PriceFeed priceFeed,
Class<? extends Strategy> strategyClass, Map<String, String> strategyParameters,
Collection<InstrumentMapping> instrumentMapping, IndicatorService indicatorService,
InstrumentService instrumentService, long latencyMilliseconds) {
Function performAction
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$
Similar blocks of code found in 2 locations. Consider refactoring. Open
if instrument_id == TestingConstants.DEFAULT_INSTRUMENT_ID_DAX:
assert from_timestamp == _TestingClientConstants \
.DEFAULT_MARKET_HOURS_DAX.market_open
assert to_timestamp == _TestingClientConstants \
.DEFAULT_MARKET_HOURS_DAX.market_close
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 36.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
elif instrument_id == TestingConstants.DEFAULT_INSTRUMENT_ID_EURUSD:
assert from_timestamp == _TestingClientConstants \
.DEFAULT_MARKET_HOURS_EURUSD.market_open
assert to_timestamp == _TestingClientConstants \
.DEFAULT_MARKET_HOURS_EURUSD.market_close
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 36.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76