Merge branch 'devops/diagnose-lint-pipeline' into 'dev'

Install packages in pylint analysis job

See merge request crafty-controller/crafty-4!708
This commit is contained in:
Iain Powrie 2024-02-02 20:12:11 +00:00
commit d4e158ad21
4 changed files with 32 additions and 11 deletions

View File

@ -51,6 +51,10 @@ pylint:
- if: "$CODE_QUALITY_DISABLED"
when: never
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
before_script:
- apk update
- apk add gcc python3-dev linux-headers build-base
- pip3 install --no-cache-dir -r requirements.txt
script:
- pylint --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate:codeclimate.json $(find -type f -name "*.py" ! -path "**/.venv/**" ! -path "**/app/migrations/**")
artifacts:

View File

@ -106,7 +106,7 @@ class BaseHandler(tornado.web.RequestHandler):
if type(text) in self.nobleach:
logger.debug("Auto-bleaching - bypass type")
return text
return nh3.clean(text)
return nh3.clean(text) # pylint: disable=no-member
def get_argument(
self,

View File

@ -80,7 +80,9 @@ class PanelHandler(BaseHandler):
) in self.controller.crafty_perms.list_defined_crafty_permissions():
argument = int(
float(
nh3.clean(self.get_argument(f"permission_{permission.name}", "0"))
nh3.clean(
self.get_argument(f"permission_{permission.name}", "0")
) # pylint: disable=no-member
)
)
if argument:
@ -89,7 +91,9 @@ class PanelHandler(BaseHandler):
)
q_argument = int(
float(nh3.clean(self.get_argument(f"quantity_{permission.name}", "0")))
float(
nh3.clean(self.get_argument(f"quantity_{permission.name}", "0"))
) # pylint: disable=no-member
)
if q_argument:
server_quantity[permission.name] = q_argument
@ -503,7 +507,9 @@ class PanelHandler(BaseHandler):
template = "panel/dashboard.html"
elif page == "server_detail":
subpage = nh3.clean(self.get_argument("subpage", ""))
subpage = nh3.clean(
self.get_argument("subpage", "")
) # pylint: disable=no-member
server_id = self.check_server_id()
# load page the user was on last
@ -1362,7 +1368,9 @@ class PanelHandler(BaseHandler):
template = "panel/panel_edit_user_apikeys.html"
elif page == "remove_user":
user_id = nh3.clean(self.get_argument("id", None))
user_id = nh3.clean(
self.get_argument("id", None)
) # pylint: disable=no-member
if (
not superuser

View File

@ -29,8 +29,12 @@ class PublicHandler(BaseHandler):
# self.clear_cookie("user_data")
def get(self, page=None):
error = nh3.clean(self.get_argument("error", "Invalid Login!"))
error_msg = nh3.clean(self.get_argument("error_msg", ""))
error = nh3.clean(
self.get_argument("error", "Invalid Login!")
) # pylint: disable=no-member
error_msg = nh3.clean(
self.get_argument("error_msg", "")
) # pylint: disable=no-member
page_data = {
"version": self.helper.get_version_string(),
@ -87,8 +91,12 @@ class PublicHandler(BaseHandler):
)
def post(self, page=None):
error = nh3.clean(self.get_argument("error", "Invalid Login!"))
error_msg = nh3.clean(self.get_argument("error_msg", ""))
error = nh3.clean(
self.get_argument("error", "Invalid Login!")
) # pylint: disable=no-member
error_msg = nh3.clean(
self.get_argument("error_msg", "")
) # pylint: disable=no-member
page_data = {
"version": self.helper.get_version_string(),
@ -108,10 +116,11 @@ class PublicHandler(BaseHandler):
if self.request.query:
next_page = "/login?" + self.request.query
entered_username = nh3.clean(self.get_argument("username"))
entered_username = nh3.clean(
self.get_argument("username")
) # pylint: disable=no-member
entered_password = self.get_argument("password")
# pylint: disable=no-member
try:
user_id = HelperUsers.get_user_id_by_name(entered_username.lower())
user_data = HelperUsers.get_user_model(user_id)