apuliasoft/github-issue-labeler-integration-server

View on GitHub

Showing 14 of 20 total issues

File api.py has 375 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python

from functools import wraps  
from flask import Blueprint, current_app, request, jsonify, redirect, session, url_for
from werkzeug import exceptions as exc
Severity: Minor
Found in app/api.py - About 5 hrs to fix

    File gitapp.py has 374 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from functools import wraps  
    from datetime import datetime, timedelta
    from urllib.parse import urlencode, quote, parse_qsl
    import jwt
    import requests
    Severity: Minor
    Found in app/github/gitapp.py - About 5 hrs to fix

      GitApp has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class GitApp:
        """
        Class for interfacing with git api
        
        """
      Severity: Minor
      Found in app/github/gitapp.py - About 2 hrs to fix

        Function _request has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def _request(self, method, endpoint, resource, params = {}, headers = {}, collect_all = False, func = lambda x : x):
            """
            Internal function to forge requests and track git errors or pagination
            
            Parameters:
        Severity: Minor
        Found in app/github/gitapp.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 train has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def train(token):
          """
            Train a model from a GIT repository using OpenReq API
            ---
            tags:
        Severity: Minor
        Found in app/api.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 _request has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def _request(self, method, endpoint, resource, params = {}, headers = {}, collect_all = False, func = lambda x : x):
        Severity: Major
        Found in app/github/gitapp.py - About 50 mins to fix

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

            def setup(self, APP_ID, CLIENT_ID, CLIENT_SECRET, PRIV_KEY_PATH, PERSONAL_ACCESS_TOKEN=None, GITHUB_LIMIT_REQUEST=False):
          Severity: Minor
          Found in app/github/gitapp.py - About 45 mins to fix

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

            def classify(token):
              """
                Classify a repository using a model trained from another repository
                ---
                tags:
            Severity: Minor
            Found in app/api.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 webhook has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def webhook(): 
              """
              WebHook endpoint
              No need to call directly
              Needed by Git as a callback endpoint to receive server side events
            Severity: Minor
            Found in app/api.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 classify has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def classify(repo, model, token, issues = None, batch=False):
            Severity: Minor
            Found in app/tasks.py - About 35 mins to fix

              Function classify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def classify(repo, model, token, issues = None, batch=False):
                """
                Asyncronous classify task.
                Retrive issues from source git repository and start a classification on OpenReq instance.
                Then update labels in the source repository and save do db.
              Severity: Minor
              Found in app/tasks.py - About 35 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 too many return statements within this function.
              Open

                  return jsonify({
              Severity: Major
              Found in app/api.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return jsonify({
                Severity: Major
                Found in app/api.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return jsonify({
                  Severity: Major
                  Found in app/api.py - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language