datahuborg/datahub

View on GitHub

Showing 283 of 1,132 total issues

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, repo, tablename, username, repo_base=None,
Severity: Minor
Found in src/apps/dbwipes/summary.py - About 45 mins to fix

    Function default has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def default(self, o):
            if isinstance(o, float):
                if o == float('inf'):
                    return 1e100
                elif o == float('-inf'):
    Severity: Minor
    Found in src/apps/dbwipes/util.py - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

                        if c_name == col_name and can_apply(agg_type, col_name):
                            result = manager.execute_sql(
                                "SELECT %s(%s) FROM %s.%s" % (agg_type.lower(), col_name.lower(), repo, table))
                            if "tuples" in result and len(result["tuples"]) > 0 and len(result["tuples"][0]) > 0:
                                return json_response({"value": result["tuples"][0]})
    Severity: Major
    Found in src/apps/datatables/views.py - About 45 mins to fix

      Function license_view_delete has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def license_view_delete(request, repo_base, repo, table,
      Severity: Minor
      Found in src/browser/views.py - About 45 mins to fix

        Function export_table has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def export_table(self, repo, table, file_name=None, file_format='CSV',
        Severity: Minor
        Found in src/api/serializer.py - About 45 mins to fix

          Function schema has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def schema(request, repo_name, table_name):
              username = request.user.get_username()
              manager = DataHubManager(username)
              repos = get_repos(manager)
              if repos is not None and repo_name in repos:
          Severity: Minor
          Found in src/apps/dataq/views.py - About 45 mins 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 db_schema has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def db_schema(db, table):
            """
            only works for postgres
          
            @return dictionary of column name -> python type object
          Severity: Minor
          Found in src/apps/dbwipes/db.py - About 45 mins 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 add_password has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def add_password(request, is_disconnect=False):
              """
              Presents a form asking the current user to set a password on their account.
          
              Used by both the settings page and disconnect pipeline.
          Severity: Minor
          Found in src/account/views.py - About 45 mins 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 find_security_policies has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def find_security_policies(
          Severity: Minor
          Found in src/api/serializer.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if op == "=":
                                        text = "'%" + text + "%'"
                                        op = "ILIKE"
                                    elif op == "!=":
                                        text = "'%" + text + "%'"
            Severity: Major
            Found in src/apps/datatables/util/run_draw_request.py - About 45 mins to fix

              Function export_table has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def export_table(self, repo, table, file_name, file_format='CSV',
              Severity: Minor
              Found in src/core/db/manager.py - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
                          elVal = parseFloat(elVal);
                          val = parseFloat(val);
                        }
                Severity: Major
                Found in src/apps/dbwipes/static/js/lib/tether.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
                            elVal = parseFloat(elVal);
                            val = parseFloat(val);
                          }
                  Severity: Major
                  Found in src/browser/static/dbwipes/js/lib/tether.js - About 40 mins to fix

                    Function compute_aggregate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    api.compute_aggregate = function(repo, table, agg_type, col_name, callback) {
                    Severity: Minor
                    Found in src/browser/static/datatables/js/dataTables.extra.js - About 35 mins to fix

                      Function program has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          program: function(i, data, declaredBlockParams, blockParams, depths) {
                      Severity: Minor
                      Found in src/browser/static/datatables/js/dataTables.extra.js - About 35 mins to fix

                        Function compute_aggregate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        api.compute_aggregate = function(repo, table, agg_type, col_name, callback) {
                        Severity: Minor
                        Found in src/apps/datatables/client/js/api.js - About 35 mins to fix

                          Function patch has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def patch(self, request, repo_base, repo_name, card_name, format=None):
                          Severity: Minor
                          Found in src/api/views.py - About 35 mins to fix

                            Function update_security_policy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def update_security_policy(policy_id, new_policy, new_policy_type,
                            Severity: Minor
                            Found in src/core/db/rlsmanager.py - About 35 mins to fix

                              Function create_license_view has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def create_license_view(self, repo_base, repo,
                              Severity: Minor
                              Found in src/core/db/connection.py - About 35 mins to fix

                                Function delete has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def delete(self, request, repo_base, repo_name, collaborator, format=None):
                                Severity: Minor
                                Found in src/api/views.py - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language