pre-commit-crocodile 3.0.0__tar.gz → 3.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.gitlab-ci.yml +17 -1
  2. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/CHANGELOG.md +42 -0
  3. {pre_commit_crocodile-3.0.0/pre_commit_crocodile.egg-info → pre_commit_crocodile-3.1.0}/PKG-INFO +9 -6
  4. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/README.md +8 -5
  5. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/config/cliff.toml +1 -1
  6. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/codestyle/Dockerfile +1 -1
  7. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/commits/Dockerfile +1 -1
  8. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/deploy/Dockerfile +1 -1
  9. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/pages/Dockerfile +4 -2
  10. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/preview/Dockerfile +1 -1
  11. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/commitizen.md +1 -0
  12. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/commits.md +1 -0
  13. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/components.md +1 -0
  14. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/hooks.md +1 -0
  15. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/pre-commit.md +1 -0
  16. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/prepare.sh +14 -2
  17. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/settings.md +1 -0
  18. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/mkdocs.yml +1 -0
  19. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0/pre_commit_crocodile.egg-info}/PKG-INFO +9 -6
  20. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/pre_commit_crocodile.egg-info/SOURCES.txt +1 -0
  21. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/sonar-project.properties +3 -0
  22. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/assets/.pre-commit-config.yaml +7 -0
  23. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/cli/entrypoint.py +51 -11
  24. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/cli/main.py +9 -0
  25. pre_commit_crocodile-3.1.0/src/features/gcil.py +168 -0
  26. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/features/git.py +2 -2
  27. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/features/precommit.py +41 -6
  28. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/hooks/configurations.py +11 -0
  29. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.coveragerc +0 -0
  30. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.cz.yaml +0 -0
  31. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.gitattributes +0 -0
  32. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.gitignore +0 -0
  33. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.markdownlint.json +0 -0
  34. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.pre-commit-config.yaml +0 -0
  35. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.pre-commit-hooks.yaml +0 -0
  36. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.style.yapf +0 -0
  37. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.vscode/extensions.json +0 -0
  38. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/.vscode/settings.json +0 -0
  39. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/LICENSE +0 -0
  40. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/test-coverage-linux/Dockerfile +0 -0
  41. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/test-coverage-windows/Dockerfile +0 -0
  42. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/containers/test-linux/Dockerfile +0 -0
  43. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/preview.py +0 -0
  44. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/preview.svg +0 -0
  45. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/docs/template.svg +0 -0
  46. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/mypy.ini +0 -0
  47. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/pre_commit_crocodile.egg-info/dependency_links.txt +0 -0
  48. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/pre_commit_crocodile.egg-info/entry_points.txt +0 -0
  49. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/pre_commit_crocodile.egg-info/requires.txt +0 -0
  50. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/pre_commit_crocodile.egg-info/top_level.txt +0 -0
  51. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/build.txt +0 -0
  52. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/commits.txt +0 -0
  53. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/coverage.txt +0 -0
  54. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/deploy.txt +0 -0
  55. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/docs.txt +0 -0
  56. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/pages.txt +0 -0
  57. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/quality.txt +0 -0
  58. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/runtime.txt +0 -0
  59. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/requirements/tests.txt +0 -0
  60. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/setup.cfg +0 -0
  61. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/setup.py +0 -0
  62. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/__init__.py +0 -0
  63. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/__main__.py +0 -0
  64. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/assets/.cz.yaml +0 -0
  65. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/assets/__init__.py +0 -0
  66. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/cli/__init__.py +0 -0
  67. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/features/__init__.py +0 -0
  68. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/features/argcomplete.py +0 -0
  69. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/features/commitizen.py +0 -0
  70. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/features/readme.py +0 -0
  71. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/hooks/__init__.py +0 -0
  72. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/hooks/prepare_commit_message.py +0 -0
  73. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/package/__init__.py +0 -0
  74. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/package/bundle.py +0 -0
  75. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/package/settings.py +0 -0
  76. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/package/updates.py +0 -0
  77. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/package/version.py +0 -0
  78. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/prints/__init__.py +0 -0
  79. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/prints/boxes.py +0 -0
  80. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/prints/colors.py +0 -0
  81. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/system/__init__.py +0 -0
  82. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/system/commands.py +0 -0
  83. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/system/platform.py +0 -0
  84. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/types/__init__.py +0 -0
  85. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/types/environments.py +0 -0
  86. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/src/types/strings.py +0 -0
  87. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/templates/commits.yml +0 -0
  88. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/tests/arguments/test.sh +0 -0
  89. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/tests/colors/test.sh +0 -0
  90. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/tests/macos/test.sh +0 -0
  91. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/tests/settings/test.sh +0 -0
  92. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/tests/versions/test.sh +0 -0
  93. {pre_commit_crocodile-3.0.0 → pre_commit_crocodile-3.1.0}/tests/windows/test.sh +0 -0
@@ -246,7 +246,7 @@ serve:
246
246
  # Prepare documentation
247
247
  - |
248
248
  mkdir -p ./docs/.cache/
