pre-commit-crocodile 4.2.1__tar.gz → 5.0.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 (106) hide show
  1. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.coveragerc +4 -0
  2. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.gitlab-ci.yml +19 -12
  3. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.pre-commit-config.yaml +2 -0
  4. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.vscode/extensions.json +1 -0
  5. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.vscode/settings.json +7 -9
  6. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/CHANGELOG.md +40 -0
  7. {pre_commit_crocodile-4.2.1/pre_commit_crocodile.egg-info → pre_commit_crocodile-5.0.0}/PKG-INFO +7 -3
  8. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/README.md +5 -2
  9. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/commits.md +1 -0
  10. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0/pre_commit_crocodile.egg-info}/PKG-INFO +7 -3
  11. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/pre_commit_crocodile.egg-info/requires.txt +1 -0
  12. pre_commit_crocodile-5.0.0/requirements/commits.txt +2 -0
  13. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/pages.txt +1 -1
  14. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/quality.txt +1 -1
  15. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/runtime.txt +1 -0
  16. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/assets/.pre-commit-config.yaml +2 -0
  17. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/cli/entrypoint.py +132 -46
  18. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/cli/main.py +12 -0
  19. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/commitizen.py +3 -3
  20. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/gcil.py +12 -6
  21. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/precommit.py +6 -2
  22. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/package/version.py +10 -4
  23. pre_commit_crocodile-4.2.1/requirements/commits.txt +0 -2
  24. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.cz.yaml +0 -0
  25. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.gitattributes +0 -0
  26. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.gitignore +0 -0
  27. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.markdownlint.json +0 -0
  28. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.pre-commit-hooks.yaml +0 -0
  29. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/.style.yapf +0 -0
  30. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/LICENSE +0 -0
  31. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/config/cliff.toml +0 -0
  32. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/build/Dockerfile +0 -0
  33. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/codestyle/Dockerfile +0 -0
  34. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/commits/Dockerfile +0 -0
  35. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/deploy/Dockerfile +0 -0
  36. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/pages/Dockerfile +0 -0
  37. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/preview/Dockerfile +0 -0
  38. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/rehost/images.txt +0 -0
  39. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/test-coverage-linux/Dockerfile +0 -0
  40. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/test-coverage-windows/Dockerfile +0 -0
  41. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/containers/test-linux/Dockerfile +0 -0
  42. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/.pages.in +0 -0
  43. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/assets/images/favicon.png +0 -0
  44. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/assets/scripts/mkdocs-exporter.js +0 -0
  45. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/assets/stylesheets/custom.css +0 -0
  46. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/assets/stylesheets/pdf.scss +0 -0
  47. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/commitizen.md +0 -0
  48. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/components.md +0 -0
  49. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/hooks.md +0 -0
  50. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/pre-commit.md +0 -0
  51. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/prepare.sh +0 -0
  52. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/preview.py +0 -0
  53. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/preview.svg +0 -0
  54. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/robots.txt +0 -0
  55. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/settings.md +0 -0
  56. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/template.svg +0 -0
  57. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/templates/covers/back.html.j2 +0 -0
  58. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/docs/templates/covers/front.html.j2 +0 -0
  59. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/mkdocs.yml +0 -0
  60. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/mypy.ini +0 -0
  61. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/pre_commit_crocodile.egg-info/SOURCES.txt +0 -0
  62. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/pre_commit_crocodile.egg-info/dependency_links.txt +0 -0
  63. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/pre_commit_crocodile.egg-info/entry_points.txt +0 -0
  64. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/pre_commit_crocodile.egg-info/top_level.txt +0 -0
  65. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/build.txt +0 -0
  66. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/coverage.txt +0 -0
  67. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/deploy.txt +0 -0
  68. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/docs.txt +0 -0
  69. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/requirements/tests.txt +0 -0
  70. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/setup.cfg +0 -0
  71. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/setup.py +0 -0
  72. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/sonar-project.properties +0 -0
  73. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/__init__.py +0 -0
  74. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/__main__.py +0 -0
  75. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/assets/.cz.yaml +0 -0
  76. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/assets/__init__.py +0 -0
  77. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/cli/__init__.py +0 -0
  78. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/__init__.py +0 -0
  79. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/argcomplete.py +0 -0
  80. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/git.py +0 -0
  81. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/radiandevcore.py +0 -0
  82. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/features/readme.py +0 -0
  83. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/hooks/__init__.py +0 -0
  84. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/hooks/check_yaml_ruamel_pure.py +0 -0
  85. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/hooks/configurations.py +0 -0
  86. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/hooks/prepare_commit_message.py +0 -0
  87. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/package/__init__.py +0 -0
  88. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/package/bundle.py +0 -0
  89. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/package/settings.py +0 -0
  90. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/package/updates.py +0 -0
  91. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/prints/__init__.py +0 -0
  92. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/prints/boxes.py +0 -0
  93. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/prints/colors.py +0 -0
  94. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/system/__init__.py +0 -0
  95. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/system/commands.py +0 -0
  96. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/system/platform.py +0 -0
  97. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/types/__init__.py +0 -0
  98. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/types/environments.py +0 -0
  99. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/src/types/strings.py +0 -0
  100. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/templates/commits.yml +0 -0
  101. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/tests/arguments/test.sh +0 -0
  102. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/tests/colors/test.sh +0 -0
  103. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/tests/macos/test.sh +0 -0
  104. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/tests/settings/test.sh +0 -0
  105. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/tests/versions/test.sh +0 -0
  106. {pre_commit_crocodile-4.2.1 → pre_commit_crocodile-5.0.0}/tests/windows/test.sh +0 -0
@@ -5,3 +5,7 @@ source =
5
5
  src/
6
6
  */src
7
7
  *\src
8
+
9
+ [report]
10
+ exclude_also =
11
+ pragma: no cover
@@ -627,7 +627,7 @@ readme:
627
627
  help="[(]\{0,1\}${word}"
628
628
  "${PROJECT_PACKAGE}" --help \
629
629
  | sed '1d; $d' \
