Showing 438 of 1,408 total issues
Function AdminDataPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const AdminDataPage: React.FC = () => {
const { data, isFetched: sourcingLocationsAreFetched } = useSourcingLocations({
fields: 'updatedAt',
'page[number]': 1,
'page[size]': 1,
- 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 getAdminRegionDescendants
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async getAdminRegionDescendants(
adminRegionIds: string[],
options?: { fullEntities?: boolean; treeResponse?: boolean },
): Promise<any> {
// using type casting not to search for and r
- 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 getContextualLayerH3
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async getContextualLayerH3(
contextualLayerId: string,
resolution?: number,
year?: number,
): Promise<{
- 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 addEntityFiltersToQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private addEntityFiltersToQuery(
selectQueryBuilder: SelectQueryBuilder<SourcingRecord>,
impactDataDto: GetActualVsScenarioImpactTableDto | GetImpactTableDto,
): SelectQueryBuilder<SourcingRecord> {
if (impactDataDto.materialIds) {
- 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 geoCodeSourcingLocation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async geoCodeSourcingLocation(
locationInfo: locationInfo,
): Promise<SourcingLocation> {
let geoCodedSourcingLocation: Partial<SourcingData> = {};
if (locationInfo.locationType === LOCATION_TYPES.UNKNOWN) {
- 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 getDataForImpactTable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getDataForImpactTable(
impactTableDto: AnyImpactTableDto,
entities: ImpactTableEntityType[],
): Promise<ImpactTableData[]> {
if (entities.length) {
- 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 addOrganisationalEntityFilters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private addOrganisationalEntityFilters(
baseImpactMapFilters: BaseImpactMapFiltersType,
queryBuilder: { subQueryBuilder: SelectQueryBuilder<any> },
): SelectQueryBuilder<any> {
const {
- 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 populateValuesRecursively
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private populateValuesRecursively(
entity: ImpactTableRows,
entityMap: Map<string, Map<number, ImpactTableRowsValues>>,
rangeOfYears: number[],
): ImpactTableRowsValues[] {
- 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 createIndicatorRecordsBySourcingRecords
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async createIndicatorRecordsBySourcingRecords(
sourcingData: {
sourcingRecordId: string;
geoRegionId: string;
materialId: 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 defaultMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
defaultMessage(args: ValidationArguments): string {
if (
(args.object as SourcingDataExcelValidator).location_type ===
LOCATION_TYPES.UNKNOWN ||
(args.object as SourcingDataExcelValidator).location_type ===
- 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 getFlowAndCircleColors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getFlowAndCircleColors(
inputColors: FlowAndCircleColors | undefined,
defaultFlowColorScheme: string[],
darkMode: boolean,
): FlowAndCircleColorsRGBA {
- 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 calculateIndicatorValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private calculateIndicatorValues(
rawData: SourcingRecordsWithIndicatorRawData,
tonnage: number,
): Map<INDICATOR_NAME_CODES, number> {
const map: Map<INDICATOR_NAME_CODES, number> = new Map();
- 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 updateState
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
updateState({ oldProps, props, changeFlags }: Record<string, any>): void {
const { dataProvider, highlightedObject } = this.state || {};
if (!dataProvider) {
return;
}
- 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 Alerts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Alerts: React.FC<AlertsProps> = ({ className, items }: AlertsProps) => {
if (!items) return null;
if (Array.isArray(items) && !items.length) return null;
const alerts = Array.isArray(items) ? items : [items];
- 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 getLocationAreaColorsRGBA
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getLocationAreaColorsRGBA(
colors: LocationAreaColors | undefined,
darkMode: boolean,
): LocationAreaColorsRGBA {
const normalColor = (colors && colors.normal) || DEFAULT_LOCATION_AREA_COLOR;
- 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 buildQueryForImport
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
buildQueryForImport(nameCodes: INDICATOR_NAME_CODES[]): {
params: string;
query: string;
} {
const importQueryFields: 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 getTimeGranularityForDate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getTimeGranularityForDate(date: Date): TimeGranularity {
let prev = undefined;
for (const current of TIME_GRANULARITIES) {
const { interval } = current;
const floored = interval(date);
- 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 validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async validate(sheet: SourcingDataSheet): Promise<any> {
const progressTracker: ValidationProgressTracker =
this.getProgressTracker(sheet);
const validationErrors: ImportTaskError[] = [];
- 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"