249
- ls -1 ./.cz.yaml ./docs/* ./mkdocs.yml ./README.md | entr sh ./docs/prepare.sh &
249
+ ls -1 ./.cz.yaml ./config/* ./docs/* ./mkdocs.yml ./README.md | entr sh ./docs/prepare.sh &
250
250
  echo -n "${!}" >./docs/.cache/.serve.pid
251
251
  sleep 2
252
252
  # Generate documentation
@@ -586,6 +586,15 @@ sonarcloud:
586
586
  # Configure Git securities
587
587
  - git config --global --add safe.directory "${CI_PROJECT_DIR}"
588
588
  script:
589
+ # Prevent local usage
590
+ - |
591
+ if [ ! -z "${CI_LOCAL:-}" ] && [ -z "${SONAR_HOST_URL:-}" ]; then
592
+ set +x
593
+ echo ' '
594
+ echo ' [ERROR] SonarCloud quality job is meant for CI executions only...'
595
+ echo ' '
596
+ exit 1
597
+ fi
589
598
  # Scan with SonarCloud
590
599
  - sonar-scanner -Dsonar.projectVersion=$(git describe --always) -Dsonar.branch.name=${CI_COMMIT_REF_NAME}
591
600
  rules:
@@ -598,6 +607,8 @@ sonarcloud:
598
607
  when: always
599
608
  - if: $CI_COMMIT_REF_NAME == "main"
600
609
  when: always
610
+ - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
611
+ when: always
601
612
  - when: never
602
613
  allow_failure: true
603
614
 
@@ -693,6 +704,11 @@ pages:
693
704
  artifacts: false
694
705
  optional: true
695
706
  script:
707
+ # Fetch all tags
708
+ - |
709
+ if [ -z "${CI_LOCAL:-}" ]; then
710
+ git fetch --tags --unshallow || true
711
+ fi
696
712
  # Prepare documentation
697
713
  - sh ./docs/prepare.sh
698
714
  # Generate documentation
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ <a name="3.1.0"></a>
4
+ ## [3.1.0](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/compare/3.0.0...3.1.0) (2024-08-25)
5
+
6
+ ### ✨ Features
7
+
8
+ - **cli:** implement '--stage STAGE' for '--run' to specify stage ([9ef3d2a](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/9ef3d2ac4c9017ca247595da41a7cd9e5f998bd7))
9
+ - **configurations:** implement matcher for 'sonar-project.properties' ([b9627a6](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/b9627a653a5336e3b1483894bd7a3c0c9b71c514))
10
+ - **gcil:** inject 'gcil' badge automatically if configured or installed ([6cfe076](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/6cfe07681fe0ac7e8ac35d4c95da4bc36a8f045f))
11
+ - **gcil:** implement automatic 'run-gcil-push' hooks with whitelist ([56e9e6c](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/56e9e6ca4c46e11eb86479127a98042e9a039693))
12
+ - **main:** add '-D' as short flag for '--default' long flag ([6515c29](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/6515c295868477d4bb3f88111b67fbf1d157ae5d))
13
+ - **pre-commit:** add 'pygrep-hooks' hooks to 'pre-commit' template ([8813f81](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/8813f8119c88c39a62834fcf1f5a0b8fe74211aa))
14
+
15
+ ### 🐛 Bug Fixes
16
+
17
+ - **features:** enforce 'Commands' conditional arguments syntax ([142108f](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/142108f37896f9523e43144f3433092b1b4b5952))
18
+
19
+ ### 📚 Documentation
20
+
21
+ - **cliff:** improve 'Unreleased' and refactor to 'Development' ([abaf0c9](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/abaf0c9c11ac9e1e5bbf37fa3d5fe99f9290e436))
22
+ - **mkdocs, prepare:** resolve Markdown support in hidden '<details>' ([d647166](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/d647166f68fcccd2ab7ec1c3717622fa365a8bd8))
23
+ - **prepare:** regenerate development 'CHANGELOG' with 'git-cliff' ([0cc6cc7](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/0cc6cc7995c56d91b1fb1eb7f9f63c35ce7c3609))
24
+ - **readme:** link against 'gcil' and 'pexpect-executor' documentation pages ([3044355](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/304435558aeab4e9792b4029c8a9d9b26ef54771))
25
+ - **readme:** add 'gcil:enabled' documentation badge ([f06542b](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/f06542bac9d87e6844171cca4d4c96f9182ff91f))
26
+
27
+ ### ⚙️ Cleanups
28
+
29
+ - **sonar:** wait for SonarCloud Quality Gate status ([f48b69e](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/f48b69efeb94f034b3fbf84dfaeebb35dfc0e6ea))
30
+
31
+ ### 🚀 CI
32
+
33
+ - **gitlab-ci:** prevent 'sonarcloud' job launch upon 'gcil' local use ([8ba9700](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/8ba97001ad13c6feb40e02dfac391c1169740f0f))
34
+ - **gitlab-ci:** run SonarCloud analysis on merge request pipelines ([0f34e2d](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/0f34e2da8dfff5e7eb27a987dd02ffcc2c7aa3f6))
35
+ - **gitlab-ci:** watch for 'config/*' changes in 'serve' job ([c47e433](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/c47e4339fc6f321debce26c57dd265fea51eb3f8))
36
+ - **gitlab-ci:** fetch Git tags history in 'pages' job execution ([c4c8b71](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/c4c8b71f55198eae1e273cd00e81df94a87c15f9))
37
+ - **gitlab-ci:** fetch with '--unshallow' for full history in 'pages' ([cd6d65e](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/cd6d65e3f82b61afc7d56aadec907bf1489e688a))
38
+
39
+ ### 📦 Build
40
+
41
+ - **containers:** use 'apk add --no-cache' for lighter images ([d13b26a](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/d13b26a2bc88327bebfad60e635604ac786c9f4a))
42
+ - **pages:** add 'git-cliff' to the ':pages' image ([26f26c6](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/26f26c6f0b06e3835a5d553eb5342d2ba5ec94da))
43
+
44
+
3
45
  <a name="3.0.0"></a>
4
46
  ## [3.0.0](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/compare/2.1.0...3.0.0) (2024-08-25)
5
47
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pre-commit-crocodile
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: Git hooks intended for developers using pre-commit
5
5
  Home-page: https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile
6
6
  Author: Adrian DC
@@ -44,6 +44,7 @@ Requires-Dist: update_checker>=0.18.0
44
44
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
45
45
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
46
46
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
47
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
47
48
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
48
49
 
49
50
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -66,7 +67,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
66
67
 
67
68
  ## Preview
68
69
 
69
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/3.0.0/docs/preview.svg)
70
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/3.1.0/docs/preview.svg)
70
71
 
71
72
  ---
72
73
 
@@ -77,7 +78,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
77
78
 
78
79
  ```yaml
79
80
  usage: pre-commit-crocodile [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]
80
- [-l | -i | -c | -e | -d | -a | -C | -r] [--config FOLDER | --default] [--]
81
+ [-l | -i | -c | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--stage STAGE] [--]
81
82
 
82
83
  pre-commit-crocodile: Git hooks intended for developers using pre-commit
83
84
 
@@ -103,7 +104,9 @@ modes arguments:
103
104
 
104
105
  configurations arguments:
105
106
  --config FOLDER # Use configurations from a specific folder
106
- --default # Use global default configurations instead of sources
107
+ -D, --default # Use global default configurations instead of sources
108
+ --stage STAGE # Run a specific pre-commit stage with --run
109
+ # (use 'list' to list supported stages)
107
110
 
108
111
  positional arguments:
109
112
  -- # Positional arguments separator (recommended)
@@ -214,13 +217,13 @@ pre-commit-crocodile --clean
214
217
 
215
218
  - [.gitlab-ci.yml](https://docs.gitlab.com/ee/ci/yaml/): GitLab CI/CD Pipeline Configuration Reference
216
219
  - [conventionalcommits](https://www.conventionalcommits.org/en/v1.0.0/): Conventional Commits specification for commit messages
217
- - [gcil](https://pypi.org/project/gitlabci-local/): Launch .gitlab-ci.yml jobs locally
220
+ - [gcil](https://radiandevcore.gitlab.io/tools/gcil): Launch .gitlab-ci.yml jobs locally
218
221
  - [git-cliff](https://github.com/orhun/git-cliff): CHANGELOG generator
219
222
  - [gitlab-release](https://pypi.org/project/gitlab-release/): Utility for publishing on GitLab
220
223
  - [mkdocs](https://www.mkdocs.org/): Project documentation with Markdown
221
224
  - [mkdocs-material](https://squidfunk.github.io/mkdocs-material/): Material theme for mkdocs documentation
222
225
  - [mypy](https://pypi.org/project/mypy/): Optional static typing for Python
223
- - [pexpect-executor](https://pypi.org/project/pexpect-executor/): Automate interactive CLI tools actions
226
+ - [pexpect-executor](https://radiandevcore.gitlab.io/tools/pexpect-executor): Automate interactive CLI tools actions
224
227
  - [PyPI](https://pypi.org/): The Python Package Index
225
228
  - [termtosvg](https://pypi.org/project/termtosvg/): Record terminal sessions as SVG animations
226
229
  - [twine](https://pypi.org/project/twine/): Utility for publishing on PyPI
@@ -10,6 +10,7 @@
10
10
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
11
11
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
12
12
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
13
14
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
14
15
 
15
16
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -32,7 +33,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
32
33
 
33
34
  ## Preview
34
35
 
35
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/3.0.0/docs/preview.svg)
36
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/3.1.0/docs/preview.svg)
36
37
 
37
38
  ---
38
39
 
@@ -43,7 +44,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
43
44
 
44
45
  ```yaml
45
46
  usage: pre-commit-crocodile [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]
46
- [-l | -i | -c | -e | -d | -a | -C | -r] [--config FOLDER | --default] [--]
47
+ [-l | -i | -c | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--stage STAGE] [--]
47
48
 
48
49
  pre-commit-crocodile: Git hooks intended for developers using pre-commit
49
50
 
@@ -69,7 +70,9 @@ modes arguments:
69
70
 
70
71
  configurations arguments:
71
72
  --config FOLDER # Use configurations from a specific folder
72
- --default # Use global default configurations instead of sources
73
+ -D, --default # Use global default configurations instead of sources
74
+ --stage STAGE # Run a specific pre-commit stage with --run
75
+ # (use 'list' to list supported stages)
73
76
 
74
77
  positional arguments:
75
78
  -- # Positional arguments separator (recommended)
@@ -180,13 +183,13 @@ pre-commit-crocodile --clean
180
183
 
181
184
  - [.gitlab-ci.yml](https://docs.gitlab.com/ee/ci/yaml/): GitLab CI/CD Pipeline Configuration Reference
182
185
  - [conventionalcommits](https://www.conventionalcommits.org/en/v1.0.0/): Conventional Commits specification for commit messages
183
- - [gcil](https://pypi.org/project/gitlabci-local/): Launch .gitlab-ci.yml jobs locally
186
+ - [gcil](https://radiandevcore.gitlab.io/tools/gcil): Launch .gitlab-ci.yml jobs locally
184
187
  - [git-cliff](https://github.com/orhun/git-cliff): CHANGELOG generator
185
188
  - [gitlab-release](https://pypi.org/project/gitlab-release/): Utility for publishing on GitLab
186
189
  - [mkdocs](https://www.mkdocs.org/): Project documentation with Markdown
187
190
  - [mkdocs-material](https://squidfunk.github.io/mkdocs-material/): Material theme for mkdocs documentation
188
191
  - [mypy](https://pypi.org/project/mypy/): Optional static typing for Python
189
- - [pexpect-executor](https://pypi.org/project/pexpect-executor/): Automate interactive CLI tools actions
192
+ - [pexpect-executor](https://radiandevcore.gitlab.io/tools/pexpect-executor): Automate interactive CLI tools actions
190
193
  - [PyPI](https://pypi.org/): The Python Package Index
191
194
  - [termtosvg](https://pypi.org/project/termtosvg/): Record terminal sessions as SVG animations
192
195
  - [twine](https://pypi.org/project/twine/): Utility for publishing on PyPI
@@ -16,7 +16,7 @@ body = """
16
16
  ## [{{ version }}](<REPO>/commits/{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }})
17
17
  {% endif %}\
18
18
  {% else %}\
19
- ## [unreleased]
19
+ ## [Development](<REPO>/commits/main) ({{ commits | last | get(key='committer') | get(key='timestamp') | date(format="%Y-%m-%d") }})
20
20
  {% endif %}\
21
21
  {% for group, commits in commits | group_by(attribute="group") %}
22
22
  ### {{ group | striptags | trim | upper_first }}
@@ -2,7 +2,7 @@ ARG IMAGE_BASE=python:3-alpine
2
2
  FROM $IMAGE_BASE
3
3
 
4
4
  # Install dependencies
5
- RUN apk add -q \
5
+ RUN apk add -q --no-cache \
6
6
  git
7
7
 
8
8
  # Install requirements
@@ -2,7 +2,7 @@ ARG IMAGE_BASE=python:3-alpine
2
2
  FROM $IMAGE_BASE
3
3
 
4
4
  # Install dependencies
5
- RUN apk add -q \
5
+ RUN apk add -q --no-cache \
6
6
  git
7
7
 
8
8
  # Install requirements
@@ -2,7 +2,7 @@ ARG IMAGE_BASE=python:3-alpine
2
2
  FROM $IMAGE_BASE
3
3
 
4
4
  # Install dependencies
5
- RUN apk add -q \
5
+ RUN apk add -q --no-cache \
6
6
  gcc \
7
7
  git \
8
8
  libc-dev \
@@ -2,8 +2,10 @@ ARG IMAGE_BASE=python:3-alpine
2
2
  FROM $IMAGE_BASE
3
3
 
4
4
  # Install dependencies
5
- RUN apk add -q \
6
- git
5
+ RUN apk add -q --no-cache \
6
+ git \
7
+ && apk add -q --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/community \
8
+ git-cliff
7
9
 
8
10
  # Install requirements
9
11
  COPY --from='requirements' ./pages.txt /tmp/
@@ -2,7 +2,7 @@ ARG IMAGE_BASE=python:3-alpine
2
2
  FROM $IMAGE_BASE
3
3
 
4
4
  # Install dependencies
5
- RUN apk add -q \
5
+ RUN apk add -q --no-cache \
6
6
  bash \
7
7
  docker \
8
8
  git \
@@ -10,6 +10,7 @@
10
10
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
11
11
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
12
12
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
13
14
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
14
15
 
15
16
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -10,6 +10,7 @@
10
10
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
11
11
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
12
12
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
13
14
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
14
15
 
15
16
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -10,6 +10,7 @@
10
10
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
11
11
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
12
12
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
13
14
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
14
15
 
15
16
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -10,6 +10,7 @@
10
10
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
11
11
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
12
12
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
13
14
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
14
15
 
15
16
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -10,6 +10,7 @@
10
10
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
11
11
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
12
12
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
13
14
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
14
15
 
15
16
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -8,7 +8,7 @@ docs_path=$(cd "$(dirname "${BASH_SOURCE:-${0}}")" && pwd -P)
8
8
  root_path="${docs_path%/*}"
9
9
 
10
10
  # Prepare cache
11
- rm -f "${docs_path}/.cache/*.md"
11
+ rm -f "${docs_path}/.cache/"*.md
12
12
  mkdir -p "${docs_path}/.cache/"
13
13
  cp -rfv "${docs_path}/"*.md "${docs_path}/.cache/"
14
14
 
@@ -51,7 +51,11 @@ sed -i "s#\(\[.*\]\)(.*/docs/#\1(assets/images/#g" "${docs_path}/.cache/index.md
51
51
 