630
- | sed "s/^\( ${parameter} \[${word}\]${alignments}\)/\1# /g" \
630
+ | sed "s/^\( ${parameter} \[${word}\]\(\|, ${parameter} \[${word}\]\)${alignments}\)/\1# /g" \
631
631
  | sed "s/^\( ${parameter}\( ${word}\)\{1,\}${alignments}\)/\1# /g" \
632
632
  | sed "s/^\( ${parameter}\( ${word}\)\{1,\}, ${parameter}\( ${word}\)\{1,\}${alignments}\)/\1# /g" \
633
633
  | sed "s/^\( ${parameter}${alignments}\)/\1# /g" \
@@ -704,7 +704,9 @@ readme:
704
704
  - .unit-tests-template
705
705
  - .unit-tests-rules
706
706
  variables:
707
- COVERAGE_COMMON: ${CI_PROJECT_DIR}/coverage-reports/coverage-common.xml
707
+ COVERAGE_COMMON_FILE: ${CI_PROJECT_DIR}/coverage-reports/.coverage-common
708
+ COVERAGE_COMMON_XML: ${CI_PROJECT_DIR}/coverage-reports/coverage-common.xml
709
+ COVERAGE_EXCLUDE_ALSO: ''
708
710
  COVERAGE_FOLDER: ${CI_PROJECT_DIR}/coverage-reports
709
711
  COVERAGE_RCFILE: ${CI_PROJECT_DIR}/.coveragerc
710
712
  PYTHONDONTWRITEBYTECODE: 1
@@ -716,24 +718,27 @@ readme:
716
718
  if [ -z "${SUITE}" ]; then
717
719
  coverage erase
718
720
  fi
719
- - coverage run --append --module --source=src src --version >/dev/null
721
+ - coverage run --append --module --source="${PWD}/src" src --version >/dev/null
720
722
  - chmod 666 "${COVERAGE_FILE}"
721
- - echo 'coverage run --append --module --source=src src "${@}"' | tee /usr/local/bin/pre-commit-crocodile >/dev/null
722
- - echo 'coverage run --append --source=src "${@}"' | tee /usr/local/bin/python3-coverage >/dev/null
723
+ - echo "coverage run --append --module --source='${PWD}/src' src \"\${@}\"" | tee /usr/local/bin/pre-commit-crocodile >/dev/null
724
+ - echo "coverage run --append --source='${PWD}/src' src \"\${@}\"" | tee /usr/local/bin/python3-coverage >/dev/null
723
725
  - chmod a+x /usr/local/bin/pre-commit-crocodile /usr/local/bin/python3-coverage
724
726
  after_script:
727
+ - |
728
+ cp -fv "${COVERAGE_RCFILE}" /tmp/.coveragerc.common
729
+ cp -fv "${COVERAGE_RCFILE}" /tmp/.coveragerc.job
730
+ echo "${CI_LOCAL:+pragma: no local cover}" | tr '|' '\n' | xargs -i -n1 echo ' {}' >>/tmp/.coveragerc.common
731
+ echo "${CI_LOCAL:+pragma: no local cover}|${COVERAGE_EXCLUDE_ALSO}" | tr '|' '\n' | xargs -i -n1 echo ' {}' >>/tmp/.coveragerc.job
725
732
  - coverage xml -o "${COVERAGE_XML}"
726
- - coverage report --show-missing --skip-covered
733
+ - COVERAGE_RCFILE='/tmp/.coveragerc.job' coverage report --show-missing --skip-covered
727
734
  - sed -i 's#\(<source>\).*\(</source>\)#\1.\2#g' "${COVERAGE_XML}"
728
735
  - |
729
736
  set +x
730
737
  if [ ! -z "${CI_LOCAL}" ]; then
731
- common=$(mktemp -d)
732
- cp "${COVERAGE_FOLDER}/.coverage-"* "${common}/"
733
- COVERAGE_FILE="${common}/.coverage" coverage combine "${common}/.coverage-"*
734
- COVERAGE_FILE="${common}/.coverage" coverage report --ignore-errors --show-missing --skip-covered
735
- COVERAGE_FILE="${common}/.coverage" coverage xml -o "${COVERAGE_COMMON}"
736
- sed -i 's#\(<source>\).*\(</source>\)#\1.\2#g' "${COVERAGE_COMMON}"
738
+ COVERAGE_FILE="${COVERAGE_COMMON_FILE}" coverage combine --keep "${COVERAGE_FOLDER}/.coverage-"*
739
+ COVERAGE_FILE="${COVERAGE_COMMON_FILE}" COVERAGE_RCFILE='/tmp/.coveragerc.common' coverage report --ignore-errors --show-missing --skip-covered
740
+ COVERAGE_FILE="${COVERAGE_COMMON_FILE}" coverage xml -o "${COVERAGE_COMMON_XML}"
741
+ sed -i 's#\(<source>\).*\(</source>\)#\1.\2#g' "${COVERAGE_COMMON_XML}"
737
742
  rm -rf "${common}"
738
743
  fi
739
744
  rules:
@@ -762,6 +767,7 @@ coverage:linux:
762
767
  artifacts: false
763
768
  optional: true
764
769
  variables:
770
+ COVERAGE_EXCLUDE_ALSO: 'pragma: pragma: windows cover'
765
771
  COVERAGE_FILE: ${CI_PROJECT_DIR}/coverage-reports/.coverage-linux
766
772
  COVERAGE_XML: ${CI_PROJECT_DIR}/coverage-reports/coverage-linux.xml
767
773
  before_script:
@@ -777,6 +783,7 @@ coverage:windows:
777
783
  optional: true
778
784
  variables:
779
785
  COVERAGE_FILE: ${CI_PROJECT_DIR}/coverage-reports/.coverage-windows
786
+ COVERAGE_EXCLUDE_ALSO: 'pragma: linux cover'
780
787
  COVERAGE_XML: ${CI_PROJECT_DIR}/coverage-reports/coverage-windows.xml
781
788
  before_script:
782
789
  - !reference [.coverage-template, before_script]
@@ -80,6 +80,8 @@ repos:
80
80
  rev: v3.29.0
81
81
  hooks:
