Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

                <div className="w-full">
                  <label htmlFor="company" className="font-bold ">
                    Company name
                  </label>
                  <input
Severity: Major
Found in marketing/src/containers/contact/component.tsx and 7 other locations - About 2 hrs to fix
marketing/src/containers/contact/component.tsx on lines 167..181
marketing/src/containers/contact/component.tsx on lines 183..197
marketing/src/containers/methodology-form/component.tsx on lines 85..99
marketing/src/containers/methodology-form/component.tsx on lines 101..115
marketing/src/containers/methodology-form/component.tsx on lines 117..131
marketing/src/containers/methodology/stay-up-to-date/component.tsx on lines 95..109
marketing/src/containers/newsletter/component.tsx on lines 91..105

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 91.

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

        <div>
          <h1 className="mb-2 text-5xl font-semibold text-gray-900">Page not found</h1>

          <p className="font-medium leading-5 text-gray-400">
            Sorry, we couldn&apos;t find Page you are looking for.
Severity: Major
Found in marketing/src/pages/404.tsx and 1 other location - About 2 hrs to fix
client/src/pages/404.tsx on lines 30..45

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 91.

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

        <div>
          <h1 className="mb-2 text-5xl font-semibold text-gray-900">Page not found</h1>

          <p className="font-medium leading-5 text-gray-400">
            Sorry, we couldn&apos;t find Page you are looking for.
