Showing 13 of 57 total issues
File ticks.js
has 4025 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { nowAsEpoch } from 'binary-utils';
export default [
{ epoch: 0, quote: 50 },
{ epoch: 1, quote: 40 },
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { allowOHLC, assetName, className, compactToolbar, hideTimeFrame, hideToolbar,
showTooltips, hideZoomControls, showAllTimeFrame, theme, ticks, type, highContrast,
id, symbol, noData, pipSize, events, shiftMode, contract, trade, hideIntervalPicker,
} = this.props;
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { allowOHLC, assetName, compact, type, getChart, pickerShown, interval, showTooltips,
onShowPicker, onIntervalChange, onTypeChange, onIndicatorChange, hideIntervalPicker } = this.props;
const tooltips = showTooltips ? defaultTooltips : {};
Function replacePlotObj
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
const replacePlotObj = (axis, allPlotObjs: PlotObject[], newPlotObjs: PlotObject[], addFuncName, removeFuncName) => {
allPlotObjs.forEach(plotObj => {
const newObj = newPlotObjs.find(x => x.id === plotObj.id);
if (!newObj) {
axis[removeFuncName](plotObj.id);
- 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 render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { data, showAllTimeFrame, interval } = this.props;
let opt = options;
Function componentDidMount
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
componentDidMount() {
api.events.on('ohlc', response => {
const { ticks, type } = this.state;
if (type === 'line' || type === 'area' || ticks.length < 3) {
Consider simplifying this complex logical expression. Open
Open
if (ticksDiffer || contractsDiffer || tradingTimesDiffer
|| pipSizeDiffer || futureUpdated || minRangeUpdated || indicatorsDiffer) {
chart.redraw(false);
}
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return cloned;
Avoid too many return
statements within this function. Open
Open
return cloned;
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return cloned;
Avoid too many return
statements within this function. Open
Open
return {
...cloned,
barrier: +barrier,
};