82
82
  - id: commitizen
83
+ stages:
84
+ - commit-msg
83
85
  - id: commitizen-branch
84
86
  entry: cz
85
87
  args: [--no-raise, '3', check, --rev-range, origin/HEAD..HEAD]
@@ -13,6 +13,7 @@
13
13
  "mikestead.dotenv",
14
14
  "ms-python.python",
15
15
  "redhat.vscode-yaml",
16
+ "ryanluker.vscode-coverage-gutters",
16
17
  "yzhang.markdown-all-in-one"
17
18
  ],
18
19
  "unwantedRecommendations": []
@@ -1,4 +1,9 @@
1
1
  {
2
+ "coverage-gutters.coverageFileNames": [
3
+ "coverage-reports/coverage-common.xml"
4
+ ],
5
+ "coverage-gutters.showLineCoverage": true,
6
+ "coverage-gutters.showRulerCoverage": true,
2
7
  "editor.formatOnSave": true,
3
8
  "files.exclude": {
4
9
  ".scannerwork": true,
@@ -19,20 +24,13 @@
19
24
  "telemetry.enableTelemetry": false,
20
25
  "terminal.enableAppInsights": false,
21
26
  "terminal.integrated.allowChords": false,
22
- "vscode-coverage-highlighter.coveredColor": "rgba(20, 250, 20, 0.05)",
23
- "vscode-coverage-highlighter.files": [
24
- "coverage/coverage-final.json",
25
- "coverage/lcov*.info",
26
- "coverage-reports/coverage-common.xml"
27
- ],
28
- "vscode-coverage-highlighter.unCoveredColor": "rgba(255, 20, 20, 0.3)",
29
27
  "workbench.settings.enableNaturalLanguageSearch": false,
30
28
  "workbench.enableExperiments": false,
31
29
  "yaml.format.singleQuote": true,
32
30
  "[markdown]": {
33
- "editor.defaultFormatter": "yzhang.markdown-all-in-one"
31
+ "editor.defaultFormatter": "yzhang.markdown-all-in-one"
34
32
  },
35
33
  "[yaml]": {
36
- "editor.defaultFormatter": "redhat.vscode-yaml"
34
+ "editor.defaultFormatter": "redhat.vscode-yaml"
37
35
  }
38
36
  }
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ <a name="5.0.0"></a>
4
+ ## [5.0.0](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/compare/4.2.1...5.0.0) (2025-06-08)
5
+
6
+ ### ✨ Features
7
+
8
+ - **cli:** add '--commit' to automatically commit '--configure' changes ([6f4dd94](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/6f4dd94259c9a6498b9a6eefa8c796dcb37ff8dc))
9
+ - **cli, gcil:** implement '--offline' to disable initial autoupdate ([bd1ef50](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/bd1ef50f1871c13a45184ab2d87dc12382baa5c5))
10
+ - **commitizen:** migrate to 'AdrianDC/commitizen' sources tag ([7a925bc](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/7a925bca39a46fa2323eafef4e16dd91cb9ce5f1))
11
+ - **entrypoint:** improve '--configure' command hints for updates ([659cc3e](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/659cc3ed513c667c33c722ed48a41f260c059826))
12
+ - **entrypoint:** run '--run' steps in '--enable' if supported ([ab1720c](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/ab1720caa0173936a7c9997284372274f368468d))
13
+ - **requirements, src:** migrate to 'commitizen' 4.8.2+adriandc.20250608 ([ffd5ea9](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/ffd5ea982b6bb0dadaf95875a61cddbeee2d8332))
14
+ - **src:** refactor section headers style and look closed to 'gcil' ([1b34aef](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/1b34aefd09983549e155ff4a1773aca5da413099))
15
+
16
+ ### 🐛 Bug Fixes
17
+
18
+ - **version:** migrate from deprecated 'pkg_resources' to 'packaging' ([314bf0d](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/314bf0de218060412f59cdbea87448a755db2359))
19
+ - **version:** try getting version from bundle name too ([79450cf](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/79450cf8afe598f46eae0e39dd4b986962481c6c))
20
+
21
+ ### 📚 Documentation
22
+
23
+ - **commits:** document 'cz commit --edit' syntax ([e848a43](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/e848a438b7ae79763a25cc44d19061e2e1912664))
24
+
25
+ ### ⚙️ Cleanups
26
+
27
+ - **pre-commit-config:** explicit 'commit-msg' stage for 'commitizen' ([adc0f35](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/adc0f358145878e41f84645591bf58da1292d9d5))
28
+ - **vscode:** install 'ryanluker.vscode-coverage-gutters' ([1f44dbb](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/1f44dbb3a89455d2292e01defc9983dbec5fa7e4))
29
+ - **vscode:** configure coverage file and settings ([641d6af](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/641d6afaf3d28c039978d9af0480d154e0e5df6b))
30
+
31
+ ### 🚀 CI
32
+
33
+ - **coveragerc, gitlab-ci:** implement coverage specific exclusions ([2badbc5](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/2badbc5d11cdadfbfa4039d7822e2d4d89cbbe24))
34
+ - **gitlab-ci:** improve combined coverage local outputs ([2b31171](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/2b311712fe84d716d6bed4b50c5d6eb73ec6df73))
35
+ - **gitlab-ci:** enforce 'coverage' runs tool's 'src' sources only ([9bdf726](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/9bdf72624086b33d623e7435b33c65d293d539a2))
36
+ - **gitlab-ci:** add support for '-f [VAR], --flag [VAR]' in 'readme' ([8396c68](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/8396c689b4fc99b8bf86afe6e112feabd7f5bf66))
37
+
38
+ ### 📦 Build
39
+
40
+ - **requirements:** add 'importlib-metadata' runtime requirement ([43f298f](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/43f298f39b0437a71c454313d798ceb2f514d96e))
41
+
42
+
3
43
  <a name="4.2.1"></a>
4
44
  ## [4.2.1](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/compare/4.2.0...4.2.1) (2025-05-31)
5
45
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pre-commit-crocodile
3
- Version: 4.2.1
3
+ Version: 5.0.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
@@ -27,6 +27,7 @@ Requires-Python: >=3,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3
27
27
  Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
29
  Requires-Dist: colored>=1.4.2
30
+ Requires-Dist: importlib-metadata>=8.5.0
30
31
  Requires-Dist: packaging>=24.0
31
32
  Requires-Dist: PyYAML>=6.0
32
33
  Requires-Dist: ruamel.yaml>=0.18.6
@@ -88,7 +89,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
88
89
 
89
90
  ## Preview
90
91
 
91
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/4.2.1/docs/preview.svg)
92
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/5.0.0/docs/preview.svg)
92
93
 
