Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

Function cluster has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function cluster(points: Point[], zoom: number, tree: ZoomLevelKDBush, options: Options) {
  const clusters: Point[] = [];
  const { radius, extent } = options;
  const r = radius / (extent * Math.pow(2, zoom));

Severity: Minor
Found in cookie-traceability/src/lib/flowmap/data/cluster/cluster.ts - About 1 hr to fix

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      emitGeocodingProgress(importProgress: {
        taskId?: string;
        progress: number;
      }): void {
        this.eventBus.publish(
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 21..31
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 33..43
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 57..67

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      async getSuppliersTreeWithSourcingLocations(
        options: GetSupplierByType,
        withAncestry: boolean = true,
      ): Promise<any> {
        const supplierLineage: Supplier[] =
    Severity: Major
    Found in api/src/modules/suppliers/suppliers.service.ts and 2 other locations - About 1 hr to fix
    api/src/modules/admin-regions/admin-regions.service.ts on lines 183..196
    api/src/modules/business-units/business-units.service.ts on lines 85..98

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      emitValidationProgress(importProgress: {
        taskId?: string;
        progress: number;
      }): void {
        this.eventBus.publish(
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 33..43
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 45..55
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 57..67

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      async getAdminRegionWithSourcingLocations(
        adminRegionTreeOptions: GetAdminRegionTreeWithOptionsDto,
        withAncestry: boolean = true,
      ): Promise<AdminRegion[]> {
        const adminRegionLineage: AdminRegion[] =
    Severity: Major
    Found in api/src/modules/admin-regions/admin-regions.service.ts and 2 other locations - About 1 hr to fix
    api/src/modules/business-units/business-units.service.ts on lines 85..98
    api/src/modules/suppliers/suppliers.service.ts on lines 142..155

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      async getBusinessUnitWithSourcingLocations(
        businessUnitTreeOptions: GetBusinessUnitTreeWithOptionsDto,
        withAncestry: boolean = true,
      ): Promise<BusinessUnit[]> {
        const businessUnitsLineage: BusinessUnit[] =
    Severity: Major
    Found in api/src/modules/business-units/business-units.service.ts and 2 other locations - About 1 hr to fix
    api/src/modules/admin-regions/admin-regions.service.ts on lines 183..196
    api/src/modules/suppliers/suppliers.service.ts on lines 142..155

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      emitImportProgress(importProgress: {
        taskId?: string;
        progress: number;
      }): void {
        this.eventBus.publish(
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 21..31
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 45..55
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 57..67

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      emitImpactCalculationProgress(importProgress: {
        taskId?: string;
        progress: number;
      }): void {
        this.eventBus.publish(
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 21..31
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 33..43
    api/src/modules/events/import-data/import-progress.emitter.ts on lines 45..55

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const applicationSlice = createSlice({
      name: 'application',
      initialState,
      reducers: {
        setMenuMobileOpen: (state, action: PayloadAction<boolean>) => ({
    Severity: Major
    Found in marketing/src/store/features/ui/index.ts and 1 other location - About 1 hr to fix
    client/src/store/features/ui/index.ts on lines 16..25

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const applicationSlice = createSlice({
      name: 'application',
      initialState,
      reducers: {
        setMenuMobileOpen: (state, action: PayloadAction<boolean>) => ({
    Severity: Major
    Found in client/src/store/features/ui/index.ts and 1 other location - About 1 hr to fix
    marketing/src/store/features/ui/index.ts on lines 14..23

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function result has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const result = useMemo(() => {
        if (intervention.type === InterventionTypes.Material) {
          return (
            <>
              Switch {materials} to <strong>{newMaterial}</strong> in {year}
    Severity: Minor
    Found in client/src/containers/interventions/phrase/component.tsx - About 1 hr to fix

      Function eudrSupplierLayer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const eudrSupplierLayer = useMemo(() => {
          if (!filteredGeometries?.features || !data) return null;
      
          return new GeoJsonLayer<(typeof filteredGeometries)['features'][number]>({
            id: 'full-plots-layer',
      Severity: Minor
      Found in client/src/containers/analysis-eudr/map/component.tsx - About 1 hr to fix

        Function eudrSupplierLayer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const eudrSupplierLayer = useMemo(() => {
            if (!filteredGeometries?.features || !data) return null;
        
            return new GeoJsonLayer<(typeof filteredGeometries)['features'][number]>({
              id: 'full-plots-layer',
        Severity: Minor
        Found in client/src/containers/analysis-eudr/map/compare.tsx - About 1 hr to fix

          Function applyRankingProcessing has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async applyRankingProcessing(
              rankedImpactTableDto: GetRankedImpactTableDto,
              impactTable: ImpactTable,
            ): Promise<ImpactTable> {
              // Since it's a TOP ranking, DESCENDENT sort will be the default if no sort option is provided
          Severity: Minor
          Found in api/src/modules/impact/impact.service.ts - About 1 hr to fix

            Function initializeState has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              initializeState(): void {
                const attributeManager = this.getAttributeManager();
            
                /* eslint-disable max-len */
                attributeManager.addInstanced({

              Function initializeState has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                initializeState(): void {
                  const { attributeManager } = this.state;
              
                  attributeManager.addInstanced({
                    instanceSourcePositions: {

                Function Legend has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                export const Legend: React.FC = () => {
                  const [showLegend, setShowLegend] = useState<boolean>(true);
                  const [showSettings, setShowSettings] = useState<boolean>(false);
                
                  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 ChartCell has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                const ChartCell: FC<ChartCellProps> = ({ data }) => {
                  const parsedData: ResultChartData[] = sortBy(
                    data?.map((d) => ({
                      year: d.year,
                      value: !d.isProjected ? d.value : null,

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

                const Select = <T,>({
                  value,
                  defaultValue,
                  error,
                  icon,
                Severity: Minor
                Found in client/src/components/forms/select/component.tsx - About 1 hr 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 populateValuesRecursively has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  private populateValuesRecursively(
                    entity: ScenarioVsScenarioImpactTableRows,
                    entityDataMap: Map<
                      string,
                      Map<number, ScenarioVsScenarioImpactTableRowsValues>
                Severity: Minor
                Found in api/src/modules/impact/comparison/scenario-vs-scenario.service.ts - About 1 hr 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