Showing 1,408 of 1,408 total issues
Function DataUploadError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const DataUploadError: React.FC<DataUploadErrorProps> = ({ task }) => {
const [open, setOpen] = useState(true);
const updateTask = useUpdateTask();
const { data: profile, isLoading: profileIsLoading } = useProfile();
- 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 Input
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
({ className, error, icon, type = 'text', unit, showHint = true, ...inputProps }, ref) => (
<>
<div className={classnames('relative rounded-md shadow-sm', className)}>
{icon && (
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
- 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 setTooltipData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
setTooltipData: (state, action: PayloadAction<TooltipData>) => {
const exists = !!state.tooltipData.find(({ id }) => action.payload.id === id);
// Remove tooltip is value is undefined but not zero
if (exists && !action.payload.value && action.payload.value !== 0) {
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 AdminEditTargetModal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const AdminEditTargetModal: React.FC<EditTargetModalProps> = ({ title, open, onDismiss }) => {
const { data, isLoading } = useSourcingRecordsYears();
const { data: targets } = useTargets();
const [selectedOption, setSelectedOption] = useState<Option<number>>(null);
- 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 nominatim_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def nominatim_request(params, request_type="search", pause=1, error_pause=60):
"""
Send a HTTP GET request to the Nominatim API and return JSON response.
Parameters
----------
- 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 open_clean
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def open_clean(file):
# Define the units available for conversion
units_to_tonnes = {"100 g/An": 100000, "100 mg/An": 1000000}
# Open the file
- 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 Pagination
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Pagination: React.FC<PaginationProps> = ({
className,
currentPage,
isLoading = false,
onPageChange,
- 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 buildTags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const buildTags = ({ title, titleTemplate, defaultTitle }: TitleTemplateProps) => {
const tagsToRender: React.ReactNode[] = [];
if (titleTemplate) {
defaults.titleTemplate = titleTemplate;
- 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 CustomTooltip
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CustomTooltip: React.FC<CustomTooltipProps> = ({ payload }) => {
const { comparisonMode } = useAppSelector(scenarios);
const tooltipData = uniqBy(payload, 'stroke');
// We will assume that actual-data is the first item and the scenario is the second one
const baseValue = tooltipData[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 AdminDataPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const AdminDataPage: React.FC = () => {
const { push, query } = useRouter();
const [sorting, setSorting] = useState<SortingState>([]);
const { data: session } = useSession();
const { data: task } = useLasTask();
- 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 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"