Showing 14 of 109 total issues
Function render
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (!this.state.pullRequest) {
return <div>Here you can enable world driven for each of your repositories. When
enabled, pull requests are watched and automatically merged based on the
reviews.</div>;
Function getPullRequestData
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function getPullRequestData(user, owner, repo, number) {
const pull = await getPullRequest(user, owner, repo, number);
const contributors = await getContributors(user, pull.head.repo.contributors_url);
const reviews = await getReviews(user, pull);
for (const review of reviews) {
Function put
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def put(self, org, repo):
checked = request.json['checked']
full_name = '{}/{}'.format(org, repo)
github_client = github.Github(g.user.github_access_token)
repository = github_client.get_repo('{}/{}'.format(org, repo))
- 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 render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (!this.state.fetched) {
return <div className="loader"></div>;
}
Function handle_pull_request_review
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_pull_request_review(self, data):
# print(data)
if data['action'] == 'submitted':
if 'state' not in data['review']:
# print('No state')
- 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 getDates
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getDates(user, pull) {
const createdAt = new Date(pull.created_at).getTime();
const commits = await getCommits(user, pull);
const commit = commits.reduce((total, current) => {
return Math.max(new Date(total), new Date(current.commit.author.date));
Function getContributors
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getContributors(user, url) {
const options = {
headers: {
Accept: 'application/vnd.github.v3+json',
Authorization: `token ${user.githubAccessToken}`,
Function ws_admin_logs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def ws_admin_logs(ws):
logging.info('websocket connection started')
url = 'https://api.heroku.com/apps/worlddriven/log-sessions'
headers = {
'accept': 'application/vnd.heroku+json; version=3',
- 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 update_contributors_with_reviews
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_contributors_with_reviews(self):
data = fetch_reviews(self.repository.full_name, self.pull_request.number, self.token)
reviews_decided = [review for review in data if review['state'] != 'COMMENTED']
for review in reviews_decided:
value = 0
- 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 getPullRequestData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function getPullRequestData(user, owner, repo, number) {
const pull = await getPullRequest(user, owner, repo, number);
const contributors = await getContributors(user, pull.head.repo.contributors_url);
const reviews = await getReviews(user, pull);
for (const review of reviews) {
- 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 createIssueComment
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export async function createIssueComment(user, owner, repo, number, comment) {
Function repositories
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def repositories():
if not g.user:
return 401
github_client = github.Github(g.user.github_access_token)
- 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 check_for_merge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_for_merge(self):
self.set_status()
if self.coefficient >= 0 and self.max_date + self.merge_duration < datetime.utcnow():
logging.info('Would merge now')
- 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 check_pull_requests
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_pull_requests():
logging.info('Check pull requests: {}'.format(datetime.utcnow()))
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('JAWSDB_MARIA_URL', 'mysql://worlddriven:password@127.0.0.1/worlddriven')
db.init_app(app)
- 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"