93
94
  ---
94
95
 
@@ -101,7 +102,8 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
101
102
 
102
103
  ```yaml
103
104
  usage: pre-commit-crocodile [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]
104
- [-l | -i | -c | -b | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--stage STAGE] [--]
105
+ [-l | -i | -c | -b | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--commit] [--offline]
106
+ [--stage STAGE] [--]
105
107
 
106
108
  pre-commit-crocodile: Git hooks intended for developers using pre-commit
107
109
 
@@ -129,6 +131,8 @@ modes arguments:
129
131
  configurations arguments:
130
132
  --config FOLDER # Use configurations from a specific folder
131
133
  -D, --default # Use global default configurations instead of sources
134
+ --commit # Commit configurations changes automatically
135
+ --offline # Use offline mode to disable configurations autoupdate
132
136
  --stage STAGE # Run a specific pre-commit stage with --run
133
137
  # (use 'list' to list supported stages)
134
138
 
@@ -40,7 +40,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
40
40
 
41
41
  ## Preview
42
42
 
43
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/4.2.1/docs/preview.svg)
43
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/5.0.0/docs/preview.svg)
44
44
 
45
45
  ---
46
46
 
@@ -53,7 +53,8 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
53
53
 
54
54
  ```yaml
55
55
  usage: pre-commit-crocodile [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]
56
- [-l | -i | -c | -b | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--stage STAGE] [--]
56
+ [-l | -i | -c | -b | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--commit] [--offline]
57
+ [--stage STAGE] [--]
57
58
 
58
59
  pre-commit-crocodile: Git hooks intended for developers using pre-commit
59
60
 
@@ -81,6 +82,8 @@ modes arguments:
81
82
  configurations arguments:
82
83
  --config FOLDER # Use configurations from a specific folder
83
84
  -D, --default # Use global default configurations instead of sources
85
+ --commit # Commit configurations changes automatically
86
+ --offline # Use offline mode to disable configurations autoupdate
84
87
  --stage STAGE # Run a specific pre-commit stage with --run
85
88
  # (use 'list' to list supported stages)
86
89
 
@@ -32,5 +32,6 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
32
32
  - **`git commit`:** Create a commit with the title prepared by `prepare-commit-message`
33
33
  - **`git commit -s`:** Create a signed commit with the title prepared by `prepare-commit-message`
34
34
  - **`cz commit`:** Create a commit interactively using `commitizen` by answering specific questions
35
+ - **`cz commit --edit`:** Create a commit interactively using `commitizen` by answering specific questions then edit
35
36
 
36
37
  {% include 'docs/commits.generated.md' %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pre-commit-crocodile
3
- Version: 4.2.1
3
+ Version: 5.0.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
@@ -27,6 +27,7 @@ Requires-Python: >=3,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3
27
27
  Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
29
  Requires-Dist: colored>=1.4.2
30
+ Requires-Dist: importlib-metadata>=8.5.0
30
31
  Requires-Dist: packaging>=24.0
31
32
  Requires-Dist: PyYAML>=6.0
32
33
  Requires-Dist: ruamel.yaml>=0.18.6
@@ -88,7 +89,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
88
89
 
89
90
  ## Preview
90
91
 
91
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/4.2.1/docs/preview.svg)
92
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/5.0.0/docs/preview.svg)
92
93
 
93
94
  ---
94
95
 
@@ -101,7 +102,8 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
101
102
 
