adsabs/biblib-service

View on GitHub

Showing 114 of 175 total issues

Avoid too many return statements within this function.
Open

            return err(INVALID_BIBCODE_ERROR)
Severity: Major
Found in biblib/views/notes_view.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return err(DUPLICATE_NOTE_ERROR)
    Severity: Major
    Found in biblib/views/notes_view.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return current_app.logger.error('Error: {0}'
      Severity: Major
      Found in biblib/views/notes_view.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return False
        Severity: Major
        Found in biblib/views/permission_view.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return False
          Severity: Major
          Found in biblib/views/permission_view.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return err(NO_PERMISSION_ERROR)
            Severity: Major
            Found in biblib/views/permission_view.py - About 30 mins to fix

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

                  def load_parameters(self, request): 
                      """
                      Loads parameters necessary for the Solr search
                      :param request: request object
              
              
              Severity: Minor
              Found in biblib/views/library_view.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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def post(self, library):
                      """
                      HTTP POST request that transfers the ownership of a library from user
                      to another
                      :param library: library ID
              Severity: Minor
              Found in biblib/views/transfer_view.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def delete(self, library, document_id):
                      """
                      HTTP DELETE request that deletes a note from the library
                      :param library: library ID
                      :param document_id: bibcode
              Severity: Minor
              Found in biblib/views/notes_view.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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def post(self):
                      """
                      HTTP POST request that creates a library for a given user
              
                      :return: the response for if the library was successfully created
              Severity: Minor
              Found in biblib/views/user_view.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get(self, library):
                      """
                      HTTP GET request that adds documents to a library for a given user
                      :param library: library ID based on a /search query.
              
              
              Severity: Minor
              Found in biblib/views/document_view.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run(app=app):
                      """
                      Carries out the deletion of the stale content
                      """
                      with app.app_context():
              Severity: Minor
              Found in biblib/manage.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_permission_payload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def format_permission_payload(library_name, library_id, permission_data):
                      """
                      Format the permission info into plain text and HTML payloads for the email
              
                      :param library_name: string; name of library
              Severity: Minor
              Found in biblib/views/permission_view.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 process_bind_param has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def process_bind_param(value, dialect):
                      """
                      Format the value for insertion in to the database
                      :param value: value of interest
                      :param dialect: database type
              Severity: Minor
              Found in biblib/models.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