Showing 438 of 1,408 total issues
Function baseQueryExtend
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const baseQueryExtend = (baseQuery: SelectQueryBuilder<any>): void => {
//Having a scenarioId present as an argument, will change the query to include
// *all* indicator records of the interventions pertaining to that scenario (both
// the CANCELLED and REPLACING records)
if (dto.scenarioId) {
Function validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate(longitudeInput: number, args: ValidationArguments): boolean {
if (
(args.object as SourcingDataExcelValidator).location_type ===
LOCATION_TYPES.UNKNOWN ||
(args.object as SourcingDataExcelValidator).location_type ===
Function validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate(latitudeInput: number, args: ValidationArguments): boolean {
if (
(args.object as SourcingDataExcelValidator).location_type ===
LOCATION_TYPES.UNKNOWN ||
(args.object as SourcingDataExcelValidator).location_type ===
Function Video
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Video: React.FC = () => {
const videoRef = useRef<HTMLVideoElement>();
const { ref, inView } = useInView();
useEffect(() => {
Function buildQueryForImport
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildQueryForImport(nameCodes: INDICATOR_NAME_CODES[]): {
params: string;
query: string;
} {
const importQueryFields: string[] = [
Function open_clean
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def open_clean(file, data_type):
# Define the units available for conversion
units_to_tonnes = {"100 g/An": 100000, "100 mg/An": 1000000, "LSU/ha": 1}
# 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 ComparisonCell
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ComparisonCell: React.FC<ComparisonCellProps> = ({
value,
scenarioValue,
absoluteDifference,
percentageDifference,
- 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 getColors
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function getColors(
diffMode: boolean,
schemeKey: string | undefined,
darkMode: boolean,
fadeEnabled: boolean,
- 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 filterMaterialTree
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static filterMaterialTree(root: Material): Material[] {
let result: Material[] = [];
if (!root.materialToH3s || root.materialToH3s.length === 0) {
if (root.children) {
root.children.forEach((child: Material) => {
- 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 getFlowMagnitudeExtent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getFlowMagnitudeExtent(
state: FlowMapState,
props: FlowMapData<L, F>,
): [number, number] | undefined {
if (state.settingsState.adaptiveScalesEnabled) {
- 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 insert_to_h3_master_table
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def insert_to_h3_master_table(
Function main
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def main(folder: Path, table: str, data_type: str, dataset: str, year: int, h3_res: int, thread_count: int):
Function insert_to_h3_data_and_contextual_layer_tables
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def insert_to_h3_data_and_contextual_layer_tables(
Function DatesRange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const DatesRange = (): JSX.Element => {
const dispatch = useAppDispatch();
const {
filters: { dates },
} = useAppSelector(eudrDetail);
- 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 DataUploader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const DataUploader: React.FC<DataUploaderProps> = ({ variant = 'default', onUploadInProgress }) => {
const [currentTaskId, setCurrentTaskId] = useState<Task['id']>(null);
const router = useRouter();
const uploadDataSource = useUploadDataSource();
const lastTask = 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 ZoomControl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const ZoomControl: React.FC<ZoomControlProps> = ({ className, mapId = 'default' }) => {
const { [mapId]: mapRef } = useMap();
const zoom = mapRef?.getZoom();
const minZoom = mapRef?.getMinZoom();
const maxZoom = mapRef?.getMaxZoom();
- 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 deeply nested control flow statements. Open
if dry_run:
print(contextuals_to_drop)
return
cursor.execute(
Function DatesRange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const DatesRange = (): JSX.Element => {
const dispatch = useAppDispatch();
const {
filters: { dates },
} = useAppSelector(eudr);
- 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 deeply nested control flow statements. Open
for table in tables_to_drop:
cursor.execute(f"DROP TABLE {table[0]}")
log.info(f"Deleted tables {', '.join(table[0] for table in tables_to_drop)}")
Function to_the_db
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def to_the_db(df: pd.DataFrame, table: str, data_type: str, dataset: str, year: int, h3_res: int):