Showing 269 of 3,565 total issues
Function onBrushEventHandler
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var onBrushEventHandler = () => {
var targetKey = Object.keys(columnsBrushes)
.find((k) => columnsBrushes[k] === d3Selection.event.target);
Function from
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function from(arrayLike/*, mapFn, thisArg */) {
var C = this;
var items = Object(arrayLike);
if (arrayLike == null) {
throw new TypeError('Array.from requires an array-like object - not null or undefined');
Function updateTicks
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateTicks(ticks: TickDataBinding) {
take(ticks)
.then(({tickEnter, tickExit, tick}) => {
Function experimentalShouldAnimate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
experimentalShouldAnimate: (spec) => {
const createSvg = (tag, attrs) => {
var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
Object.keys(attrs).forEach((k) => el.setAttribute(k, String(attrs[k])));
return el;
Function drawLines
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function drawLines(ticks: TickDataBinding) {
const ly = (ko * tickSize);
const lx = (isOrdinalScale ? ((d) => (kh * scale.stepSize(d) / 2)) : null);
take(ticks)
Function create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create() {
var props = this.scaleConfig;
var varSet = this.vars;
Function get
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get: (typeName, settings, srcSpec, fnCreateScale) => {
var engine = (SpecEngineTypeMap[typeName] || SpecEngineTypeMap.NONE);
var meta: EngineMeta = {
Function create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create(interval: [number, number]) {
var props = this.scaleConfig;
var varSet = this.vars;
Function ruleApplyDefaults
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ruleApplyDefaults(spec: GPLSpec) {
var settings = spec.settings || {};
var traverse = (node, iterator, parentNode) => {
Function validateAxis
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function validateAxis(dimensions: ChartDimensionsMap, axis: string[], axisName: string) {
return axis.reduce(function (result, item, index) {
var dimension = dimensions[item];
if (!dimension) {
result.status = status.FAIL;
Function _renderRoot
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_renderRoot({scenario, newSize}: {scenario: GrammarElement[]; newSize: Size;}) {
const d3Target = d3.select(this._layout.content);
var frameRootId = scenario[0].config.uid;
var svg = selectOrAppend(d3Target, `svg`)
.attr('width', Math.floor(newSize.width))
Function extendLogScale
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function extendLogScale(scale) {
var d3ScaleCopy = scale.copy;
// NOTE: D3 log scale ticks count is not configurable
// and returns 10 ticks per each exponent.
Function getStepLine
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getStepLine(points: Point[]) {
var result: Point[] = [];
var hasId = (points[0].id !== undefined);
var hasSize = (points[0].size !== undefined);
for (var i = 1, p0, p1, m0, m1; i < points.length; i++) {
Function update
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var update = function (elements: d3Selection) {
elements
.style('fill', color)
.style('font-size', `${self.guide.fontSize}px`)
.style('display', ((__, i) => labels[i].hide ? 'none' : null))
Function getFacetGroups
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var getFacetGroups = (root: Unit) => {
if (root.type === 'COORDS.RECT') {
root.frames.forEach((f) => {
if (f.key) {
var keys = Object.keys(f.key);
Function getAxisTickLabelSize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getAxisTickLabelSize(text: string) {
var div = document.createElement('div');
div.style.position = 'absolute';
div.style.visibility = 'hidden';
div.style.width = '100px';
Function _initPointerEvents
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_initPointerEvents() {
if (!this._liveSpec.settings.syncPointerEvents) {
this._pointerAnimationFrameId = null;
}
const svg = d3.select(this._svg);
Function parallel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(memo, f) => {
var absFiber = f.map((row) => {
return {
data: row,
x: m.x(row) + m.dx(row),
Function buildModel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
buildModel(screenModel) {
const config = this.node().config;
const guide = config.guide;
const options = config.options;
- 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 normal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
normal(srcSize, calcSize, specRef, tryOptimizeSpec) {
const {yFacetCount} = getFacetCount(specRef);
if (yFacetCount > 0) {
SpecTransformOptimize.facetsLabelsAtTop(specRef.unit, specRef.settings);
- 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"