Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

                    <Anchor
                      href={`/data/scenarios/${data.id}/interventions/new`}
                      variant="secondary"
                      className="text-gray-900"
                      icon={
Severity: Major
Found in client/src/pages/data/scenarios/[scenarioId]/edit.tsx and 1 other location - About 2 hrs to fix
client/src/pages/data/scenarios/[scenarioId]/edit.tsx on lines 148..162

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

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

const EUDRTool: React.FC = () => {
  return (
    <section className="relative bg-blue-600 bg-cover md:space-y-64">
      <Wrapper>
        <div className="space-y-12 text-white md:space-y-20 md:py-32 py-12">
Severity: Major
Found in marketing/src/containers/compliance/eudr-tool/component.tsx - About 2 hrs to fix

    Function Hero has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Hero: React.FC = () => {
      return (
        <section className="relative overflow-hidden bg-white">
          <Wrapper>
            <motion.div
    Severity: Major
    Found in marketing/src/containers/about/hero/component.tsx - About 2 hrs to fix

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

          for (const nameCode of nameCodes) {
            const queryObject: IndicatorNameCodeToQuery = this.queryMap[nameCode];
            for (const queryFunction of Object.values(queryObject)) {
              const querySegment: ImpactQueryExpression = queryFunction();
              queries.push(querySegment);
      api/src/modules/indicator-records/services/indicator-dependency-manager.service.ts on lines 46..52

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

      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

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

            for (const nameCode of nameCodes) {
              const queryObject: IndicatorNameCodeToQuery = this.queryMap[nameCode];
              for (const queryFunction of Object.values(queryObject)) {
                const querySegment: ImpactQueryExpression = queryFunction();
                queries.push(querySegment);
      api/src/modules/indicator-records/services/indicator-dependency-manager.service.ts on lines 22..28

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

      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

        {
          id: '1',
          content: (
            <div className="w-full">
              <div className="space-y-10">
      Severity: Major
      Found in marketing/src/containers/testimonials/component.tsx and 2 other locations - About 2 hrs to fix
      marketing/src/containers/testimonials/component.tsx on lines 34..52
      marketing/src/containers/testimonials/component.tsx on lines 53..70

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

      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

        {
          id: '3',
          content: (
            <div className="w-full">
              <div className="space-y-10">
      Severity: Major
      Found in marketing/src/containers/testimonials/component.tsx and 2 other locations - About 2 hrs to fix
      marketing/src/containers/testimonials/component.tsx on lines 15..33
      marketing/src/containers/testimonials/component.tsx on lines 34..52

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

      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

        {
          id: '2',
          content: (
            <div className="w-full">
              <div className="space-y-10">
      Severity: Major
      Found in marketing/src/containers/testimonials/component.tsx and 2 other locations - About 2 hrs to fix
      marketing/src/containers/testimonials/component.tsx on lines 15..33
      marketing/src/containers/testimonials/component.tsx on lines 53..70

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

      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 intervention-creation.cy.ts has 264 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      beforeEach(() => {
        cy.interceptAllRequests();
      
        cy.intercept('GET', '/api/v1/indicators?filter[status]=active&include=unit&sort=name', {
          fixture: 'indicators/withUnits',
      Severity: Minor
      Found in client/cypress/e2e/intervention-creation.cy.ts - About 2 hrs to fix

        H3DataRepository has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Injectable()
        export class H3DataRepository extends Repository<H3Data> {
          constructor(private dataSource: DataSource) {
            super(H3Data, dataSource.createEntityManager());
          }
        Severity: Minor
        Found in api/src/modules/h3-data/h3-data.repository.ts - About 2 hrs to fix

          Function createScenarioIntervention has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async createScenarioIntervention(
              dto: CreateScenarioInterventionDto,
            ): Promise<Partial<ScenarioIntervention>> {
              // Validate new location. If it's validated, get the geolocated info. If not, throw an exception
          
          

            Function Header has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Header: React.FC = () => {
              const [open, setOpen] = useState(false);
            
              const { scrollDirection } = useScrollDirection();
              const prevDirection = useRef<string | number>(0);
            Severity: Major
            Found in marketing/src/containers/header/component.tsx - About 2 hrs to fix

              Function ScienceBasedTargets has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ScienceBasedTargets: React.FC = () => {
                return (
                  <section className="relative space-y-12 bg-blue-600 md:py-8 overflow-hidden">
                    <Wrapper>
                      <div className="space-y-10 text-white md:space-y-20 md:py-32 py-12">

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

                          await this.adminRegionService.getClosestAdminRegionByCoordinates(
                            {
                              lng: geocodedResponseData?.data?.results[0]?.geometry.location
                                .lng,
                              lat: geocodedResponseData?.data?.results[0]?.geometry.location
                api/src/modules/geo-coding/strategies/point-of-production.geocoding.service.ts on lines 80..86

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

                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

                          await this.adminRegionService.getClosestAdminRegionByCoordinates(
                            {
                              lng: geoCodeResponseData?.data?.results[0]?.geometry.location.lng,
                              lat: geoCodeResponseData?.data?.results[0]?.geometry.location.lat,
                            },
                api/src/modules/geo-coding/strategies/aggregation-point.geocoding.service.ts on lines 148..156

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

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

                export const UploadTracker: FC = () => {
                  const queryClient = useQueryClient();
                  const [isSettingUp, setIsSettingUp] = useState(true);
                  const [tasksProgress, setTaskProgress] = useState<ProgressTask['data'] | undefined>(undefined);
                
                
                Severity: Major
                Found in client/src/containers/uploader/tracker/index.tsx - About 2 hrs to fix

                  Function SuppliersListTable has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const SuppliersListTable = (): JSX.Element => {
                    const dispatch = useAppDispatch();
                    // const [rowSelection, setRowSelection] = useState({});
                    // const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
                    // const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);

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

                  export function clusterLocations<L>(
                    locations: L[],
                    locationAccessors: LocationAccessors<L>,
                    getLocationWeight: LocationWeightGetter,
                    options?: Partial<Options>,
                  Severity: Minor
                  Found in cookie-traceability/src/lib/flowmap/data/cluster/cluster.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

                  Function calcLocationTotalsExtent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function calcLocationTotalsExtent(
                    locationTotals: Map<string, LocationTotals> | undefined,
                    locationIdsInViewport: Set<string> | undefined,
                  ) {
                    if (!locationTotals) return undefined;
                  Severity: Minor
                  Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.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 2 locations. Consider refactoring.
                  Open

                    constructor(
                      protected readonly materialService: MaterialsService,
                      protected readonly businessUnitService: BusinessUnitsService,
                      protected readonly adminRegionService: AdminRegionsService,
                      protected readonly suppliersService: SuppliersService,
                  api/src/modules/indicator-records/services/impact-calculator.service.ts on lines 50..59

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

                  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