CartoDB/cartodb20

View on GitHub

Showing 5,951 of 5,951 total issues

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

      def run
        n_layers = layers_in(source_file).length
        return self if n_layers <= 1

        if n_layers > MAX_LAYERS
Severity: Major
Found in services/importer/lib/importer/gpkg_splitter.rb and 3 other locations - About 30 mins to fix
services/importer/lib/importer/fgdb_splitter.rb on lines 28..37
services/importer/lib/importer/gpx_splitter.rb on lines 29..36
services/importer/lib/importer/kml_splitter.rb on lines 28..33

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

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 4 locations. Consider refactoring.
Open

      def run
        n_layers = layers_in(source_file).length
        return self if n_layers <= 1
        if n_layers > MAX_LAYERS
          raise CartoDB::Importer2::TooManyLayersError.new(
Severity: Major
Found in services/importer/lib/importer/fgdb_splitter.rb and 3 other locations - About 30 mins to fix
services/importer/lib/importer/gpkg_splitter.rb on lines 29..39
services/importer/lib/importer/gpx_splitter.rb on lines 29..36
services/importer/lib/importer/kml_splitter.rb on lines 28..33

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

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 4 locations. Consider refactoring.
Open

      def run
        n_layers = layers_in(source_file).length
        return self if n_layers <= 1
        raise CartoDB::Importer2::TooManyLayersError.new("File has too many layers (#{n_layers}). Maximum number of layers: #{MAX_LAYERS}") if n_layers > MAX_LAYERS
        @source_files = source_files_for(source_file, layers_in(source_file))
Severity: Major
Found in services/importer/lib/importer/kml_splitter.rb and 3 other locations - About 30 mins to fix
services/importer/lib/importer/fgdb_splitter.rb on lines 28..37
services/importer/lib/importer/gpkg_splitter.rb on lines 29..39
services/importer/lib/importer/gpx_splitter.rb on lines 29..36

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

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 4 locations. Consider refactoring.
Open

      def run
        n_layers = layers_in(source_file).length
        return self if n_layers <= 1
        raise CartoDB::Importer2::TooManyLayersError.new(
          "File has too many layers (#{n_layers}). Maximum number of layers: #{MAX_LAYERS}"
Severity: Major
Found in services/importer/lib/importer/gpx_splitter.rb and 3 other locations - About 30 mins to fix
services/importer/lib/importer/fgdb_splitter.rb on lines 28..37
services/importer/lib/importer/gpkg_splitter.rb on lines 29..39
services/importer/lib/importer/kml_splitter.rb on lines 28..33

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

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

    def export_oauth_token(oauth_token)
      {
        token: oauth_token.token,
        secret: oauth_token.secret,
        callback_url: oauth_token.callback_url,
Severity: Minor
Found in app/services/carto/user_metadata_export_service.rb and 1 other location - About 30 mins to fix
app/services/carto/user_metadata_export_service.rb on lines 426..438

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

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

    def parse_fill(fill)
      width = fill[:size][:fixed]
      color = fill[:color][:fixed]
      opacity = fill[:color][:opacity]

Severity: Minor
Found in lib/carto/styles/point.rb and 1 other location - About 30 mins to fix
lib/carto/styles/line.rb on lines 20..27

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

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

    def parse_stroke(stroke)
      width = stroke[:size][:fixed]
      color = stroke[:color][:fixed]
      opacity = stroke[:color][:opacity]

Severity: Minor
Found in lib/carto/styles/line.rb and 1 other location - About 30 mins to fix
lib/carto/styles/point.rb on lines 20..27

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

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

    def export_api_key(api_key)
      {
        id: api_key.id,
        created_at: api_key.created_at,
        db_password: api_key.db_password,
Severity: Minor
Found in app/services/carto/user_metadata_export_service.rb and 1 other location - About 30 mins to fix
app/services/carto/user_metadata_export_service.rb on lines 392..404

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

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

Avoid too many return statements within this function.
Open

        return "variable";
Severity: Major
Found in lib/assets/javascripts/utils/postgres.codemirror.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            if(state.stack[state.stack.length-1] != undefined)return ret(null, ch);
    Severity: Major
    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return ret("number", "unit");
      Severity: Major
      Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return ret("number", "unit");
        Severity: Major
        Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return state.tagStart + indentUnit * multilineTagIndentFactor;
          Severity: Major
          Found in lib/assets/javascripts/utils/xml.codemirror.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    if(type == "r")return ret("string", "string");
            Severity: Major
            Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return "atom";
              Severity: Major
              Found in lib/assets/javascripts/utils/postgres.codemirror.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return "word";
                Severity: Major
                Found in lib/assets/javascripts/utils/xml.codemirror.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        if(stream.peek() == ")")return ret("number", "unit");//rgba(0,0,0,.25);
                  Severity: Major
                  Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return ret("atom", "tag");
                    Severity: Major
                    Found in lib/assets/javascripts/utils/carto.codemirror.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return null;
                      Severity: Major
                      Found in lib/assets/javascripts/utils/xml.codemirror.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return ok ? "atom" : "error";
                        Severity: Major
                        Found in lib/assets/javascripts/utils/xml.codemirror.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language