Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pylint Errors in Dev #2669

Merged
merged 8 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#refactoring checker
#enable=R

disable=E0611,E1101,W1203,R0801,W0614,W0611,C0411,C0103,C0301,C0303,C0304,C0305,W0311
disable=E0611,E1101,W1203,R0801,W0614,W0611,C0411,C0103,C0301,C0303,C0304,C0305,W0311,E0401


# Analyse import fallback blocks. This can be used to support both Python 2 and
Expand Down
8 changes: 6 additions & 2 deletions augur/api/view/routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"""
Defines the api routes for the augur views
"""
import logging
IsaacMilarky marked this conversation as resolved.
Show resolved Hide resolved
import math
from flask import Flask, render_template, render_template_string, request, abort, jsonify, redirect, url_for, session, flash
from sqlalchemy.orm.exc import NoResultFound
from .utils import *

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
W0401: Wildcard import utils (wildcard-import)

Expand All @@ -7,9 +11,9 @@
from augur.application.db.models import User, Repo, ClientApplication
from .server import LoginException
from augur.tasks.init.redis_connection import redis_connection as redis
from augur.application.util import *

Check warning on line 14 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0401: Wildcard import augur.application.util (wildcard-import) Raw Output: augur/api/view/routes.py:14:0: W0401: Wildcard import augur.application.util (wildcard-import)
from augur.application.config import AugurConfig
from ..server import app, db_session

Check warning on line 16 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E0402: Attempted relative import beyond top-level package (relative-beyond-top-level) Raw Output: augur/api/view/routes.py:16:0: E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)

logger = logging.getLogger(__name__)

Expand All @@ -23,10 +27,10 @@
"""
@app.route('/root/')
@app.route('/root/<path:path>')
def root(path=""):

Check warning on line 30 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C0116: Missing function or method docstring (missing-function-docstring) Raw Output: augur/api/view/routes.py:30:0: C0116: Missing function or method docstring (missing-function-docstring)
return redirect(getSetting("approot") + path)

Check warning on line 31 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E0602: Undefined variable 'getSetting' (undefined-variable) Raw Output: augur/api/view/routes.py:31:20: E0602: Undefined variable 'getSetting' (undefined-variable)

""" ----------------------------------------------------------------

Check warning on line 33 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0105: String statement has no effect (pointless-string-statement) Raw Output: augur/api/view/routes.py:33:0: W0105: String statement has no effect (pointless-string-statement)
logo:
this route returns a redirect to the application logo associated
with the provided brand, otherwise the inverted Augur logo if no
Expand All @@ -37,13 +41,13 @@
def logo(brand=None):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
C0116: Missing function or method docstring (missing-function-docstring)

if brand is None:
return redirect(url_for('static', filename='img/augur_logo.png'))
elif "augur" in brand:
if "augur" in brand:
return logo(None)
elif "chaoss" in brand:
if "chaoss" in brand:
return redirect(url_for('static', filename='img/Chaoss_Logo_white.png'))
return ""

""" ----------------------------------------------------------------

Check warning on line 50 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0105: String statement has no effect (pointless-string-statement) Raw Output: augur/api/view/routes.py:50:0: W0105: String statement has no effect (pointless-string-statement)
default:
table:
This route returns the default view of the application, which
Expand All @@ -51,11 +55,11 @@
"""
@app.route('/')
@app.route('/repos/views/table')
def repo_table_view():

Check warning on line 58 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C0116: Missing function or method docstring (missing-function-docstring) Raw Output: augur/api/view/routes.py:58:0: C0116: Missing function or method docstring (missing-function-docstring)
query = request.args.get('q')
try:
page = int(request.args.get('p') or 0)
except:

Check warning on line 62 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0702: No exception type(s) specified (bare-except) Raw Output: augur/api/view/routes.py:62:4: W0702: No exception type(s) specified (bare-except)
page = 1

sorting = request.args.get('s')
Expand Down Expand Up @@ -86,7 +90,7 @@
data = None


return render_module("repos-table", title="Repos", repos=data, query_key=query, activePage=page, pages=page_count, offset=pagination_offset, PS="repo_table_view", reverse = rev, sorting = sorting)

Check warning on line 93 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 E0602: Undefined variable 'render_module' (undefined-variable) Raw Output: augur/api/view/routes.py:93:11: E0602: Undefined variable 'render_module' (undefined-variable)

""" ----------------------------------------------------------------
card:
Expand Down Expand Up @@ -190,7 +194,7 @@
if not client_id or response_type != "code":
return render_message("Invalid Request", "Something went wrong. You may need to return to the previous application and make the request again.")

# TODO get application from client id

Check warning on line 197 in augur/api/view/routes.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 W0511: TODO get application from client id (fixme) Raw Output: augur/api/view/routes.py:197:5: W0511: TODO get application from client id (fixme)
client = ClientApplication.get_by_id(db_session, client_id)

return render_module("authorization", app = client, state = state)
Expand Down
4 changes: 4 additions & 0 deletions augur/api/view/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""
Defines utility functions used by the augur api views
"""
from pathlib import Path
IsaacMilarky marked this conversation as resolved.
Show resolved Hide resolved
from concurrent.futures import ThreadPoolExecutor
from flask import render_template, flash, url_for, Flask
from .init import init_logging

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)

from .init import *

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
W0401: Wildcard import init (wildcard-import)

from ..server import app, db_session

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)

from augur.application.config import AugurConfig
Expand Down
Loading
Loading