datahuborg/datahub

View on GitHub

Showing 1,132 of 1,132 total issues

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

    def delete_table(self, repo, table, force=False):
        self._check_for_injections(repo)
        self._validate_table_name(table)

        force_param = 'RESTRICT'
Severity: Major
Found in src/core/db/backend/pg.py and 1 other location - About 5 hrs to fix
src/core/db/backend/pg.py on lines 423..436

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

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 delete_view(self, repo, view, force=False):
        self._check_for_injections(repo)
        self._validate_table_name(view)

        force_param = 'RESTRICT'
Severity: Major
Found in src/core/db/backend/pg.py and 1 other location - About 5 hrs to fix
src/core/db/backend/pg.py on lines 453..466

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

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

  var setupBasic = function() {
    var q = new Query();
    var qv = new QueryView({ model: q })
    $("#right").prepend(qv.render().$el);

Severity: Major
Found in src/browser/static/dbwipes/js/summary/setup.js - About 5 hrs to fix

    Function setupBasic has 145 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var setupBasic = function() {
        var q = new Query();
        var qv = new QueryView({ model: q })
        $("#right").prepend(qv.render().$el);
    
    
    Severity: Major
    Found in src/apps/dbwipes/static/js/summary/setup.js - About 5 hrs to fix

      Function where_clause has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          def where_clause(self):
              # Figure out the types of the columns so we'll know whether to use
              # numeric operations or string operations.
              schema = self.manager.get_schema(self.repo, self.table)
              type_for_col = {}
      Severity: Minor
      Found in src/apps/datatables/util/run_draw_request.py - About 5 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

          def list_tables(self, repo):
              self._check_for_injections(repo)
      
              all_repos = self.list_repos()
      
      
      Severity: Major
      Found in src/core/db/backend/pg.py and 1 other location - About 5 hrs to fix
      src/core/db/backend/pg.py on lines 406..421

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

      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 list_views(self, repo):
              self._check_for_injections(repo)
      
              all_repos = self.list_repos()
              if repo not in all_repos:
      Severity: Major
      Found in src/core/db/backend/pg.py and 1 other location - About 5 hrs to fix
      src/core/db/backend/pg.py on lines 357..370

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

      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

      requirejs.config({
        //By default load any module IDs from js/lib
        baseUrl: '/static/dbwipes/js/lib',
      
        //except, if the module ID starts with "app",
      Severity: Major
      Found in src/browser/static/dbwipes/js/summary.js and 1 other location - About 5 hrs to fix
      src/apps/dbwipes/static/js/summary.js on lines 1..44

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

      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

      requirejs.config({
        //By default load any module IDs from js/lib
        baseUrl: '/static/dbwipes/js/lib',
      
        //except, if the module ID starts with "app",
      Severity: Major
      Found in src/apps/dbwipes/static/js/summary.js and 1 other location - About 5 hrs to fix
      src/browser/static/dbwipes/js/summary.js on lines 1..44

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

      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

          ensureYs: function() {
            var ys = this.get('ys');
            ys = (_.isArray(ys))? ys: [ys];
            ys = _.map(ys, function(y) {
              y = (_.isString(y))? {col:y, expr: y} : y;
      Severity: Major
      Found in src/apps/dbwipes/static/js/summary/query.js and 1 other location - About 5 hrs to fix
      src/browser/static/dbwipes/js/summary/query.js on lines 58..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 145.

      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

          ensureYs: function() {
            var ys = this.get('ys');
            ys = (_.isArray(ys))? ys: [ys];
            ys = _.map(ys, function(y) {
              y = (_.isString(y))? {col:y, expr: y} : y;
      Severity: Major
      Found in src/browser/static/dbwipes/js/summary/query.js and 1 other location - About 5 hrs to fix
      src/apps/dbwipes/static/js/summary/query.js on lines 59..68

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

      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

          def list_tables(self, repo):
              tables = self.manager.list_tables(repo)
              table_list = []
              for table in tables:
                  relative_uri = reverse('api:table', args=(
      Severity: Major
      Found in src/api/serializer.py and 3 other locations - About 5 hrs to fix
      src/api/serializer.py on lines 282..294
      src/api/serializer.py on lines 322..334
      src/api/serializer.py on lines 387..398

      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

          def list_views(self, repo):
              views = self.manager.list_views(repo)
      
              view_list = []
              for view in views:
      Severity: Major
      Found in src/api/serializer.py and 3 other locations - About 5 hrs to fix
      src/api/serializer.py on lines 234..246
      src/api/serializer.py on lines 322..334
      src/api/serializer.py on lines 387..398

      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

          def list_files(self, repo):
              files = self.manager.list_repo_files(repo)
              file_list = []
              for file in files:
                  relative_uri = reverse('api:file', args=(
      Severity: Major
      Found in src/api/serializer.py and 3 other locations - About 5 hrs to fix
      src/api/serializer.py on lines 234..246
      src/api/serializer.py on lines 282..294
      src/api/serializer.py on lines 322..334

      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

          def list_cards(self, repo):
              cards = self.manager.list_repo_cards(repo)
      
              card_list = []
              for card in cards:
      Severity: Major
      Found in src/api/serializer.py and 3 other locations - About 5 hrs to fix
      src/api/serializer.py on lines 234..246
      src/api/serializer.py on lines 282..294
      src/api/serializer.py on lines 387..398

      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 serializer.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from rest_framework import serializers
      
      from django.contrib.auth.models import User
      from django.core.urlresolvers import reverse
      
      
      Severity: Minor
      Found in src/api/serializer.py - About 5 hrs to fix

        Function 4 has 129 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{}],4:[function(require,module,exports){
        var filter_buttons_template = require("./templates/filter_buttons.hbs");
        var filter_template = require("./templates/filter.hbs");
        var delete_button_col = require("./templates/delete-button-col.hbs");
        
        
        Severity: Major
        Found in src/browser/static/datatables/js/dataTables.extra.js - About 5 hrs to fix

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

          function md5blk(s) { /* I figured global was faster.   */
          var md5blks = [], i; /* Andy King said do it this way. */
          for (i=0; i<64; i+=4) {
          md5blks[i>>2] = s.charCodeAt(i)
          + (s.charCodeAt(i+1) << 8)
          Severity: Major
          Found in src/browser/static/dbwipes/js/lib/md5.js and 1 other location - About 5 hrs to fix
          src/apps/dbwipes/static/js/lib/md5.js on lines 136..145

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

          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

          function md5blk(s) { /* I figured global was faster.   */
          var md5blks = [], i; /* Andy King said do it this way. */
          for (i=0; i<64; i+=4) {
          md5blks[i>>2] = s.charCodeAt(i)
          + (s.charCodeAt(i+1) << 8)
          Severity: Major
          Found in src/apps/dbwipes/static/js/lib/md5.js and 1 other location - About 5 hrs to fix
          src/browser/static/dbwipes/js/lib/md5.js on lines 136..145

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

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

              def apply_row_level_security_base(self, query):
                  '''
                  Takes in a SQL query and applies row level security to it. All table
                  references in the query are replaced with a subquery that only extracts
                  rows from the table for which the user is allowed to see.
          Severity: Minor
          Found in src/core/db/query_rewriter.py - About 5 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

          Severity
          Category
          Status
          Source
          Language