bookbrainz/bookbrainz-ws

View on GitHub

Showing 15 of 64 total issues

File structures.py has 602 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf8 -*-

# Copyright (C) 2014-2015  Ben Ockmore

# This program is free software; you can redistribute it and/or modify
Severity: Major
Found in bbws/structures.py - About 1 day to fix

    File entity.py has 503 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf8 -*-
    
    # Copyright (C) 2014-2015  Ben Ockmore
    
    # This program is free software; you can redistribute it and/or modify
    Severity: Major
    Found in bbws/entity.py - About 1 day to fix

      Function init has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      def init(app):
          # Book of the Week
          @app.route('/botw', methods=['GET'])
          def botw():
              # pylint: disable=unused-variable
      Severity: Minor
      Found in bbws/custom.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 get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, entity_gid):
              if not is_uuid(entity_gid):
                  abort(404)
      
              args = self.get_parser.parse_args()
      Severity: Minor
      Found in bbws/entity.py - About 1 hr 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 get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, entity_gid):
              if not is_uuid(entity_gid):
                  abort(404)
      
              args = self.get_parser.parse_args()
      Severity: Minor
      Found in bbws/entity.py - About 1 hr 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 get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, entity_gid):
              if not is_uuid(entity_gid):
                  abort(404)
      
              args = self.get_parser.parse_args()
      Severity: Minor
      Found in bbws/entity.py - About 1 hr 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 get has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, entity_gid):
              if not is_uuid(entity_gid):
                  abort(404)
      
              args = self.get_parser.parse_args()
      Severity: Minor
      Found in bbws/entity.py - About 1 hr 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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, entity_gid):
              args = self.get_parser.parse_args()
              if args.revision is None:
                  try:
                      entity = db.session.query(Entity).options(
      Severity: Minor
      Found in bbws/entity.py - About 1 hr 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 get_display_alias has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_display_alias(entity_data, user, session):
          user_native_language_ids = native_languages_ids(user)
          aliases = entity_data.aliases
          primary_aliases = \
              [alias for alias in aliases if alias.primary is True]
      Severity: Minor
      Found in bbws/entity.py - About 55 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, client_id, scopes, expires,
      Severity: Minor
      Found in bbws/oauth.py - About 45 mins to fix

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

            def __init__(self, client_id, user_id, code, redirect_uri, expires,
        Severity: Minor
        Found in bbws/oauth.py - About 45 mins to fix

          Avoid too many return statements within this function.
          Open

                  return aliases[0]
          Severity: Major
          Found in bbws/entity.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return None
            Severity: Major
            Found in bbws/entity.py - About 30 mins to fix

              Function format_entity_revision has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def format_entity_revision(revision, base):
                  entity_revision_fields = structures.ENTITY_REVISION.copy()
              
                  if base is None:
                      right = revision.children
              Severity: Minor
              Found in bbws/revision.py - About 25 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 format_relationship_revision has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def format_relationship_revision(revision, base):
                  relationship_revision_fields = structures.RELATIONSHIP_REVISION.copy()
              
                  if base is None:
                      right = revision.children
              Severity: Minor
              Found in bbws/revision.py - About 25 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

              Severity
              Category
              Status
              Source
              Language