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

Sync pre-commit checks with django-cms #216

Open
marksweb opened this issue Jan 29, 2024 · 0 comments
Open

Sync pre-commit checks with django-cms #216

marksweb opened this issue Jan 29, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@marksweb
Copy link
Member

I've made changes over the weekend to the pre-commit hooks in django-cms.

Ideally we'll have these consistent between projects. The main thing in the change is adopting the ruff linter and formatter.

In theory you should be able to just copy & paste the config from django-cms into these other projects;

https://github.com/django-cms/django-cms/blob/develop-4/.pre-commit-config.yml

The way ruff works is dictated by the pyproject.toml config which you can see here;

https://github.com/django-cms/django-cms/blob/develop-4/pyproject.toml

This project has one already, so this isn't as much a copy & paste job. The main thing is to have the same things in the select block.

Then in django-cms you'll see it uses extend-ignore and extend-exclude. So where projects like this on have exclude and ignore, we want to update these to the extend- versions.

Then you'll see a # TODO fix separately block. Create one of these that includes all the checks that currently fail. These can be fixed in smaller PRs.

To make sure you can run ruff, it's a python package. So in your virtual env run python -m pip install ruff

Also make sure you have pre-commit setup;

python -m pip install pre-commit
pre-commit install

Now any commits you make will get checked by the project's hooks. And if you add more, you just run the pre-commit install again.

Now you can run ruff using ruff check .

This will run the defined checks against the current directory. It's at this point you need to make judgements on if it's running on any directories that you could exclude because it's not part of the project. And then start adding to that # TODO list of rules.

Hopefully that's enough info to get started, but let me know if you've any questions. And of course, you can query things on slack as well. Maybe using the contributors channel for things realted to these changes.

@marksweb marksweb added the good first issue Good for newcomers label Jan 29, 2024
raffaellasuardini added a commit to raffaellasuardini/djangocms-alias that referenced this issue Feb 19, 2024
marksweb pushed a commit that referenced this issue Feb 19, 2024
* chore: solved rule E501 (line too long)

* chore: solved UP032 (use f-string)

* fix: update pyproject.toml to solve issue #216

* ci: auto fixes from pre-commit hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

1 participant