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

Include an option to use ruff as the linter #188

Closed
wants to merge 2 commits into from
Closed

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Nov 12, 2024

@marcospri marcospri force-pushed the ruff-linter branch 8 times, most recently from 1c30ee0 to e3dc1f5 Compare November 20, 2024 09:44
@marcospri marcospri force-pushed the ruff-linter branch 2 times, most recently from 2e819db to d2dcc6b Compare December 31, 2024 09:43
@marcospri marcospri changed the title [WIP] Include an option to use ruff as the linter Include an option to use ruff as the linter Dec 31, 2024
@marcospri marcospri force-pushed the ruff-linter branch 3 times, most recently from 9373e25 to f9d53a7 Compare December 31, 2024 11:38
@@ -43,6 +43,10 @@ def remove_conditional_files():
paths_to_remove.extend([".github/workflows/pypi.yml"])
{% endif %}

{% if cookiecutter.get("linter") == "ruff" %}
Copy link
Member Author

Choose a reason for hiding this comment

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

ruff config is more compact, no need for two files, remove the test one in case is generated.

@@ -77,7 +159,12 @@ show_missing = true
precision = 2
fail_under = 100.00
skip_covered = true
exclude_also = [
Copy link
Member Author

Choose a reason for hiding this comment

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

Ignore this type of conditional from coverage.

@@ -48,7 +52,13 @@ def delete(engine: Engine) -> None:
else:
pre_delete(engine)

Base.metadata.drop_all(engine)
with engine.connect() as connection:
# Delete the DB "public" schema directly.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is part of LMS, it seems to have worked for a while. Bringing it to other repos.

"PLR2004", # Magic values, we mostly get it on HTTP status codes

# Disabled during the pylint migration, ideally we'll enable this after we are settled in ruff
"RET504",
Copy link
Member Author

Choose a reason for hiding this comment

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

Having these here allows to remove them from the template and apply to all projects.

@seanh
Copy link
Contributor

seanh commented Jan 10, 2025

Rebased

seanh added a commit that referenced this pull request Jan 10, 2025
This is extracted from
#188 as a separate PR.

This commit also adds includes for per-project overriding or extending
of the coverage excludes:

* If a project has a `.cookiecutter/includes/coverage/exclude_also` file
  that will _replace_ the cookiecutter's default `exclude_also`'s

* If a project has a `.cookiecutter/includes/coverage/exclude_also/tail` file
  that will _extend_ the cookiecutter's default `exclude_also`'s

Also fix a bug in `local_extensions.py`'s `include_exists(path)` function:
don't crash if there's a _folder_ (rather than a file) at `path` (the
code was catching the wrong exception class, looks like just a mistake).
seanh added a commit that referenced this pull request Jan 10, 2025
Extracted from #188 as a separate PR.

> Type-checks the interior of functions without type annotations.

https://mypy.readthedocs.io/en/stable/config_file.html#confval-check_untyped_defs
seanh added a commit that referenced this pull request Jan 10, 2025
Add a couple of includes for per-project customisation of which modules
we tell mypy to ignore.

This also tidies up the formatting of this section of pyproject.toml a
little, which unfortunately will mean a change to every single project.

This is extracted from
#188 as a separate PR.
seanh added a commit that referenced this pull request Jan 10, 2025
Add a couple of includes for per-project customisation of which modules
we tell mypy to ignore.

This also tidies up the formatting of this section of pyproject.toml a
little, which unfortunately will mean a change to every single project.

This is extracted from
#188 as a separate PR.
seanh added a commit that referenced this pull request Jan 10, 2025
Extracted from #188
as a separate PR.
seanh added a commit that referenced this pull request Jan 17, 2025
This is extracted from
#188 as a separate PR.

This commit also adds includes for per-project overriding or extending
of the coverage excludes:

* If a project has a `.cookiecutter/includes/coverage/exclude_also` file
  that will _replace_ the cookiecutter's default `exclude_also`'s

* If a project has a `.cookiecutter/includes/coverage/exclude_also/tail` file
  that will _extend_ the cookiecutter's default `exclude_also`'s

Also fix a bug in `local_extensions.py`'s `include_exists(path)` function:
don't crash if there's a _folder_ (rather than a file) at `path` (the
code was catching the wrong exception class, looks like just a mistake).
seanh added a commit that referenced this pull request Jan 17, 2025
This is extracted from
#188 as a separate PR.

This commit also adds includes for per-project overriding or extending
of the coverage excludes:

* If a project has a `.cookiecutter/includes/coverage/exclude_also` file
  that will _replace_ the cookiecutter's default `exclude_also`'s

* If a project has a `.cookiecutter/includes/coverage/exclude_also/tail` file
  that will _extend_ the cookiecutter's default `exclude_also`'s

Also fix a bug in `local_extensions.py`'s `include_exists(path)` function:
don't crash if there's a _folder_ (rather than a file) at `path` (the
code was catching the wrong exception class, looks like just a mistake).
seanh added a commit that referenced this pull request Jan 17, 2025
Add a couple of includes for per-project customisation of which modules
we tell mypy to ignore.

This also tidies up the formatting of this section of pyproject.toml a
little, which unfortunately will mean a change to every single project.

This is extracted from
#188 as a separate PR.
seanh added a commit that referenced this pull request Jan 17, 2025
Add a couple of includes for per-project customisation of which modules
we tell mypy to ignore.

This also tidies up the formatting of this section of pyproject.toml a
little, which unfortunately will mean a change to every single project.

This is extracted from
#188 as a separate PR.
seanh added a commit that referenced this pull request Jan 17, 2025
Extracted from #188
as a separate PR.
@seanh seanh force-pushed the ruff-linter branch 2 times, most recently from 43f91b1 to 8f2f97d Compare January 17, 2025 17:29
@seanh seanh changed the base branch from main to move-setuptools-into-pyproject.toml January 17, 2025 17:29
@seanh
Copy link
Contributor

seanh commented Jan 17, 2025

I've rebased this onto #201

Base automatically changed from move-setuptools-into-pyproject.toml to main January 21, 2025 10:43
@seanh
Copy link
Contributor

seanh commented Jan 21, 2025

Closing in favour of #196

@seanh seanh closed this Jan 21, 2025
@seanh seanh deleted the ruff-linter branch January 21, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants