Vizzuality/landgriffon

View on GitHub

Showing 438 of 1,408 total issues

Function fix_invalid_geometries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def fix_invalid_geometries(gdf):
    """
    Identify and fix invalid geometries in a GeoDataFrame.

    Parameters:
Severity: Minor
Found in data/preprocessing/unsustainable_water_use/preprocess_data.py - About 45 mins to fix

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 storeToQueryParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const storeToQueryParams = ({
  startYear,
  indicators,
  materials,
  businessUnits,
Severity: Minor
Found in client/src/hooks/h3-data/utils.ts - About 45 mins to fix

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 ScenariosComponent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const ScenariosComponent: React.FC<{ scrollref?: MutableRefObject<HTMLDivElement> }> = ({
  scrollref,
}) => {
  const { query, push } = useRouter();
  const { scenarioId = ACTUAL_DATA.id } = query;
Severity: Minor
Found in client/src/containers/analysis-sidebar/component.tsx - About 45 mins to fix

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 UserForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const UserForm = ({ user, onSubmit, children }: UserFormProps) => {
  const roleOptions = Object.values(RoleName).map((role) => ({ label: role, value: role }));

  const {
    register,
Severity: Minor
Found in client/src/containers/edit-user/user-form.tsx - About 45 mins to fix

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 saveListToTree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public async saveListToTree(
    importData: CreateDto[],
    pathKey: keyof CreateDto,
  ): Promise<Entity[]> {
    let rest: (CreateDto & WithExplodedPath)[] = importData.map(
Severity: Minor
Found in api/src/utils/tree.repository.ts - About 45 mins to fix

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 parseTime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function parseTime(input: string | Date | undefined): Date | undefined {
  if (input != null) {
    if (input instanceof Date) {
      return input;
    }
Severity: Minor
Found in cookie-traceability/src/lib/flowmap/data/time.ts - About 45 mins to fix

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 _getHighlightedObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  private _getHighlightedObject(info: Record<string, any>): HighlightedObject | undefined {
    const { index, sourceLayer } = info;
    if (index < 0) return undefined;
    if (sourceLayer instanceof FlowLinesLayer || sourceLayer instanceof AnimatedFlowLinesLayer) {
      const { lineAttributes } = this.state?.layersData || {};
Severity: Minor
Found in cookie-traceability/src/lib/flowmap/layers/FlowMapLayer.ts - About 45 mins to fix

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 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  diffMode: boolean,
  schemeKey: string | undefined,
  darkMode: boolean,
  fadeEnabled: boolean,
  fadeAmount: number,
Severity: Minor
Found in cookie-traceability/src/lib/flowmap/data/colors.ts - About 45 mins to fix

    Function insert_in_contextuals_table has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def insert_in_contextuals_table(name, category, metadata, tiler_url, default_params=None) -> str:
    Severity: Minor
    Found in data/h3_data_importer/cog_to_contextual_layer_linker.py - About 35 mins to fix

      Function insert_h3_grid_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def insert_h3_grid_data(
      Severity: Minor
      Found in data/h3_data_importer/csv_to_h3_table.py - About 35 mins to fix

        Function createCluster has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          x: number,
          y: number,
          id: number,
          numPoints: number,
          weight: number,
        Severity: Minor
        Found in cookie-traceability/src/lib/flowmap/data/cluster/cluster.ts - About 35 mins to fix

          Function SignIn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const SignIn: NextPageWithLayout = () => {
            const [isLoading, setIsLoading] = useState<boolean>(false);
            const router = useRouter();
          
            const {
          Severity: Minor
          Found in client/src/pages/auth/signin.tsx - About 35 mins to fix

          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 AnalysisDynamicMetadata has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const AnalysisDynamicMetadata: FC<AnalysisDynamicMetadataTypes> = ({
            className,
          }: AnalysisDynamicMetadataTypes) => {
            const searchParams = useSearchParams();
            const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));

          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 DownloadMaterialsDataButton has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const DownloadMaterialsDataButton: React.FC = () => {
            const [isDownloading, setIsDownloading] = useState<boolean>(false);
          
            const {
              data: sourcingLocations,
          Severity: Minor
          Found in client/src/containers/admin/download-materials-data-button/component.tsx - About 35 mins to fix

          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 MaterialSettings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const MaterialSettings = ({
            layer,
            onChangeMaterial,
            onChange,
            materialId,

          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 getUserFullName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const getUserFullName = (user: User, options?: { replaceByEmail?: boolean }) => {
            if (!user) return '';
            const { fname, lname, email } = user;
            let name = '';
            if (fname) {
          Severity: Minor
          Found in client/src/utils/user-full-name.ts - About 35 mins to fix

          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 filterTree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const filterTree = <T extends HasChildren<T>>(
            tree: T,
            filter: (node: T) => boolean,
            depth = 0,
          ): T | null => {
          Severity: Minor
          Found in client/src/components/tree-select/utils.ts - About 35 mins to fix

          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 ImpactLayer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const ImpactLayer = () => {
            const searchParams = useSearchParams();
            const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));
          
            const dispatch = useAppDispatch();

          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 vector_file_to_h3dataframe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def vector_file_to_h3dataframe(
              filename: Path,
              column: str,
              h3_res: int = 6,
              layer: Union[str, None] = None,
          Severity: Minor
          Found in data/h3_data_importer/vector_folder_to_h3_table.py - About 35 mins to fix

          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 ScenarioItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const ScenarioItem = ({ scenario, isSelected }: ScenariosItemProps) => {
            const updatedAt = useMemo(
              () => (scenario.updatedAt ? new Date(scenario.updatedAt) : null),
              [scenario.updatedAt],
            );
          Severity: Minor
          Found in client/src/containers/scenarios/item/component.tsx - About 35 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language