app/github/gitapp.py
File gitapp.py
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
from functools import wraps
from datetime import datetime, timedelta
from urllib.parse import urlencode, quote, parse_qsl
import jwt
import requests
GitApp
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class GitApp:
"""
Class for interfacing with git api
"""
Function _request
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
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:
- Read upRead up
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
Open
def _request(self, method, endpoint, resource, params = {}, headers = {}, collect_all = False, func = lambda x : x):
Function setup
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def setup(self, APP_ID, CLIENT_ID, CLIENT_SECRET, PRIV_KEY_PATH, PERSONAL_ACCESS_TOKEN=None, GITHUB_LIMIT_REQUEST=False):