Showing 33 of 55 total issues
Function parseData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static parseData(results, text, value): IResultFormat[] {
const data: IResultFormat[] = [];
if (!results || results.length === 0) {
return data;
}
- 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(datasourceSrv) {
this.defaultAuthenticationType = 'jwt';
this.defaultFlatRateProject = undefined;
this.defaultProcessingLocation = undefined;
this.datasourceSrv = datasourceSrv;
- 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($scope, $injector, private templateSrv, private $q, private uiSegmentSrv) {
super($scope, $injector);
this.queryModel = new BigQueryQuery(this.target, templateSrv, this.panel.scopedVars);
this.updateProjection();
this.formats = [
- 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
Avoid too many return
statements within this function. Open
return {
rows,
schema,
};
Function _handelWildCardTables
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private _handelWildCardTables(tables) {
let sorted = new Map();
let newTables = [];
for (const t of tables) {
const partitioned = t.text.indexOf('__partitioned');
- 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 setUpPartition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private setUpPartition(query, isPartitioned, partitionedField, options, hasMacro = false, convertToUTC = false) {
partitionedField = partitionedField ? partitionedField : '_PARTITIONTIME';
const hasTimeFilter = !!(BigQueryQuery.hasDateFilter(query.split(/where/gi)[1] || "") || hasMacro);
if (isPartitioned && !hasTimeFilter) {
const { from: { _d: fromD }, to: { _d: toD } } = options.range;
- 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 getDefaultProject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public async getDefaultProject() {
try {
if (this.authenticationType === 'gce' || !this.projectName) {
const data = await this.getProjects();
this.projectName = data[0].value;
- 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 _updateAlias
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private _updateAlias(q, options, shiftstr) {
if (shiftstr !== undefined) {
const index = shiftstr.search(Shifted);
const shifted = shiftstr.substr(index, shiftstr.length);
for (const al of options.targets[0].select[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 _getInterval
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static _getInterval(q, alias: boolean) {
const interval: string[] = [];
const res = alias
? q.match(/(\$__timeGroupAlias\(([\w._]+,)).*?(?=\))/g)
: q.match(/(\$__timeGroup\(([\w_.]+,)).*?(?=\))/g);
- 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 _buildAggregate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public _buildAggregate(aggregate, query) {
if (aggregate) {
const func = aggregate.params[0];
switch (aggregate.type) {
case 'aggregate':
- 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 _setupTimeShiftQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static _setupTimeShiftQuery(query, options) {
const index = query.format.indexOf('#');
const copy = options.constructor();
for (const attr in options) {
if (options.hasOwnProperty(attr)) {
- 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 tableChanged
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public tableChanged() {
this.target.sharded = false;
this.target.partitioned = false;
this.target.partitionedField = '';
this.target.table = this.tableSegment.value;
- 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 addGroup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public addGroup(partType: string, value: string) {
this._setGroupParts(partType, value);
// add aggregates when adding group by
for (const selectParts of this.selectParts) {
if (!selectParts.some(part => part.def.type === 'aggregate')) {
- 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"