Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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

  async sendUserActivationEmail(email: string): Promise<void> {
    const token: string = this.signToken(email);
    return this.passwordMail.sendUserActivationEmail(email, token);
  }
Severity: Major
Found in api/src/modules/authentication/authentication.service.ts and 1 other location - About 1 hr to fix
api/src/modules/authentication/authentication.service.ts on lines 342..345

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

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

      if (baseImpactMap.mapType === IMPACT_MAP_TYPE.SCENARIO_VS_SCENARIO) {
        if (baseImpactMap.isRelative) {
          finalQueryBuiler.select(
            '100 * (ABS(q.aggregated_compared) - ABS(q.aggregated_base)) / NULLIF(((ABS(q.aggregated_compared) + ABS(q.aggregated_base)) / 2), 0)',
            'v',
Severity: Major
Found in api/src/modules/h3-data/h3-data.repository.ts and 1 other location - About 1 hr to fix
api/src/modules/h3-data/h3-data.repository.ts on lines 547..559

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

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

      if (baseImpactMap.mapType === IMPACT_MAP_TYPE.ACTUAL_VS_SCENARIO) {
        if (baseImpactMap.isRelative) {
          finalQueryBuiler.select(
            '100 * (ABS(q.aggregated_scenario_data) - ABS(q.aggregated_actual_data)) / NULLIF(((ABS(q.aggregated_scenario_data) + ABS(q.aggregated_actual_data)) / 2), 0)',
            'v',
Severity: Major
Found in api/src/modules/h3-data/h3-data.repository.ts and 1 other location - About 1 hr to fix
api/src/modules/h3-data/h3-data.repository.ts on lines 560..572

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

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

        <Line
          activeDot={false}
          dataKey="comparedScenarioValueProjected"
          dot={false}
          stroke={themeColors.gray[300]}
client/src/containers/analysis-visualization/analysis-table/chart-cell/component.tsx on lines 57..65

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

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

      const geoRegionId: string =
        await this.geoRegionService.saveGeoRegionAsPoint({
          name: sourcingData.locationCountryInput,
          coordinates: {
            lat: sourcingData.locationLatitude,
api/src/modules/geo-coding/strategies/aggregation-point.geocoding.service.ts on lines 27..34

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

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

        <Line
          activeDot={false}
          dataKey="projectedValue"
          dot={false}
          stroke={themeColors.gray[500]}
client/src/containers/analysis-visualization/analysis-table/chart-cell/component.tsx on lines 40..48

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

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

  async sendPasswordRecoverEmail(email: string): Promise<void> {
    const token: string = this.signToken(email);
    return this.passwordMail.sendPasswordRecoveryEmail(email, token);
  }
Severity: Major
Found in api/src/modules/authentication/authentication.service.ts and 1 other location - About 1 hr to fix
api/src/modules/authentication/authentication.service.ts on lines 347..350

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

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

def main(
Severity: Major
Found in data/h3_data_importer/vector_folder_to_h3_table.py - About 1 hr to fix

    Function useContextualLayers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const useContextualLayers = (
      options: Omit<UseQueryOptions<LayerCategoriesApiResponse['data']>, 'select'> = {},
    ) => {
      const dispatch = useAppDispatch();
      return useQuery(
    Severity: Minor
    Found in client/src/hooks/layers/getContextualLayers.ts - About 1 hr to fix

      Function useUsers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useUsers = (
        params: Record<string, unknown> = {},
        options: UseQueryOptions<UserPayload> = {},
      ) => {
        const queryOptions: UseQueryOptions<UserPayload> = {
      Severity: Minor
      Found in client/src/hooks/users/index.ts - About 1 hr to fix

        Function ProjectedDataIcon has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function ProjectedDataIcon(props) {
          return (
            <svg
              width={12}
              height={12}
        Severity: Minor
        Found in client/src/components/icons/projected-data.tsx - About 1 hr to fix

          Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render(): JSX.Element {
              return (
                <Html>
                  <Head>
                    <link rel="preconnect" href="https://fonts.gstatic.com" />
          Severity: Minor
          Found in landing/pages/_document.tsx - About 1 hr to fix

            Function getAdminRegionAndGeoRegionIdByCoordinatesAndLevel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async getAdminRegionAndGeoRegionIdByCoordinatesAndLevel(
                searchParams: {
                  lng: number;
                  lat: number;
                  level: number;
            Severity: Minor
            Found in api/src/modules/admin-regions/admin-region.repository.ts - About 1 hr to fix

              Function getRankedImpactTable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async getRankedImpactTable(
                  rankedImpactTableDto: GetRankedImpactTableDto,
                ): Promise<ImpactTable> {
                  const indicators: Indicator[] =
                    await this.indicatorService.getIndicatorsById(
              Severity: Minor
              Found in api/src/modules/impact/impact.service.ts - About 1 hr to fix

                Function saveChunks has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async saveChunks<Entity>(
                    entities: Entity[],
                    options?: SaveOptions,
                  ): Promise<Entity[]> {
                    const queryRunner: QueryRunner = this.dataSource.createQueryRunner();
                Severity: Minor
                Found in api/src/utils/app-base.repository.ts - About 1 hr to fix

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

                    initializeState() {
                      this.getAttributeManager().addInstanced({
                        instancePositions: {
                          size: 3,
                          type: GL.DOUBLE,

                    Function aggregateFlows has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function aggregateFlows<F>(flows: F[], flowAccessors: FlowAccessors<F>): AggregateFlow[] {
                      // Sum up flows with same origin, dest
                      const byOriginDest = nest<F, AggregateFlow>()
                        .key(flowAccessors.getFlowOriginId)
                        .key(flowAccessors.getFlowDestId)
                    Severity: Minor
                    Found in cookie-traceability/src/lib/flowmap/data/FlowMapSelectors.ts - About 1 hr to fix

                      Function validate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        validate(addressInput: string, args: ValidationArguments): boolean {
                          if (
                            (args.object as SourcingDataExcelValidator).location_type ===
                              LOCATION_TYPES.UNKNOWN ||
                            (args.object as SourcingDataExcelValidator).location_type ===

                        Function Methodology has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const Methodology: React.FC = () => {
                          useEffect(() => {
                            let timerId: number;
                        
                            if (window.location.hash && document.querySelector(window.location.hash)) {
                        Severity: Minor
                        Found in marketing/src/containers/methodology/component.tsx - About 1 hr to fix

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

                          const Newsletter = (req: NextApiRequest, res: NextApiResponse): void => {
                            if (req.method === 'PUT') {
                              const { email } = req.body;
                          
                              const data = {
                          Severity: Minor
                          Found in marketing/src/pages/api/newsletter.ts - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language