datahuborg/datahub

View on GitHub

Showing 283 of 1,132 total issues

File query_rewriter.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import sqlparse

from inventory.models import Collaborator
from core.db.rlsmanager import RowLevelSecurityManager
from config import settings
Severity: Minor
Found in src/core/db/query_rewriter.py - About 2 hrs to fix

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

    function md5cycle(x, k) {
    var a = x[0], b = x[1], c = x[2], d = x[3];
    
    a = ff(a, b, c, d, k[0], 7, -680876936);
    d = ff(d, a, b, c, k[1], 12, -389564586);
    Severity: Major
    Found in src/apps/dbwipes/static/js/lib/md5.js - About 2 hrs to fix

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

      function md5cycle(x, k) {
      var a = x[0], b = x[1], c = x[2], d = x[3];
      
      a = ff(a, b, c, d, k[0], 7, -680876936);
      d = ff(d, a, b, c, k[1], 12, -389564586);
      Severity: Major
      Found in src/browser/static/dbwipes/js/lib/md5.js - About 2 hrs to fix

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

            def test_authorization_code_flow(self):
                user_info = {
                    'username': 'delete_me_test',
                    'email': 'delete_me_test@mit.edu',
                    'password': 'delete_me_test',
        Severity: Major
        Found in src/functional_tests/test_api.py - About 2 hrs to fix

          Function onMove has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              onMove: function() {
                if (!this.model.get("isDrawing")) 
                  return;
          
                var xy = d3.mouse(this.d3g[0][0]),
          Severity: Major
          Found in src/browser/static/dbwipes/js/summary/drawingview.js - About 2 hrs to fix

            Function onMove has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                onMove: function() {
                  if (!this.model.get("isDrawing")) 
                    return;
            
                  var xy = d3.mouse(this.d3g[0][0]),
            Severity: Major
            Found in src/apps/dbwipes/static/js/summary/drawingview.js - About 2 hrs to fix

              Function setupScorpion has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                var setupScorpion = function(enableScorpion, q, qv, where) {
                  if (!enableScorpion) {
                    $("#facet-togglecheckall").css("opacity", 0);
                    return;
                  }
              Severity: Major
              Found in src/browser/static/dbwipes/js/summary/setup.js - About 2 hrs to fix

                Function setupScorpion has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var setupScorpion = function(enableScorpion, q, qv, where) {
                    if (!enableScorpion) {
                      $("#facet-togglecheckall").css("opacity", 0);
                      return;
                    }
                Severity: Major
                Found in src/apps/dbwipes/static/js/summary/setup.js - About 2 hrs to fix

                  Function test_add_remove_collaborator has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def test_add_remove_collaborator(self):
                          # must be lowercase
                          eazyE = 'delete_me_eazye'
                          dre = 'delete_me_dre'
                          snoop = 'delete_me_snoop'
                  Severity: Major
                  Found in src/functional_tests/test_db.py - About 2 hrs to fix

                    Function analyze_input_structure has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def analyze_input_structure(i_chunks, o_fields_structure):
                      i_chunks_types = [chunk[0] for chunk in i_chunks]
                      extracted_fields = {}
                      o_fields_types = []
                      field_matches = defaultdict(list)
                    Severity: Minor
                    Found in src/apps/refiner/distill/inference.py - 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 extract_fields has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def extract_fields(o_chunks, o_fields_structure):
                      extracted_fields = {}
                      o_chunks_types = [chunk[0] for chunk in o_chunks]
                      o_fields_types = []
                      field_matches = defaultdict(list)
                    Severity: Minor
                    Found in src/apps/refiner/distill/inference.py - 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

                    File test_api_endpoints.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    from django.core.urlresolvers import reverse
                    from rest_framework import status
                    from rest_framework.test import APITestCase
                    from django.contrib.auth.models import User
                    from core.db.manager import DataHubManager
                    Severity: Minor
                    Found in src/integration_tests/test_api_endpoints.py - About 2 hrs to fix

                      Function setupScales has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          setupScales: function(data) {
                            var schema = this.model.get('schema'),
                                xcol = this.model.get('x'),
                                xalias = xcol.alias,
                                ycols = this.model.get('ys'),
                      Severity: Major
                      Found in src/browser/static/dbwipes/js/summary/queryview.js - About 2 hrs to fix

                        Function 2 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        },{"./aggregator.js":2,"./api.js":3,"./filter-bar.js":4,"./shorten-query.js":6,"./templates/table_header.hbs":12}],2:[function(require,module,exports){
                        var grouped_buttons_template = require("./templates/grouped-aggregate-dropdown.hbs");
                        var api = require("./api.js");
                        var col_list_items_template = require("./templates/aggregate-col-list-item.hbs");
                        var PostgresTypes = require("./postgres-types.js");
                        Severity: Major
                        Found in src/browser/static/datatables/js/dataTables.extra.js - About 2 hrs to fix

                          Function setupScales has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              setupScales: function(data) {
                                var schema = this.model.get('schema'),
                                    xcol = this.model.get('x'),
                                    xalias = xcol.alias,
                                    ycols = this.model.get('ys'),
                          Severity: Major
                          Found in src/apps/dbwipes/static/js/summary/queryview.js - About 2 hrs to fix

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

                            def where_to_sql(where_json, negate=False):
                                is_type = lambda s, types: any([t in s for t in types])
                                l = []
                                args = []
                                for clause_json in where_json:
                            Severity: Minor
                            Found in src/apps/dbwipes/util.py - 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 scorpion_run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def scorpion_run(db, requestdata, requestid):
                              """
                              badsel:  { alias: { x:, y:, xalias:, yalias:, } }
                              goodsel: { alias: { x:, y:, xalias:, yalias:, } }
                              """
                            Severity: Minor
                            Found in src/apps/dbwipes/scorpionutil.py - 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 toWhereClause has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function toWhereClause(col, type, vals) {
                                if (!vals || vals.length == 0) return null;
                                var SQL = null;
                                var re = new RegExp("'", "gi");
                                if (isStr(type)) {
                            Severity: Major
                            Found in src/browser/static/dbwipes/js/summary/util.js - About 2 hrs to fix

                              Function toWhereClause has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function toWhereClause(col, type, vals) {
                                  if (!vals || vals.length == 0) return null;
                                  var SQL = null;
                                  var re = new RegExp("'", "gi");
                                  if (isStr(type)) {
                              Severity: Major
                              Found in src/apps/dbwipes/static/js/summary/util.js - About 2 hrs to fix

                                File summary.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                from functools import wraps
                                import json
                                
                                from core.db.manager import DataHubManager
                                
                                
                                Severity: Minor
                                Found in src/apps/dbwipes/summary.py - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language