From 5484479618068fff93efd70958c0c920e978a367 Mon Sep 17 00:00:00 2001 From: Kanishk Pachauri Date: Mon, 31 Mar 2025 01:18:05 +0530 Subject: [PATCH 1/4] feat: add pre-commit --- .pre-commit-config.yaml | 14 ++++++++++++++ readme.md | 14 ++++++++++++++ requirements-dev.txt | 1 + 3 files changed, 29 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2c85f44 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: + - repo: https://github.com/PyCQA/isort + rev: 6.0.1 + hooks: + - id: isort + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 25.1.0 + hooks: + - id: black + language_version: python3 + - repo: https://github.com/PyCQA/flake8 + rev: 7.1.2 + hooks: + - id: flake8 \ No newline at end of file diff --git a/readme.md b/readme.md index 666ebe3..0255add 100644 --- a/readme.md +++ b/readme.md @@ -117,3 +117,17 @@ user.save() ``` 8. You can now access the /admin page. + +## Setup pre-commit for identify simple issues and standardize code formatting + +Pyladiescon-portal uses a tool called [pre-commit](https://pre-commit.com/) to identify simple issues and standardize code formatting. It does this by installing a git hook that automatically runs a series of code linters prior to finalizing any git commit. To enable pre-commit, run: + +``` +pre-commit install +``` + +### Pre-commit automatically runs during the commit + +With pre-commit installed as a git hook for verifying commits, the pre-commit hooks configured in `.pre-commit-config.yaml` for Pyladiescon-portal must all pass before the commit is successful. If there are any issues found with the commit, this will cause your commit to fail. Where possible, pre-commit will make the changes needed to correct the problems it has found. + +You can then re-add any files that were modified as a result of the pre-commit checks, and re-commit the change. \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 9dc064b..d886ba6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,3 +6,4 @@ pytest-django==4.8.0 pytest==8.3.5 pytest-cov==6.0.0 coverage==7.7.0 +pre_commit==4.2.0 \ No newline at end of file From ff51d0363de755f24a3eebddde99997761a3e982 Mon Sep 17 00:00:00 2001 From: Kanishk Pachauri Date: Mon, 7 Apr 2025 10:45:47 +0530 Subject: [PATCH 2/4] Update readme.md Co-authored-by: Mariatta --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 0255add..449eaa6 100644 --- a/readme.md +++ b/readme.md @@ -118,7 +118,7 @@ user.save() 8. You can now access the /admin page. -## Setup pre-commit for identify simple issues and standardize code formatting +## Setup pre-commit Pyladiescon-portal uses a tool called [pre-commit](https://pre-commit.com/) to identify simple issues and standardize code formatting. It does this by installing a git hook that automatically runs a series of code linters prior to finalizing any git commit. To enable pre-commit, run: From fc16746babb6f09f701f8d056a5a545de7d20953 Mon Sep 17 00:00:00 2001 From: Kanishk Pachauri Date: Mon, 7 Apr 2025 10:45:55 +0530 Subject: [PATCH 3/4] Update readme.md Co-authored-by: Mariatta --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 449eaa6..1cf374f 100644 --- a/readme.md +++ b/readme.md @@ -120,7 +120,7 @@ user.save() ## Setup pre-commit -Pyladiescon-portal uses a tool called [pre-commit](https://pre-commit.com/) to identify simple issues and standardize code formatting. It does this by installing a git hook that automatically runs a series of code linters prior to finalizing any git commit. To enable pre-commit, run: +PyLadiescon-portal uses a tool called [pre-commit](https://pre-commit.com/) to enforce coding standard and styles. To enable pre-commit, run: ``` pre-commit install From d2864e9a1b543fc6402dda16ef84dc9dfb18dbae Mon Sep 17 00:00:00 2001 From: Kanishk Pachauri Date: Mon, 7 Apr 2025 10:46:01 +0530 Subject: [PATCH 4/4] Update readme.md Co-authored-by: Mariatta --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 1cf374f..54d2b58 100644 --- a/readme.md +++ b/readme.md @@ -128,6 +128,6 @@ pre-commit install ### Pre-commit automatically runs during the commit -With pre-commit installed as a git hook for verifying commits, the pre-commit hooks configured in `.pre-commit-config.yaml` for Pyladiescon-portal must all pass before the commit is successful. If there are any issues found with the commit, this will cause your commit to fail. Where possible, pre-commit will make the changes needed to correct the problems it has found. +With pre-commit installed as a git hook for verifying commits, the pre-commit hooks configured in `.pre-commit-config.yaml` for PyLadiescon-portal must all pass before the commit is successful. If there are any issues found with the commit, this will cause your commit to fail. Where possible, pre-commit will make the changes needed to correct the problems it has found. You can then re-add any files that were modified as a result of the pre-commit checks, and re-commit the change. \ No newline at end of file