apuliasoft/github-issue-labeler-integration-server

View on GitHub
app/github/gitapp.py

Summary

Maintainability
C
1 day
Test Coverage

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 _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

          There are no issues that match your filters.

          Category
          Status