Severity: Major
Found in client/src/pages/404.tsx and 1 other location - About 2 hrs to fix
marketing/src/pages/404.tsx on lines 14..29

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 91.

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 AdminTargetsPage has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AdminTargetsPage: React.FC = () => {
  const { data: indicators } = useIndicators(undefined, { select: (data) => data.data });
  const { isLoading } = useTargets();
  const hasData = useMemo(() => indicators?.length > 0, [indicators]);

Severity: Major
Found in client/src/pages/data/targets.tsx - About 2 hrs to fix

    Function Newsletter has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Newsletter: React.FC = () => {
      const [status, setStatus] = useState(DEFAULT_STATUS);
      const { basePath } = useRouter();
    
      const onSubmit = (values) => {
    Severity: Major
    Found in landing/components/newsletter/component.tsx - About 2 hrs to fix

      Function calculateIndicatorValues has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private calculateIndicatorValues(
          rawData: SourcingRecordsWithIndicatorRawData,
          tonnage: number,
        ): Map<INDICATOR_NAME_CODES, number> {
          const map: Map<INDICATOR_NAME_CODES, number> = new Map();

        Function _getFlowLayerPickingInfo has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          private async _getFlowLayerPickingInfo(
            info: Record<string, any>,
          ): Promise<FlowLayerPickingInfo<L, F> | undefined> {
            const { index, sourceLayer } = info;
            const { dataProvider, accessors } = this.state || {};
        Severity: Minor
        Found in cookie-traceability/src/lib/flowmap/layers/FlowMapLayer.ts - About 2 hrs 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

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

                          <div>
                            <div className="mb-1">Origins</div>
                            <OriginRegions
                              options={originOptions}
                              multiple
        client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 213..224
        client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 225..236
        client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 354..365

        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 90.

        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

                          <div>
                            <div className="mb-1">Material</div>
                            <Materials
                              options={materialOptions}
                              multiple
        client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 213..224
        client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 225..236
        client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 380..391

        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 90.

        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

                          <div>
                            <div className="mb-1">Origins</div>
                            <OriginRegions
                              options={originOptions}
                              multiple
        client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 213..224
        client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 354..365
        client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 380..391

        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 90.

        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

                          <div>
                            <div className="mb-1">Material</div>
                            <Materials
                              options={materialOptions}
                              multiple
        client/src/containers/analysis-eudr/filters/more-filters/index.tsx on lines 225..236
        client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 354..365
        client/src/containers/analysis-visualization/analysis-filters/more-filters/component.tsx on lines 380..391

        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 90.

        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

              updateProfile.mutate(data, {
                onSuccess: () => {
                  toast.success('Your changes were successfully saved.');
                },
                onError: (error: ErrorResponse) => {
        Severity: Major
        Found in client/src/containers/update-profile-form/component.tsx and 1 other location - About 2 hrs to fix
        client/src/containers/update-password-form/component.tsx on lines 41..49

        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 90.

        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

          private createScenarioVsScenarioImpactTableDataByIndicator(
            indicator: Indicator,
            groupBy: GROUP_BY_VALUES,
          ): ScenarioVsScenarioImpactTableDataByIndicator {
            return {
        api/src/modules/impact/comparison/actual-vs-scenario.service.ts on lines 422..434
        api/src/modules/impact/impact.service.ts on lines 487..499

        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 90.

        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

          private createImpactTableDataByIndicator(
            indicator: Indicator,
            groupBy: GROUP_BY_VALUES,
          ): ImpactTableDataByIndicator {
            return {
        Severity: Major
        Found in api/src/modules/impact/impact.service.ts and 2 other locations - About 2 hrs to fix
        api/src/modules/impact/comparison/actual-vs-scenario.service.ts on lines 422..434
        api/src/modules/impact/comparison/scenario-vs-scenario.service.ts on lines 516..528

        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 90.

        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

                {
                  onSuccess: () => {
                    toast.success('Your changes were successfully saved.');
                  },
                  onError: (error: ErrorResponse) => {
        Severity: Major
        Found in client/src/containers/update-password-form/component.tsx and 1 other location - About 2 hrs to fix
        client/src/containers/update-profile-form/component.tsx on lines 33..41

        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 90.

        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

          private createActualVsScenarioImpactTableDataByIndicator(
            indicator: Indicator,
            groupBy: GROUP_BY_VALUES,
          ): ActualVsScenarioImpactTableDataByIndicator {
            return {
        api/src/modules/impact/comparison/scenario-vs-scenario.service.ts on lines 516..528
        api/src/modules/impact/impact.service.ts on lines 487..499

        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 90.

        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

        File scenario-intervention.repository.ts has 281 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { DataSource, InsertResult, QueryRunner, Repository } from 'typeorm';
        import { ScenarioIntervention } from 'modules/scenario-interventions/scenario-intervention.entity';
        import { SourcingLocation } from 'modules/sourcing-locations/sourcing-location.entity';
        import { SourcingRecord } from 'modules/sourcing-records/sourcing-record.entity';
        import { IndicatorRecord } from 'modules/indicator-records/indicator-record.entity';

          Function subchartData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const subchartData = useMemo(() => {
              const {
                indicatorShortName,
                rows,
                yearSum,
          Severity: Major
          Found in client/src/containers/analysis-chart/impact-chart/component.tsx - About 2 hrs to fix

            Function Values has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Values: React.FC = () => {
              return (
                <section className="relative z-10 overflow-hidden bg-white">
                  <Wrapper>
                    <FadeIn className="relative flex flex-col items-center justify-center py-12 space-y-20 md:py-32">
            Severity: Major
            Found in marketing/src/containers/about/values/component.tsx - About 2 hrs to fix

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

                      <header className="relative">
                        <div className="relative z-10 space-y-5 md:space-y-12">
                          <h2 className="text-xl font-black uppercase font-display">Prioritize</h2>
                          <h3 className="text-4xl font-black uppercase md:text-6xl font-display">
                            YOUR SUSTAINABLE ACTIONS.
              Severity: Major
              Found in marketing/src/containers/the-service/steps/04/component.tsx and 3 other locations - About 2 hrs to fix
              marketing/src/containers/the-service/steps/01/component.tsx on lines 11..19
              marketing/src/containers/the-service/steps/02/component.tsx on lines 18..28
              marketing/src/containers/the-service/steps/03/component.tsx on lines 13..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 89.

              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

              Severity
              Category
              Status
              Source
              Language