Showing 11 of 42 total issues
File abstractChart.ts
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { select, extent, max, brush as d3brush, brushX, brushY } from 'd3'
import { randomId, makeAccessorFunction } from '../misc/utility'
import Scale from '../components/scale'
import Axis, { IAxis, AxisOrientation } from '../components/axis'
import Tooltip from '../components/tooltip'
Function mountBrush
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
mountBrush(whichBrush?: BrushType): void {
// if no brush is specified, there's nothing to mount
if (!whichBrush) return
// brush can only be mounted after content is set
Function Home
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Home: React.FC = () => {
const chartRef = useRef(null)
useEffect(() => {
if (!chartRef.current) return
const lineChart = new LineChart({
Function diffToTimeFormat
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
diffToTimeFormat(): FormatFunction {
const diff = Math.abs(this.scale.domain[1] - this.scale.domain[0]) / 1000
const millisecondDiff = diff < 1
const secondDiff = diff < 60
- 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 mountRugs
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
mountRugs(): void {
// if content is not set yet, abort
if (!this.content) {
console.error('error: content not set yet')
return
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({
data,
target,
markers,
baselines,
Function normalizePoints
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
normalizePoints({
points,
nested,
aggregate,
defined
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor({ data, xAccessor, yAccessor, y0Accessor, y1Accessor, xScale, yScale, curve, color, defined }: IArea) {
this.data = data
this.color = color ?? this.color
const y0 = y0Accessor ?? ((d) => 0)
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor({ data, xAccessor, yAccessor, xScale, yScale, curve, color, defined }: ILine) {
// cry if no data was passed
if (!data) throw new Error('line needs data')
this.data = data
this.color = color ?? 'black'
- 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 normalizePoints
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
normalizePoints({
points,
nested,
aggregate,
defined
- 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 mountBrush
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
mountBrush(whichBrush?: BrushType): void {
// if no brush is specified, there's nothing to mount
if (!whichBrush) return
// brush can only be mounted after content is set
- 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"