Showing 269 of 3,565 total issues
Function optimizeXAxisLabel
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static optimizeXAxisLabel(root: Unit, settings: ChartSettings) {
const {xAxisTickLabelLimit} = settings;
const enterSpec = (rootUnit: Unit) => {
- 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 hideAxisTicks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static hideAxisTicks(root: Unit, settings: ChartSettings, axis: 'x' | 'y') {
const enterSpec = (rootUnit: Unit) => {
const pad = (axis === 'x' ? 'b' : 'l');
const g = rootUnit.guide;
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
constructor(xSource: DataFrame, scaleConfig: ScaleConfig) {
super(xSource, scaleConfig);
var discrete = (scaleConfig.dimType !== 'measure');
- 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 extractFieldsFormatInfo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static extractFieldsFormatInfo(spec: GPLSpec) {
var specScales = spec.scales;
var isEmptyScale = function (key: string) {
- 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 buildModel
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildModel(screenModel) {
const baseModel = BasePath.baseModel(screenModel);
const guide = this.node().config.guide;
Function generateRatioFunction
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function generateRatioFunction(dimPropName: string, paramsList: string[], chartInstanceRef: Plot) {
var unify = (v) => isDate(v) ? v.getTime() : v;
var dataNewSnap = 0;
Function template
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function template(text: string, settings?, oldSettings?): (data?) => string {
if (!settings && oldSettings) {
settings = oldSettings;
}
settings = defaults({}, settings, templateSettings);
Function niceZeroBased
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function niceZeroBased(domain: number[]) {
var m = 10;
var low = parseFloat(Math.min(...domain).toFixed(15));
Function getDrawScenarioQueue
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
getDrawScenarioQueue(root: GrammarElement) {
const grammarRules = this.grammarRules;
var scaleInfoQueue = this._flattenDrawScenario(root, (parentInstance, unit, rootFrame) => {
// Rule to cancel parent frame inheritance
const frame = (unit.expression.inherit === false) ? null : rootFrame;
Function _flattenDrawScenario
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_flattenDrawScenario(
root: GrammarElement,
iterator: (parentInstance: GrammarElement, unit: Unit, rootFrame: DataFrame) => GrammarElement
) {
Function auto
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
auto: (config) => {
var xs = config.x;
var ys = config.y;
var primaryX = xs[xs.length - 1];
var secondaryX = xs.slice(0, xs.length - 1);
Function ruleInferExpression
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
ruleInferExpression(srcUnit: Unit) {
var expr = {
operator: 'none',
params: []
Function getCirclesCurveTangents
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getCirclesCurveTangents(a: Point, ca: Point, cb: Point, b: Point) {
var d = dist(a, b);
if (d === 0 ||
(d + a.size / 2 <= b.size / 2) ||
(d + b.size / 2 <= a.size / 2)
Function isYFunctionOfX
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
isYFunctionOfX: (data: any[], xFields: string[], yFields: string[]) => {
var isRelationAFunction = true;
var error: {type: string; keyX: string; keyY: string; valX: string; errY: [string, string]} = null;
// domain should has only 1 value from range
try {
Function auto
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
auto: (config) => {
var xs = config.x;
var ys = config.y;
var primaryX = xs[xs.length - 1];
var secondaryX = xs.slice(0, xs.length - 1);
Function sortByDim
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
sortByDim: function (data: any[], dimName: string, dimInfo: Dimension) {
var rows = data;
var interceptor = (['period', 'time'].indexOf(dimInfo.scale) >= 0) ?
(x => new Date(x)) :
Function ruleInferExpression
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ruleInferExpression(srcUnit: Unit) {
var expr = {
operator: 'none',
params: []
- 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 selectOrAppend
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function selectOrAppend(_container: Element | d3Selection, selector: string) {
var delimitersActions = {
'.': (text, el) => el.classed(text, true),
'#': (text, el) => el.attr('id', text)
};
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(xSource: DataFrame, scaleConfig: ScaleConfig) {
super(xSource, scaleConfig);
var props = this.scaleConfig;
Function d3_createPathTween
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
var d3_createPathTween = (
attr,
pathStringBuilder,
pointConvertors,
idGetter,