52
52
  # Export about/changelog
53
53
  mkdir -p "${docs_path}/.cache/about/"
54
- cp -f "${root_path}/CHANGELOG.md" "${docs_path}/.cache/about/changelog.md"
54
+ if ! type git-cliff >/dev/null 2>&1; then
55
+ alias git-cliff='./.tmp/git-cliff'
56
+ fi
57
+ git-cliff --no-exec --config "${root_path}/config/cliff.toml" --output "${docs_path}/.cache/about/changelog.md"
58
+ diff -u "${root_path}/CHANGELOG.md" "${docs_path}/.cache/about/changelog.md" || true
55
59
 
56
60
  # Export about/license
57
61
  {
@@ -62,6 +66,14 @@ cp -f "${root_path}/CHANGELOG.md" "${docs_path}/.cache/about/changelog.md"
62
66
  cat "${root_path}/LICENSE"
63
67
  } >"${docs_path}/.cache/about/license.md"
64
68
 
69
+ # Bind 'md_in_html' extension
70
+ sed -i \
71
+ -e 's/<\(details\)>/<\1 markdown>/g' \
72
+ -e 's/<\(div style="padding-left: 30px"\)>/<\1 markdown>/g' \
73
+ -e '/<div style="padding-left: 30px"/{ n; /<br/d; }' \
74
+ "${docs_path}/.cache/"*.md \
75
+ "${docs_path}/.cache/"*/*.md
76
+
65
77
  # Show cache
66
78
  echo ' '
67
79
  ls -laR "${docs_path}/.cache/"
@@ -10,6 +10,7 @@
10
10
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
11
11
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
12
12
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
13
14
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
14
15
 
15
16
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -36,6 +36,7 @@ extra:
36
36
 
37
37
  # Pages extensions
38
38
  markdown_extensions:
39
+ - md_in_html
39
40
  - pymdownx.highlight:
40
41
  anchor_linenums: true
41
42
  line_spans: __span
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pre-commit-crocodile
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: Git hooks intended for developers using pre-commit
5
5
  Home-page: https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile
6
6
  Author: Adrian DC
@@ -44,6 +44,7 @@ Requires-Dist: update_checker>=0.18.0
44
44
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RadianDevCore_pre-commit-crocodile&metric=alert_status)](https://sonarcloud.io/dashboard?id=RadianDevCore_pre-commit-crocodile)
45
45
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
46
46
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
47
+ [![gcil](https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/gcil)
47
48
  [![pre-commit-crocodile](https://img.shields.io/badge/pre--commit--crocodile-enabled-brightgreen?logo=gitlab)](https://radiandevcore.gitlab.io/tools/pre-commit-crocodile)
48
49
 
49
50
  Git hooks intended for developers using [pre-commit](https://pre-commit.com/) and [commitizen](https://commitizen-tools.github.io/commitizen/).
@@ -66,7 +67,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
66
67
 
67
68
  ## Preview
68
69
 
69
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/3.0.0/docs/preview.svg)
70
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/3.1.0/docs/preview.svg)
70
71
 
71
72
  ---
72
73
 
@@ -77,7 +78,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
77
78
 
78
79
  ```yaml
79
80
  usage: pre-commit-crocodile [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]
80
- [-l | -i | -c | -e | -d | -a | -C | -r] [--config FOLDER | --default] [--]
81
+ [-l | -i | -c | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--stage STAGE] [--]
81
82
 
82
83
  pre-commit-crocodile: Git hooks intended for developers using pre-commit
83
84
 
@@ -103,7 +104,9 @@ modes arguments:
103
104
 
104
105
  configurations arguments:
105
106
  --config FOLDER # Use configurations from a specific folder
106
- --default # Use global default configurations instead of sources
107
+ -D, --default # Use global default configurations instead of sources
108
+ --stage STAGE # Run a specific pre-commit stage with --run
109
+ # (use 'list' to list supported stages)
107
110
 
108
111
  positional arguments:
109
112
  -- # Positional arguments separator (recommended)
@@ -214,13 +217,13 @@ pre-commit-crocodile --clean
214
217
 
215
218
  - [.gitlab-ci.yml](https://docs.gitlab.com/ee/ci/yaml/): GitLab CI/CD Pipeline Configuration Reference
216
219
  - [conventionalcommits](https://www.conventionalcommits.org/en/v1.0.0/): Conventional Commits specification for commit messages
217
- - [gcil](https://pypi.org/project/gitlabci-local/): Launch .gitlab-ci.yml jobs locally
220
+ - [gcil](https://radiandevcore.gitlab.io/tools/gcil): Launch .gitlab-ci.yml jobs locally
218
221
  - [git-cliff](https://github.com/orhun/git-cliff): CHANGELOG generator
219
222
  - [gitlab-release](https://pypi.org/project/gitlab-release/): Utility for publishing on GitLab
220
223
  - [mkdocs](https://www.mkdocs.org/): Project documentation with Markdown
221
224
  - [mkdocs-material](https://squidfunk.github.io/mkdocs-material/): Material theme for mkdocs documentation
222
225
  - [mypy](https://pypi.org/project/mypy/): Optional static typing for Python
223
- - [pexpect-executor](https://pypi.org/project/pexpect-executor/): Automate interactive CLI tools actions
226
+ - [pexpect-executor](https://radiandevcore.gitlab.io/tools/pexpect-executor): Automate interactive CLI tools actions
224
227
  - [PyPI](https://pypi.org/): The Python Package Index
225
228
  - [termtosvg](https://pypi.org/project/termtosvg/): Record terminal sessions as SVG animations
226
229
  - [twine](https://pypi.org/project/twine/): Utility for publishing on PyPI
@@ -61,6 +61,7 @@ src/cli/main.py
61
61
  src/features/__init__.py
62
62
  src/features/argcomplete.py
63
63
  src/features/commitizen.py
64
+ src/features/gcil.py
64
65
  src/features/git.py
65
66
  src/features/precommit.py
66
67
  src/features/readme.py
@@ -5,6 +5,9 @@ sonar.organization=radiandevcore
5
5
  sonar.projectName=pre-commit-crocodile
6
6
  #sonar.projectVersion=1.0
7
7
 
8
+ # Wait for SonarCloud Quality Gate status
9
+ sonar.qualitygate.wait=true
10
+
8
11
  # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
9
12
  sonar.sources=src
10
13
 
@@ -53,6 +53,13 @@ repos:
53
53
  - id: trailing-whitespace
54
54
  args: ['--markdown-linebreak-ext=md']
55
55
 
56
+ # Repository: pre-commit-hooks
57
+ - repo: https://github.com/pre-commit/pygrep-hooks
58
+ rev: v1.10.0
59
+ hooks:
60
+ - id: python-check-blanket-type-ignore
61
+ - id: python-no-eval
62
+
56
63
  # Repository: commitizen
57
64
  - repo: https://github.com/commitizen-tools/commitizen
58
65
  rev: v3.29.0
@@ -12,6 +12,7 @@ from typing import List, Union
12
12
  # Components
13
13
  from ..features.argcomplete import Argcomplete
14
14
  from ..features.commitizen import Commitizen
15
+ from ..features.gcil import Gcil
15
16
  from ..features.git import Git
16
17
  from ..features.precommit import PreCommit
17
18
  from ..features.readme import Readme
@@ -185,6 +186,9 @@ class Entrypoint:
185
186
  configuration_file=precommit_configuration.name,
186
187
  )
187
188
 
189
+ # Configre gcil hooks
190
+ Gcil.configure_hooks(configuration_file=precommit_configuration.name)
191
+
188
192
  # Configure sources
189
193
  if options.configure:
190
194
 
@@ -219,6 +223,9 @@ class Entrypoint:
219
223
  # Configure unused hooks
220
224
  PreCommit.configure_unused_hooks(default=options.default)
221
225
 
226
+ # Configre gcil hooks
227
+ Gcil.configure_hooks()
228
+
222
229
  # Inject badge to README
223
230
  if Readme.exists():
224
231
 
@@ -236,20 +243,45 @@ class Entrypoint:
236
243
  # Validate badge in README
237
244
  if not any(Bundle.NAME in line for line in readme_lines):
238
245
 
239
- # Inject badge line
246
+ # Detect gcil usage
247
+ gcil_exists: bool = Gcil.exists()
248
+ gcil_configured: bool = Gcil.configured()
249
+ gcil_installed: bool = Gcil.installed()
250
+
251
+ # Inject badge lines
240
252
  print(f'injecting badge in {Readme.FILE} documentation')
241
253
  print(' ')
242
254
  for i, line in enumerate(readme_lines):
243
- if not line.strip():
244
- readme_lines.insert(
245
- i + 1,
246
- line,
247
- )
255
+
256
+ # Ignore non-empty lines
257
+ if line.strip():
258
+ continue
259
+
260
+ # Inject badges separator
261
+ readme_lines.insert(
262
+ i + 1,
263
+ line,
264
+ )
265
+
266
+ # Inject pre-commit-crocodile badge
267
+ readme_lines.insert(
268
+ i + 1,
269
+ f'[![{Bundle.NAME}]'
270
+ f'({Bundle.BADGE})]'
271
+ f'({Bundle.DOCUMENTATION}){line}',
272
+ )
273
+
274
+ # Inject gcil badge
275
+ if gcil_exists and (gcil_configured or gcil_installed):
248
276
  readme_lines.insert(
249
277
  i + 1,
250
- f'[![{Bundle.NAME}]({Bundle.BADGE})]({Bundle.DOCUMENTATION}){line}',
278
+ f'[![{Gcil.BADGE_TEXT}]'
279
+ f'({Gcil.BADGE_IMAGE})]'
280
+ f'({Gcil.BADGE_URL}){line}',
251
281
  )
252
- break
282
+
283
+ # Preserve README documentation
284
+ break
253
285
 
254
286
  # Export README contents
255
287
  Readme.write(readme_lines)
@@ -260,8 +292,8 @@ class Entrypoint:
260
292
  print(' ')
261
293
 
262
294
  # Show sources status
263
- print(' ')
264
295
  Git.status(untracked=True)
296
+ print(' ')
265
297
 
266
298
  # Show commit hints
267
299
  command_add: str = ' '.join([
@@ -276,7 +308,6 @@ class Entrypoint:
276
308
  f'"chore(pre-commit): import \'{Bundle.NAME}\' configurations"',
277
309
  '-s',
278
310
  ])
279
- print(' ')
280
311
  print(f'{Colors.BOLD}Add configurations: '
281
312
  f'{Colors.CYAN}{command_add}'
282
313
  f'{Colors.RESET}')
@@ -357,10 +388,19 @@ class Entrypoint:
357
388
  print(' ')
358
389
  print(f'{Colors.BOLD} - Run hooks: '
359
390
  f'{Colors.YELLOW_LIGHT}pre-commit'
391
+ f'{Colors.CYAN}{f" (stage: {options.stage})" if options.stage else ""}'
360
392
  f'{Colors.RESET}')
361
393
  print(' ')
362
394
  Platform.flush()
363
- PreCommit.run(all_files=True)
395
+ if options.stage == 'list':
396
+ hooks_stages: List[str] = PreCommit.stages()
397
+ print(f'{Colors.BOLD}Supported pre-commit hooks stages:'
398
+ f'{Colors.RESET} {", ".join(hooks_stages)}')
399
+ else:
400
+ PreCommit.run(
401
+ all_files=True,
402
+ stage=options.stage,
403
+ )
364
404
 
365
405
  # Run commitizen hooks
366
406
  print(' ')
@@ -168,11 +168,20 @@ def main() -> None:
168
168
  help='Use configurations from a specific folder',
169
169
  )
170
170
  subgroup.add_argument(
171
+ '-D',
171
172
  '--default',
172
173
  dest='default',
173
174
  action='store_true',
174
175
  help='Use global default configurations instead of sources',
175
176
  )
177
+ group.add_argument(
178
+ '--stage',
179
+ dest='stage',
180
+ action='store',
181
+ metavar='STAGE',
182
+ help='Run a specific pre-commit stage with --run\n' \
183
+ '(use \'list\' to list supported stages)',
184
+ )
176
185
 
177
186
  # Arguments positional definitions
178
187
  group = parser.add_argument_group('positional arguments')
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # Standard libraries
4
+ from pathlib import Path
5
+ from re import search
6
+ from typing import List
7
+
8
+ # Components
9
+ from ..features.precommit import PreCommit
10
+ from ..prints.colors import Colors
11
+ from ..system.commands import Commands
12
+ from ..system.platform import Platform
13
+
14
+ # Gcil class
15
+ class Gcil:
16
+
17
+ # Constants
18
+ BADGE_IMAGE: str = 'https://img.shields.io/badge/gcil-enabled-brightgreen?logo=gitlab'
19
+ BADGE_URL: str = 'https://radiandevcore.gitlab.io/tools/gcil'
20
+ BADGE_TEXT: str = 'gcil'
21
+ BINARY: str = 'gcil'
22
+ FILE: str = '.gitlab-ci.yml'
23
+ HOOK_DESCRIPTION: str = 'Automatically run GitLab CI job with gcil'
24
+ HOOK_ID: str = 'run-gcil-push'
25
+ HOOK_NAME: str = 'Run GitLab CI job with gcil'
26
+ HOOKS_LABEL: str = 'gcil'
27
+ HOOKS_URL: str = 'https://gitlab.com/RadianDevCore/tools/gcil'
28
+ HOOKS_VERSION_MINIMAL: str = '10.2.0'
29
+ MARKER_NODE: str = '.local:'
30
+ MARKER_VARIABLE: str = 'CI_LOCAL'
31
+
32
+ # Jobs
33
+ JOBS_WHITELIST: List[str] = [
34
+ r'codestyle[:]?.*',
35
+ r'lint[:]?.*',
36
+ r'typings[:]?.*',
37
+ ]
38
+
39
+ # Configure unused hooks, pylint: disable=too-many-branches,too-many-statements
40
+ @staticmethod
41
+ def configure_hooks(configuration_file: str = PreCommit.CONFIGURATION_FILE) -> bool:
42
+
43
+ # Validate gcil support
44
+ if not Gcil.exists() or not Gcil.installed():
45
+ return False
46
+
47
+ # Validate pre-commit support
48
+ if not Path(configuration_file).exists():
49
+ return False # pragma: no cover
50
+
51
+ # Configure pre-commit unused hooks
52
+ print(' ')
53
+ print(f'{Colors.BOLD} - Configure sources: '
54
+ f'{Colors.YELLOW_LIGHT}run-gcil-push'
55
+ f'{Colors.RESET}')
56
+ print(' ')
57
+
58
+ # Detect supported jobs
59
+ jobs_list: List[str] = Gcil.jobs_list()
60
+ jobs_supported: List[str] = []
61
+ for job in jobs_list:
62
+ if any(search(fr'^{whitelist}$', job) for whitelist in Gcil.JOBS_WHITELIST):
63
+ jobs_supported += [job]
64
+
65
+ # Show supported jobs hooks
66
+ print(
67
+ f'detected supported jobs hooks in configuration: {", ".join(jobs_supported) or "-"}'
68
+ )
69
+ Platform.flush()
70
+
71
+ # Append hooks configuration
72
+ if jobs_supported:
73
+ with open(
74
+ configuration_file,
75
+ encoding='utf8',
76
+ mode='a',
77
+ ) as file:
78
+
79
+ # Inject repository header
80
+ file.write(
81
+ PreCommit.CONFIGURATION_EOL.join([
82
+ '',
83
+ f' # Repository: {Gcil.HOOKS_LABEL}',
84
+ f' - repo: {Gcil.HOOKS_URL}',
85
+ f' rev: {Gcil.HOOKS_VERSION_MINIMAL}',
86
+ ' hooks:',
87
+ '',
88
+ ]))
89
+
90
+ # Inject repository hooks
91
+ for job in jobs_supported:
92
+ file.write(
93
+ PreCommit.CONFIGURATION_EOL.join([
94
+ f' - id: {Gcil.HOOK_ID}',
95
+ f' name: {Gcil.HOOK_NAME} ({job})',
96
+ f' description: {Gcil.HOOK_DESCRIPTION} ({job})',
97
+ ' args:',
98
+ f" - '{job}'",
99
+ '',
100
+ ]))
101
+
102
+ # Autoupdate repository
103
+ print(f'updating {Gcil.HOOKS_LABEL} repository with pre-commit: ', end='')
104
+ Platform.flush()
105
+ PreCommit.autoupdate(Gcil.HOOKS_URL)
106
+ Platform.flush()
107
+
108
+ # Result
109
+ return True
110
+
111
+ # Configured
112
+ @staticmethod
113
+ def configured() -> bool:
114
+
115
+ # Ignore missing file
116
+ if not Gcil.exists():
117
+ return False
118
+
119
+ # Detect gcil configurations
120
+ return Commands.grep(
121
+ Path(Gcil.FILE),
122
+ Gcil.MARKER_NODE,
123
+ ) or Commands.grep(
124
+ Path(Gcil.FILE),
125
+ Gcil.MARKER_VARIABLE,
126
+ )
127
+
128
+ # Jobs list
129
+ @staticmethod
130
+ def jobs_list() -> List[str]:
131
+
132
+ # Validate gcil support
133
+ if not Gcil.exists() or not Gcil.installed():
134
+ return []
135
+
136
+ # Dump jobs configuration
137
+ gcil_dump: str = Commands.output(Gcil.BINARY, [
138
+ '--dump',
139
+ ])
140
+ if not gcil_dump or gcil_dump == '{}':
141
+ return []
142
+
143
+ # Extract job names
144
+ jobs: List[str] = []
145
+ for line in [
146
+ line for line in gcil_dump.splitlines()
147
+ if line.strip() and not line.startswith(' ')
148
+ ]:
149
+ job: str = line.strip().rstrip(':')
150
+ if not job.startswith('.'):
151
+ jobs += [job]
152
+
153
+ # Result
154
+ return jobs
155
+
156
+ # Exists
157
+ @staticmethod
158
+ def exists() -> bool:
159
+
160
+ # Check if configuration exists
161
+ return Path(Gcil.FILE).exists()
162
+
163
+ # Installed
164
+ @staticmethod
165
+ def installed() -> bool:
166
+
167
+ # Check installed gcil
168
+ return Commands.exists(Gcil.BINARY)
@@ -56,9 +56,9 @@ class Git:
56
56
  # Show git status
57
57
  return Commands.run(Git.BINARY, [
58
58
  'status',
59
- ] + [
59
+ ] + ([
60
60
  '--untracked-files',
61
- ] if untracked else [])
61
+ ] if untracked else []))
62
62
 
63
63
  # Update remote head
64
64
  @staticmethod
@@ -15,6 +15,7 @@ class PreCommit:
15
15
 
16
16
  # Constants
17
17
  BINARY: str = 'pre-commit'
18
+ CONFIGURATION_EOL: str = '\n'
18
19
  CONFIGURATION_EXTENSION: str = '.yaml'
19
20
  CONFIGURATION_FILE: str = '.pre-commit-config.yaml'
20
21
  HOOKS_APPLY_ERROR: str = ' does not apply to this repository'
@@ -26,12 +27,15 @@ class PreCommit:
26
27
 
27
28
  # Autoupdate
28
29
  @staticmethod
29
- def autoupdate() -> bool:
30
+ def autoupdate(repo: str = '') -> bool:
30
31
 
31
32
  # Clean pre-commit
32
33
  return Commands.run(PreCommit.BINARY, [
33
34
  'autoupdate',
34
- ] + PreCommit.__flags_configuration)
35
+ ] + PreCommit.__flags_configuration + ([
36
+ '--repo',
37
+ repo,
38
+ ] if repo else []))
35
39
 
36
40
  # Clean
37
41
  @staticmethod
@@ -47,7 +51,7 @@ class PreCommit:
47
51
  def configure_unused_hooks(
48
52
  default: bool,
49
53
  configuration_file: str = CONFIGURATION_FILE,
50
- ) -> None:
54
+ ) -> bool:
51
55
 
52
56
  # Variables
53
57
  configuration_moved: bool = False
@@ -145,6 +149,9 @@ class PreCommit:
145
149
  else:
146
150
  f.write(line)
147
151
 
152
+ # Result
153
+ return True
154
+
148
155
  # Dependencies
149
156
  @staticmethod
150
157
  def dependencies() -> bool:
@@ -182,14 +189,17 @@ class PreCommit:
182
189
 
183
190
  # Run
184
191
  @staticmethod
185
- def run(all_files: bool) -> bool:
192
+ def run(all_files: bool, stage: str = '') -> bool:
186
193
 
187
194
  # Run commitizen hooks
188
195
  return Commands.run(PreCommit.BINARY, [
189
196
  'run',
190
- ] + PreCommit.__flags_configuration + [
197
+ ] + PreCommit.__flags_configuration + ([
191
198
  '--all-files',
192
- ] if all_files else [])
199
+ ] if all_files else []) + ([
200
+ '--hook-stage',
201
+ stage,
202
+ ] if stage else []))
193
203
 
194
204
  # Set configuration
195
205
  @staticmethod
@@ -204,6 +214,31 @@ class PreCommit:
204
214
  else:
205
215
  PreCommit.__flags_configuration = []
206
216
 
217
+ # Stages
218
+ @staticmethod
219
+ def stages() -> List[str]:
220
+
221
+ # Variables
222
+ hooks_stages: List[str] = []
223
+
224
+ # Validate pre-commit
225
+ if not PreCommit.exists():
226
+ return hooks_stages # pragma: no cover
227
+
228
+ # Get pre-commit run help
229
+ for line in Commands.output(PreCommit.BINARY, [
230
+ 'run',
231
+ '--help',
232
+ ]).splitlines():
233
+
234
+ # Parse hooks stages
235
+ if ' --hook-stage' in line:
236
+ hooks_stages = line[line.index('{') + 1:line.index('}')].split(',')
237
+ break
238
+
239
+ # Result
240
+ return hooks_stages
241
+
207
242
  # Uninstall
208
243
  @staticmethod
209
244
  def uninstall() -> bool:
@@ -278,6 +278,17 @@ CHANGES_MATCHERS: List[ChangesMatcher] = [
278
278
  ),
279
279
  ],
280
280
  ),
281
+ ChangesMatcher(
282
+ commit_scope='sonar',
283
+ types=[
284
+ ChangesType(
285
+ commit_type='chore',
286
+ changes=[
287
+ r'^sonar-project.properties$',
288
+ ],
289
+ ),
290
+ ],
291
+ ),
281
292
  ChangesMatcher(
282
293
  commit_scope='vscode',
283
294
  types=[