Skip to content

Commit

Permalink
Move pylint's too-complex check to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Sep 19, 2024
1 parent f29e9fa commit 53d5804
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lms/resources/_js_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _h_user(self):
def _application_instance(self) -> ApplicationInstance:
return self._lti_user.application_instance

def add_document_url( # pylint: disable=too-complex,too-many-branches,useless-suppression # noqa: PLR0912
def add_document_url( # pylint: disable=too-complex,too-many-branches,useless-suppression # noqa: C901, PLR0912
self, document_url
) -> None:
"""
Expand Down
4 changes: 2 additions & 2 deletions lms/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def forget(self, request):

@staticmethod
@lru_cache(maxsize=1)
def get_policy(request: Request): # noqa: PLR0911
def get_policy(request: Request): # noqa: C901, PLR0911
"""Pick the right policy based the request's path."""
# pylint:disable=too-many-return-statements,too-complex
# pylint:disable=too-many-return-statements

path = request.path

Expand Down
3 changes: 1 addition & 2 deletions lms/services/application_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ def search( # noqa: PLR0913
.all()
)

# pylint: disable=too-complex
def _ai_search_query( # noqa: PLR0913
def _ai_search_query( # noqa: C901, PLR0913
self,
*,
id_=None,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ disable = [
"protected-access",
"singleton-comparison",
"unnecessary-lambda-assignment",
"too-complex",

# Not supported by ruff
"too-many-ancestors",
Expand Down Expand Up @@ -193,7 +194,6 @@ ignore = [
"PLC1901",
"E721",
"C414",
"C901",
]

[tool.ruff.lint.per-file-ignores]
Expand Down
6 changes: 6 additions & 0 deletions tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ disable = [

# Ported to ruff
"unused-argument",
"broad-exception-caught",
"too-many-arguments",
"import-outside-toplevel",
"too-many-statements",
"protected-access",
"singleton-comparison",
"unnecessary-lambda-assignment",
"too-complex",
]

# Just disable PyLint's name style checking for the tests, because we
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lms/services/canvas_studio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def admin_oauth_http_service(self):
svc.get.side_effect = self.get_request_handler(is_admin=True)
return svc

def get_request_handler(self, collections=None, is_admin=False): # noqa: PLR0915 pylint:disable=too-complex
def get_request_handler(self, collections=None, is_admin=False): # noqa: C901, PLR0915
"""
Create a handler for `GET` requests to the Canvas Studio API.
Expand Down Expand Up @@ -373,7 +373,7 @@ def make_file(id_, title, created_at, with_thumbnail=False):
make_collection(10, None, "course_wide", "2024-03-01"),
]

def handler(url, allow_redirects=True): # noqa: PLR0912, PLR0915
def handler(url, allow_redirects=True): # noqa: C901, PLR0912, PLR0915
api_prefix = "/api/public/v1/"

parsed_url = urlparse(url)
Expand Down

0 comments on commit 53d5804

Please sign in to comment.