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 #515

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

Sync pre-commit checks with django-cms #515

marksweb opened this issue Jan 29, 2024 · 2 comments
Assignees

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.

@raffaellasuardini
Copy link
Contributor

I'm going to work on this

@raffaellasuardini
Copy link
Contributor

This issue is solved in this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants