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
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
GitApp
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class GitApp:
"""
Class for interfacing with git api
"""
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:
- 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 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:
- 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
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
def setup(self, APP_ID, CLIENT_ID, CLIENT_SECRET, PRIV_KEY_PATH, PERSONAL_ACCESS_TOKEN=None, GITHUB_LIMIT_REQUEST=False):
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:
- 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 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
- 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 classify
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def classify(repo, model, token, issues = None, batch=False):
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.
- 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
Avoid too many return
statements within this function. Open
return jsonify({
Avoid too many return
statements within this function. Open
return jsonify({
Avoid too many return
statements within this function. Open
return jsonify({