Skip to content

feat(lint): add pre-commit and linter as dependencies of the project#387

Merged
Shillaker merged 2 commits intoBoavizta:mainfrom
jonperron:feat/ruff_lint
Dec 30, 2025
Merged

feat(lint): add pre-commit and linter as dependencies of the project#387
Shillaker merged 2 commits intoBoavizta:mainfrom
jonperron:feat/ruff_lint

Conversation

@jonperron
Copy link
Copy Markdown
Collaborator

Changelog:

  • Add pre-commit in dev dependancies of pyproject.toml
  • Add ruff as linter in dev dependancies of pyproject.toml
  • Add pre-commit config file and set configuration for ruff
  • Update Contributing.md to mention the requirement of using pre-commit before merging
  • Update dockerignore to ignore pre-commit related files

Fix #364

@jonperron
Copy link
Copy Markdown
Collaborator Author

jonperron commented Mar 29, 2025

I chose ruff because it's one of the best and fastest linter at the moment, it is still maintained and has an important community.

I tested the configuration using a dummy modification of main.py and a clean installation of the repository, seems to work fine

(venv) jperron:~/boaviztapi-dev$ git checkout -b chore/test_pre-commit
Basculement sur la nouvelle branche 'chore/test_pre-commit'
(venv) jperron:~/boaviztapi-dev$ git status
Sur la branche chore/test_pre-commit
Modifications qui ne seront pas validées :
  (utilisez "git add <fichier>..." pour mettre à jour ce qui sera validé)
  (utilisez "git restore <fichier>..." pour annuler les modifications dans le répertoire de travail)
	modifié :         boaviztapi/main.py

aucune modification n'a été ajoutée à la validation (utilisez "git add" ou "git commit -a")
(venv) jperron:~/boaviztapi-dev$ git add boaviztapi/main.py 
(venv) jperron:~/boaviztapi-dev$ git commit
ruff.....................................................................Passed
[chore/test_pre-commit 44b5542] WIP test
 1 file changed, 1 insertion(+)

@jonperron jonperron changed the title feat(lint): add pre-commit as dependancy of the project feat(lint): add pre-commit and linter as dependancies of the project Mar 29, 2025
@jonperron jonperron changed the title feat(lint): add pre-commit and linter as dependancies of the project feat(lint): add pre-commit and linter as dependencies of the project Mar 29, 2025
Changelog:
* Add pre-commit in dev dependancies of pyproject.toml
* Add ruff as linter in dev dependancies of pyproject.toml
* Add pre-commit config file and set configuration for ruff
* Update Contributing.md to mention the requirement of using pre-commit before merging
* Update dockerignore to ignore pre-commit related files
@Shillaker
Copy link
Copy Markdown
Collaborator

Shillaker commented Dec 23, 2025

Hi @jonperron I added a couple of suggestions:

  • Remove format pre-commit hook (we can deal with formatting in a separate issue, see Apply code formatting #429)
  • Add some useful commands to the Makefile (e.g. make lint, make lint-fix)
  • Add a CI step to run the lint
  • Apply the automatic fixes supported by ruff, and add ignores for all other failing lint steps
  • Update README and CONTRIBUTING

The CI linting step now passes, but obviously lots of linting is ignored for this to work. To fully fix, we need to go through the ignores, uncomment them, and then fix the linting issues.

Note that there is also the question of formatting. It would be great to run ruff format over the whole project too, but this can wait (see linked issue on the topic).

@Shillaker Shillaker force-pushed the feat/ruff_lint branch 2 times, most recently from 987a5b6 to 6850057 Compare December 30, 2025 11:35
@Shillaker Shillaker mentioned this pull request Dec 30, 2025
@Shillaker Shillaker self-assigned this Dec 30, 2025
@Shillaker Shillaker merged commit 9513ff1 into Boavizta:main Dec 30, 2025
5 checks passed
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.

Add lint to pre-commit and/or to CI

2 participants