102
103
  ```yaml
103
104
  usage: pre-commit-crocodile [-h] [--version] [--no-color] [--update-check] [--settings] [--set GROUP KEY VAL]
104
- [-l | -i | -c | -b | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--stage STAGE] [--]
105
+ [-l | -i | -c | -b | -e | -d | -a | -C | -r] [--config FOLDER | -D] [--commit] [--offline]
106
+ [--stage STAGE] [--]
105
107
 
106
108
  pre-commit-crocodile: Git hooks intended for developers using pre-commit
107
109
 
@@ -129,6 +131,8 @@ modes arguments:
129
131
  configurations arguments:
130
132
  --config FOLDER # Use configurations from a specific folder
131
133
  -D, --default # Use global default configurations instead of sources
134
+ --commit # Commit configurations changes automatically
135
+ --offline # Use offline mode to disable configurations autoupdate
132
136
  --stage STAGE # Run a specific pre-commit stage with --run
133
137
  # (use 'list' to list supported stages)
134
138
 
@@ -1,4 +1,5 @@
1
1
  colored>=1.4.2
2
+ importlib-metadata>=8.5.0
2
3
  packaging>=24.0
3
4
  PyYAML>=6.0
4
5
  ruamel.yaml>=0.18.6
@@ -0,0 +1,2 @@
1
+ git+https://github.com/AdrianDC/commitizen.git@4.8.2+adriandc.20250608
2
+ pre-commit>=3.8.0
@@ -1,4 +1,4 @@
1
- git+https://github.com/AdrianDC/commitizen.git@prerelease # == 3.29.0.AdrianDC.20240813
1
+ git+https://github.com/AdrianDC/commitizen.git@4.8.2+adriandc.20250608
2
2
  mkdocs>=1.6.0
3
3
  mkdocs-awesome-pages-plugin>=2.9.3
4
4
  # mkdocs-exporter>=6.1.1
@@ -1,4 +1,4 @@
1
- git+https://github.com/AdrianDC/commitizen.git@prerelease # == 3.29.0.AdrianDC.20240813
1
+ git+https://github.com/AdrianDC/commitizen.git@4.8.2+adriandc.20250608
2
2
  mypy>=0.971
3
3
  pre-commit>=3.8.0
4
4
  pylint>=2.6.0
@@ -1,4 +1,5 @@
1
1
  colored>=1.4.2
2
+ importlib-metadata>=8.5.0
2
3
  packaging>=24.0
3
4
  PyYAML>=6.0
4
5
  ruamel.yaml>=0.18.6
@@ -80,6 +80,8 @@ repos:
80
80
  rev: v3.29.0
81
81
  hooks:
82
82
  - id: commitizen
83
+ stages:
84
+ - commit-msg
83
85
  - id: commitizen-branch
84
86
  entry: cz
85
87
  args: [--no-raise, '3', check, --rev-range, origin/HEAD..HEAD]
@@ -5,6 +5,7 @@ from argparse import Namespace
5
5
  from enum import Enum
6
6
  from importlib.resources import files as resources_files
7
7
  from pathlib import Path
8
+ from shlex import quote as shlex_quote
8
9
  from tempfile import _TemporaryFileWrapper, NamedTemporaryFile
9
10
  from time import sleep
10
11
  from typing import List, Union
@@ -20,6 +21,7 @@ from ..features.readme import Readme
20
21
  from ..package.bundle import Bundle
21
22
  from ..package.version import Version
22
23
  from ..prints.colors import Colors
24
+ from ..system.commands import Commands
23
25
  from ..system.platform import Platform
24
26
 
25
27
  # Entrypoint class, pylint: disable=too-few-public-methods,too-many-statements
@@ -41,6 +43,9 @@ class Entrypoint:
41
43
  def cli(options: Namespace, ) -> Result:
42
44
 
43
45
  # Variables
46
+ command_add: List[str]
47
+ command_commit: List[str]
48
+ configurations_existed: bool = False
44
49
  configurations_files: List[str] = []
45
50
 
46
51
  # List hooks
@@ -58,8 +63,11 @@ class Entrypoint:
58
63
  # List hooks files
59
64
  if hooks_files:
60
65
  print(' ')
61
- print(f'{Colors.BOLD} - List hooks: '
62
- f'{Colors.GREEN}Hooks installed in "{hooks_dir}"'
66
+ print(f'{Colors.GREEN} ===['
67
+ f'{Colors.YELLOW} List hooks: '
68
+ f'{Colors.YELLOW_LIGHT}Hooks installed in '
69
+ f'{Colors.CYAN}"{hooks_dir}"'
70
+ f'{Colors.GREEN} ]==='
63
71
  f'{Colors.RESET}')
64
72
  print(' ')
65
73
  for hook in hooks_files:
@@ -70,8 +78,11 @@ class Entrypoint:
70
78
  # Missing hooks files
71
79
  else:
72
80
  print(' ')
73
- print(f'{Colors.BOLD} - List hooks: '
74
- f'{Colors.YELLOW_LIGHT}No hooks installed in "{hooks_dir}"'
81
+ print(f'{Colors.GREEN} ===['
82
+ f'{Colors.YELLOW} List hooks: '
83
+ f'{Colors.YELLOW_LIGHT}No hooks installed in '
84
+ f'{Colors.CYAN}"{hooks_dir}"'
85
+ f'{Colors.GREEN} ]==='
75
86
  f'{Colors.RESET}')
76
87
  print(' ')
77
88
  Platform.flush()
@@ -79,8 +90,11 @@ class Entrypoint:
79
90
  # Missing hooks directory
80
91
  else:
81
92
  print(' ')
82
- print(f'{Colors.BOLD} - List hooks: '
83
- f'{Colors.RED}No hooks directory found in "{hooks_dir}"'
93
+ print(f'{Colors.GREEN} ===['
94
+ f'{Colors.YELLOW} List hooks: '
95
+ f'{Colors.YELLOW_LIGHT}No hooks directory found in '
96
+ f'{Colors.CYAN}"{hooks_dir}"'
97
+ f'{Colors.GREEN} ]==='
84
98
  f'{Colors.RESET}')
85
99
  print(' ')
86
100
  Platform.flush()
@@ -92,8 +106,10 @@ class Entrypoint:
92
106
  # Install pre-commit dependency
93
107
  if options.install or not PreCommit.exists():
94
108
  print(' ')
95
- print(f'{Colors.BOLD} - Install dependencies: '
109
+ print(f'{Colors.GREEN} ===['
110
+ f'{Colors.YELLOW} Install dependencies: '
96
111
  f'{Colors.YELLOW_LIGHT}pre-commit'
112
+ f'{Colors.GREEN} ]==='
97
113
  f'{Colors.RESET}')
98
114
  print(' ')
99
115
  Platform.flush()
@@ -102,8 +118,10 @@ class Entrypoint:
102
118
  # Install commitizen dependency
103
119
  if options.install or not Commitizen.exists() or not Commitizen.compatible():
104
120
  print(' ')
105
- print(f'{Colors.BOLD} - Install dependencies: '
121
+ print(f'{Colors.GREEN} ===['
122
+ f'{Colors.YELLOW} Install dependencies: '
106
123
  f'{Colors.YELLOW_LIGHT}commitizen'
124
+ f'{Colors.GREEN} ]==='
107
125
  f'{Colors.RESET}')
108
126
  print(' ')
109
127
  Platform.flush()
@@ -112,8 +130,10 @@ class Entrypoint:
112
130
  # Install argcomplete completion
113
131
  if options.install and not Argcomplete.configured():
114
132
  print(' ')
115
- print(f'{Colors.BOLD} - Install bash completion: '
133
+ print(f'{Colors.GREEN} ===['
134
+ f'{Colors.YELLOW} Install bash completion: '
116
135
  f'{Colors.YELLOW_LIGHT}argcomplete'
136
+ f'{Colors.GREEN} ]==='
117
137
  f'{Colors.RESET}')
118
138
  print(' ')
119
139
  Platform.flush()
@@ -124,8 +144,10 @@ class Entrypoint:
124
144
  # Install commitizen completion
125
145
  if options.install and not Commitizen.configured():
126
146
  print(' ')
127
- print(f'{Colors.BOLD} - Install dependencies: '
147
+ print(f'{Colors.GREEN} ===['
148
+ f'{Colors.YELLOW} Install dependencies: '
128
149
  f'{Colors.YELLOW_LIGHT}commitizen completion'
150
+ f'{Colors.GREEN} ]==='
129
151
  f'{Colors.RESET}')
130
152
  print(' ')
131
153
  Platform.flush()
@@ -199,15 +221,20 @@ class Entrypoint:
199
221
  )
200
222
 
201
223
  # Configre gcil hooks
202
- Gcil.configure_hooks(configuration_file=precommit_configuration.name)
224
+ Gcil.configure_hooks(
225
+ configuration_file=precommit_configuration.name,
226
+ autoupdate=not options.offline,
227
+ )
203
228
 
204
229
  # Configure sources
205
230
  if options.configure:
206
231
 
207
232
  # Install sources configurations
208
233
  print(' ')
209
- print(f'{Colors.BOLD} - Configure sources: '
234
+ print(f'{Colors.GREEN} ===['
235
+ f'{Colors.YELLOW} Configure sources: '
210
236
  f'{Colors.YELLOW_LIGHT}{Bundle.NAME}'
237
+ f'{Colors.GREEN} ]==='
211
238
  f'{Colors.RESET}')
212
239
  print(' ')
213
240
 
@@ -219,6 +246,8 @@ class Entrypoint:
219
246
 
220
247
  # Export assets files
221
248
  for asset in configurations_files:
249
+ if Path(asset).exists():
250
+ configurations_existed = True
222
251
  print(f'exporting configuration in {asset} configuration')
223
252
  data: str = resources_files(Bundle.RESOURCES_ASSETS) \
224
253
  .joinpath(asset) \
@@ -240,7 +269,10 @@ class Entrypoint:
240
269
  PreCommit.configure_useless_excludes(default=options.default)
241
270
 
242
271
  # Configre gcil hooks
243
- Gcil.configure_hooks()
272
+ Gcil.configure_hooks(
273
+ configuration_file=PreCommit.CONFIGURATION_FILE,
274
+ autoupdate=not options.offline,
275
+ )
244
276
 
245
277
  # Configure sources or badges
246
278
  if options.configure or options.badges:
@@ -250,8 +282,10 @@ class Entrypoint:
250
282
 
251
283
  # Configure README sources
252
284
  print(' ')
253
- print(f'{Colors.BOLD} - Configure sources: '
285
+ print(f'{Colors.GREEN} ===['
286
+ f'{Colors.YELLOW} Configure sources: '
254
287
  f'{Colors.YELLOW_LIGHT}{Readme.FILE}'
288
+ f'{Colors.GREEN} ]==='
255
289
  f'{Colors.RESET}')
256
290
  print(' ')
257
291
 
@@ -269,7 +303,6 @@ class Entrypoint:
269
303
 
270
304
  # Inject badge lines
271
305
  print(f'injecting badge in {Readme.FILE} documentation')
272
- print(' ')
273
306
  for i, line in enumerate(readme_lines):
274
307
 
275
308
  # Ignore non-empty lines
@@ -319,35 +352,63 @@ class Entrypoint:
319
352
  # Keep existing README
320
353
  else:
321
354
  print(f'keeping original {Readme.FILE} documentation')
322
- print(' ')
323
355
 
324
356
  # Show sources status
325
- Git.status(untracked=True)
326
357
  print(' ')
358
+ print(f'{Colors.GREEN} ===['
359
+ f'{Colors.YELLOW} Sources status: '
360
+ f'{Colors.YELLOW_LIGHT}git status'
361
+ f'{Colors.GREEN} ]==='
362
+ f'{Colors.RESET}')
363
+ print(' ')
364
+ Git.status(untracked=True)
327
365
 
328
366
  # Configure sources
329
367
  if options.configure:
330
368
 
331
369
  # Show commit hints
332
- command_add = ' '.join([
370
+ print(' ')
371
+ print(f'{Colors.GREEN} ===['
372
+ f'{Colors.YELLOW} Update sources: '
373
+ f'{Colors.YELLOW_LIGHT}git'
374
+ f'{Colors.GREEN} ]==='
375
+ f'{Colors.RESET}')
376
+ print(' ')
377
+ command_add = [
333
378
  Git.BINARY,
334
379
  'add',
335
380
  '-v',
336
- ] + [f'./{asset}' for asset in configurations_files])
337
- command_commit = ' '.join([
338
- Git.BINARY,
339
- 'commit',
340
- '-m',
341
- f'"chore(pre-commit): import \'{Bundle.NAME}\' configurations"',
342
- '-s',
343
- ])
344
- print(f'{Colors.BOLD}Add configurations: '
345
- f'{Colors.CYAN}{command_add}'
381
+ ] + [f'./{asset}' for asset in configurations_files]
382
+ if configurations_existed:
383
+ command_commit = [
384
+ Git.BINARY,
385
+ 'commit',
386
+ '-m',
387
+ f'chore(pre-commit): migrate to \'{Bundle.NAME}\' {Version.get()}',
388
+ '-s',
389
+ ]
390
+ else:
391
+ command_commit = [
392
+ Git.BINARY,
393
+ 'commit',
394
+ '-m',
395
+ f'chore(pre-commit): import \'{Bundle.NAME}\' {Version.get()}',
396
+ '-s',
397
+ ]
398
+ print(f'{Colors.BOLD} - Add configurations: '
399
+ f'{Colors.CYAN}{" ".join([shlex_quote(arg) for arg in command_add])}'
346
400
  f'{Colors.RESET}')
347
- print(f'{Colors.BOLD}Commit changes: '
348
- f'{Colors.CYAN}{command_commit}'
401
+ print(f'{Colors.BOLD} - Commit changes: '
402
+ f'{Colors.CYAN}{" ".join([shlex_quote(arg) for arg in command_commit])}'
349
403
  f'{Colors.RESET}')
350
404
 
405
+ # Commit changes automatically
406
+ if options.commit:
407
+ print(' ')
408
+ Commands.run(Git.BINARY, command_add[1:])
409
+ print(' ')
410
+ Commands.run(Git.BINARY, command_commit[1:])
411
+
351
412
  # Delay user interactions
352
413
  if Platform.IS_TTY_STDIN:
353
414
  sleep(5)
@@ -356,25 +417,32 @@ class Entrypoint:
356
417
  elif options.badges and configurations_files:
357
418
 
358
419
  # Show commit hints
359
- command_add = ' '.join([
420
+ command_add = [
360
421
  Git.BINARY,
361
422
  'add',
362
423
  '-v',
363
- ] + [f'./{asset}' for asset in configurations_files])
364
- command_commit = ' '.join([
424
+ ] + [f'./{asset}' for asset in configurations_files]
425
+ command_commit = [
365
426
  Git.BINARY,
366
427
  'commit',
367
428
  '-m',
368
- '"docs(readme): add applicable badges to the documentation"',
429
+ 'docs(readme): add applicable badges to the documentation',
369
430
  '-s',
370
- ])
371
- print(f'{Colors.BOLD}Add configurations: '
372
- f'{Colors.CYAN}{command_add}'
431
+ ]
432
+ print(f'{Colors.BOLD} - Add configurations: '
433
+ f'{Colors.CYAN}{" ".join([shlex_quote(arg) for arg in command_add])}'
373
434
  f'{Colors.RESET}')
374
- print(f'{Colors.BOLD}Commit changes: '
375
- f'{Colors.CYAN}{command_commit}'
435
+ print(f'{Colors.BOLD} - Commit changes: '
436
+ f'{Colors.CYAN}{" ".join([shlex_quote(arg) for arg in command_commit])}'
376
437
  f'{Colors.RESET}')
377
438
 
439
+ # Commit changes automatically
440
+ if options.commit:
441
+ print(' ')
442
+ Commands.run(Git.BINARY, command_add[1:])
443
+ print(' ')
444
+ Commands.run(Git.BINARY, command_commit[1:])
445
+
378
446
  # Delay user interactions
379
447
  if Platform.IS_TTY_STDIN:
380
448
  sleep(5)
@@ -387,8 +455,10 @@ class Entrypoint:
387
455
 
388
456
  # Enable Git hooks
389
457
  print(' ')
390
- print(f'{Colors.BOLD} - Enable hooks: '
458
+ print(f'{Colors.GREEN} ===['
459
+ f'{Colors.YELLOW} Enable hooks: '
391
460
  f'{Colors.YELLOW_LIGHT}Git remote'
461
+ f'{Colors.GREEN} ]==='
392
462
  f'{Colors.RESET}')
393
463
  print(' ')
394
464
  print(f'detected Git remotes: {", ".join(git_remotes)}')
@@ -399,20 +469,28 @@ class Entrypoint:
399
469
 
400
470
  # Enable pre-commit hooks
401
471
  print(' ')
402
- print(f'{Colors.BOLD} - Enable hooks: '
472
+ print(f'{Colors.GREEN} ===['
473
+ f'{Colors.YELLOW} Enable hooks: '
403
474
  f'{Colors.YELLOW_LIGHT}pre-commit'
475
+ f'{Colors.GREEN} ]==='
404
476
  f'{Colors.RESET}')
405
477
  print(' ')
406
478
  Platform.flush()
407
479
  PreCommit.install()
408
480
 
481
+ # Run pre-commit hooks
482
+ if not options.run and Path(PreCommit.CONFIGURATION_FILE).exists():
483
+ options.run = True
484
+
409
485
  # Disable hooks
410
486
  if options.disable:
411
487
 
412
488
  # Disable pre-commit hooks
413
489
  print(' ')
414
- print(f'{Colors.BOLD} - Disable hooks: '
490
+ print(f'{Colors.GREEN} ===['
491
+ f'{Colors.YELLOW} Disable hooks: '
415
492
  f'{Colors.YELLOW_LIGHT}pre-commit'
493
+ f'{Colors.GREEN} ]==='
416
494
  f'{Colors.RESET}')
417
495
  print(' ')
418
496
  Platform.flush()
@@ -423,8 +501,10 @@ class Entrypoint:
423
501
 
424
502
  # Autoupdate pre-commit hooks
425
503
  print(' ')
426
- print(f'{Colors.BOLD} - Autoupdate hooks: '
504
+ print(f'{Colors.GREEN} ===['
505
+ f'{Colors.YELLOW} Autoupdate hooks: '
427
506
  f'{Colors.YELLOW_LIGHT}pre-commit'
507
+ f'{Colors.GREEN} ]==='
428
508
  f'{Colors.RESET}')
429
509
  print(' ')
430
510
  Platform.flush()
@@ -435,8 +515,10 @@ class Entrypoint:
435
515
 
436
516
  # Disable pre-commit hooks
437
517
  print(' ')
438
- print(f'{Colors.BOLD} - Cleanup hooks: '
518
+ print(f'{Colors.GREEN} ===['
519
+ f'{Colors.YELLOW} Cleanup hooks: '
439
520
  f'{Colors.YELLOW_LIGHT}pre-commit'
521
+ f'{Colors.GREEN} ]==='
440
522
  f'{Colors.RESET}')
441
523
  print(' ')
442
524
  Platform.flush()
@@ -447,9 +529,11 @@ class Entrypoint:
447
529
 
448
530
  # Run pre-commit hooks
449
531
  print(' ')
450
- print(f'{Colors.BOLD} - Run hooks: '
532
+ print(f'{Colors.GREEN} ===['
533
+ f'{Colors.YELLOW} Run hooks: '
451
534
  f'{Colors.YELLOW_LIGHT}pre-commit'
452
535
  f'{Colors.CYAN}{f" (stage: {options.stage})" if options.stage else ""}'
536
+ f'{Colors.GREEN} ]==='
453
537
  f'{Colors.RESET}')
454
538
  print(' ')
455
539
  Platform.flush()
@@ -465,8 +549,10 @@ class Entrypoint:
465
549
 
466
550
  # Run commitizen hooks
467
551
  print(' ')
468
- print(f'{Colors.BOLD} - Run hooks: '
552
+ print(f'{Colors.GREEN} ===['
553
+ f'{Colors.YELLOW} Run hooks: '
469
554
  f'{Colors.YELLOW_LIGHT}commitizen'
555
+ f'{Colors.GREEN} ]==='
470
556
  f'{Colors.RESET}')
471
557
  print(' ')
472
558
  Platform.flush()
@@ -181,6 +181,18 @@ def main() -> None:
181
181
  action='store_true',
182
182
  help='Use global default configurations instead of sources',
183
183
  )
184
+ group.add_argument(
185
+ '--commit',
186
+ dest='commit',
187
+ action='store_true',
188
+ help='Commit configurations changes automatically',
189
+ )
190
+ group.add_argument(
191
+ '--offline',
192
+ dest='offline',
193
+ action='store_true',
194
+ help='Use offline mode to disable configurations autoupdate',
195
+ )
184
196
  group.add_argument(
185
197
  '--stage',
186
198
  dest='stage',
@@ -21,8 +21,8 @@ class Commitizen:
21
21
  CONFIGURATION_FILE: str = '.cz.yaml'
22
22
  MARKER: str = '# register-python-argcomplete cz'
23
23
  PACKAGE: str = 'commitizen'
24
- SOURCES: str = 'git+https://github.com/AdrianDC/commitizen.git@prerelease'
25
- VERSION_COMPATIBLE: str = '3.29.0+adriandc.20240825'
24
+ SOURCES: str = 'git+https://github.com/AdrianDC/commitizen.git'
25
+ VERSION_COMPATIBLE: str = '4.8.2+adriandc.20250608'
26
26
 
27
27
  # Internals
28
28
  __flags_configuration: List[str] = []
@@ -104,7 +104,7 @@ class Commitizen:
104
104
  # Install commitizen
105
105
  return Commands.pip([
106
106
  'install',
107
- Commitizen.SOURCES,
107
+ f'{Commitizen.SOURCES}@{Commitizen.VERSION_COMPATIBLE}',
108
108
  ])
109
109
 
110
110
  # Exists
@@ -38,7 +38,10 @@ class Gcil:
38
38
 
39
39
  # Configure unused hooks, pylint: disable=too-many-branches,too-many-statements
40
40
  @staticmethod
41
- def configure_hooks(configuration_file: str = PreCommit.CONFIGURATION_FILE) -> bool:
41
+ def configure_hooks(
42
+ configuration_file: str,
43
+ autoupdate: bool,
44
+ ) -> bool:
42
45
 
43
46
  # Validate gcil support
44
47
  if not Gcil.exists() or not Gcil.installed():
@@ -50,8 +53,10 @@ class Gcil:
50
53
 
51
54
  # Configure pre-commit unused hooks
52
55
  print(' ')
53
- print(f'{Colors.BOLD} - Configure sources: '
56
+ print(f'{Colors.GREEN} ===['
57
+ f'{Colors.YELLOW} Configure sources: '
54
58
  f'{Colors.YELLOW_LIGHT}run-gcil-push'
59
+ f'{Colors.GREEN} ]==='
55
60
  f'{Colors.RESET}')
56
61
  print(' ')
57
62
 
@@ -100,10 +105,11 @@ class Gcil:
100
105
  ]))
101
106
 
102
107
  # 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()
108
+ if autoupdate:
109
+ print(f'updating {Gcil.HOOKS_LABEL} repository with pre-commit: ', end='')
110
+ Platform.flush()
111
+ PreCommit.autoupdate(Gcil.HOOKS_URL)
112
+ Platform.flush()
107
113
 
108
114
  # Result
109
115
  return True
@@ -90,8 +90,10 @@ class PreCommit:
90
90
 
91
91
  # Configure pre-commit unused hooks
92
92
  print(' ')
93
- print(f'{Colors.BOLD} - Configure sources: '
93
+ print(f'{Colors.GREEN} ===['
94
+ f'{Colors.YELLOW} Configure sources: '
94
95
  f'{Colors.YELLOW_LIGHT}check-hooks-apply'
96
+ f'{Colors.GREEN} ]==='
95
97
  f'{Colors.RESET}')
96
98
  print(' ')
97
99
  for line in Commands.output(PreCommit.BINARY, [
@@ -220,8 +222,10 @@ class PreCommit:
220
222
 
221
223
  # Configure pre-commit unused hooks
222
224
  print(' ')
223
- print(f'{Colors.BOLD} - Configure sources: '
225
+ print(f'{Colors.GREEN} ===['
226
+ f'{Colors.YELLOW} Configure sources: '
224
227
  f'{Colors.YELLOW_LIGHT}check-useless-excludes'
228
+ f'{Colors.GREEN} ]==='
225
229
  f'{Colors.RESET}')
226
230
  print(' ')
227
231
  for line in Commands.output(PreCommit.BINARY, [
@@ -28,13 +28,19 @@ class Version:
28
28
 
29
29
  # Acquire version from resources
30
30
  try: # pragma: no cover
31
- from pkg_resources import require # pylint: disable=import-outside-toplevel
31
+ import importlib.metadata # pylint: disable=import-outside-toplevel
32
32
  name = __name__.split('.', maxsplit=1)[0]
33
- return str(require(name)[0].version)
33
+ return importlib.metadata.version(name)
34
34
 
35
- # Default fallback
35
+ # Acquire version from package resources
36
36
  except Exception: # pylint: disable=broad-exception-caught # pragma: no cover
37
- return '0.0.0'
37
+ try:
38
+ import importlib.metadata # pylint: disable=import-outside-toplevel
39
+ return importlib.metadata.version(Bundle.PACKAGE)
40
+
41
+ # Default fallback
42
+ except Exception: # pylint: disable=broad-exception-caught # pragma: no cover
43
+ return '0.0.0'
38
44
 
39
45
  # Path
40
46
  @staticmethod
@@ -1,2 +0,0 @@
1
- git+https://github.com/AdrianDC/commitizen.git@prerelease # == 3.29.0.AdrianDC.20240813
2
- pre-commit>=3.8.0