pre-commit-crocodile 6.1.0__tar.gz → 6.2.1__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 (109) hide show
  1. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.gitlab-ci.yml +5 -6
  2. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.pre-commit-config.yaml +2 -2
  3. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/CHANGELOG.md +48 -0
  4. {pre_commit_crocodile-6.1.0/pre_commit_crocodile.egg-info → pre_commit_crocodile-6.2.1}/PKG-INFO +3 -3
  5. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/README.md +2 -2
  6. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/commits/Dockerfile +2 -0
  7. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1/pre_commit_crocodile.egg-info}/PKG-INFO +3 -3
  8. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/assets/.pre-commit-config.yaml +1 -1
  9. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/assets/commits.yml +10 -1
  10. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/cli/entrypoint.py +88 -39
  11. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/cli/main.py +5 -1
  12. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/gcil.py +4 -3
  13. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/git.py +36 -0
  14. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/precommit.py +22 -18
  15. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/readme.py +1 -0
  16. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/hooks/check_commitizen_branch.py +4 -2
  17. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/system/commands.py +9 -2
  18. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/templates/commits.yml +10 -1
  19. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.coveragerc +0 -0
  20. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.cz.yaml +0 -0
  21. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.gitattributes +0 -0
  22. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.gitignore +0 -0
  23. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.gitmodules +0 -0
  24. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.markdownlint.json +0 -0
  25. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.pre-commit-hooks.yaml +0 -0
  26. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.style.yapf +0 -0
  27. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.vscode/extensions.json +0 -0
  28. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/.vscode/settings.json +0 -0
  29. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/LICENSE +0 -0
  30. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/config/cliff.toml +0 -0
  31. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/build/Dockerfile +0 -0
  32. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/codestyle/Dockerfile +0 -0
  33. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/deploy/Dockerfile +0 -0
  34. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/pages/Dockerfile +0 -0
  35. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/preview/Dockerfile +0 -0
  36. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/rehost/images.txt +0 -0
  37. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/test-coverage-linux/Dockerfile +0 -0
  38. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/test-coverage-windows/Dockerfile +0 -0
  39. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/containers/test-linux/Dockerfile +0 -0
  40. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/.pages.in +0 -0
  41. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/assets/images/favicon.png +0 -0
  42. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/assets/scripts/mkdocs-exporter.js +0 -0
  43. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/assets/stylesheets/custom.css +0 -0
  44. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/assets/stylesheets/pdf.scss +0 -0
  45. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/commitizen.md +0 -0
  46. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/commits.md +0 -0
  47. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/components.md +0 -0
  48. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/hooks.md +0 -0
  49. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/pre-commit.md +0 -0
  50. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/prepare.sh +0 -0
  51. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/preview.py +0 -0
  52. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/preview.svg +0 -0
  53. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/robots.txt +0 -0
  54. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/settings.md +0 -0
  55. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/template.svg +0 -0
  56. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/templates/covers/back.html.j2 +0 -0
  57. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/docs/templates/covers/front.html.j2 +0 -0
  58. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/mkdocs.yml +0 -0
  59. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/mypy.ini +0 -0
  60. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/pre_commit_crocodile.egg-info/SOURCES.txt +0 -0
  61. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/pre_commit_crocodile.egg-info/dependency_links.txt +0 -0
  62. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/pre_commit_crocodile.egg-info/entry_points.txt +0 -0
  63. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/pre_commit_crocodile.egg-info/requires.txt +0 -0
  64. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/pre_commit_crocodile.egg-info/top_level.txt +0 -0
  65. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/build.txt +0 -0
  66. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/commits.txt +0 -0
  67. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/coverage.txt +0 -0
  68. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/deploy.txt +0 -0
  69. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/docs.txt +0 -0
  70. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/pages.txt +0 -0
  71. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/quality.txt +0 -0
  72. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/runtime.txt +0 -0
  73. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/requirements/tests.txt +0 -0
  74. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/setup.cfg +0 -0
  75. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/setup.py +0 -0
  76. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/sonar-project.properties +0 -0
  77. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/__init__.py +0 -0
  78. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/__main__.py +0 -0
  79. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/assets/.cz.yaml +0 -0
  80. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/assets/__init__.py +0 -0
  81. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/cli/__init__.py +0 -0
  82. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/__init__.py +0 -0
  83. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/argcomplete.py +0 -0
  84. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/commitizen.py +0 -0
  85. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/radiandevcore.py +0 -0
  86. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/features/templates.py +0 -0
  87. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/hooks/__init__.py +0 -0
  88. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/hooks/check_yaml_ruamel_pure.py +0 -0
  89. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/hooks/configurations.py +0 -0
  90. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/hooks/prepare_commit_message.py +0 -0
  91. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/package/__init__.py +0 -0
  92. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/package/bundle.py +0 -0
  93. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/package/settings.py +0 -0
  94. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/package/updates.py +0 -0
  95. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/package/version.py +0 -0
  96. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/prints/__init__.py +0 -0
  97. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/prints/boxes.py +0 -0
  98. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/prints/colors.py +0 -0
  99. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/system/__init__.py +0 -0
  100. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/system/platform.py +0 -0
  101. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/types/__init__.py +0 -0
  102. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/types/environments.py +0 -0
  103. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/src/types/strings.py +0 -0
  104. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/tests/arguments/test.sh +0 -0
  105. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/tests/colors/test.sh +0 -0
  106. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/tests/macos/test.sh +0 -0
  107. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/tests/settings/test.sh +0 -0
  108. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/tests/versions/test.sh +0 -0
  109. {pre_commit_crocodile-6.1.0 → pre_commit_crocodile-6.2.1}/tests/windows/test.sh +0 -0
@@ -19,6 +19,11 @@ include:
19
19
  ref: main
20
20
  inputs:
21
21
  stage: development
22
+ - project: RadianDevCore/gitlab-ci/components
23
+ file: /templates/gitlab-protections.yml
24
+ ref: main
25
+ inputs:
26
+ stage: development
22
27
  - project: RadianDevCore/gitlab-ci/components
23
28
  file: /templates/registry.yml
24
29
  ref: main
@@ -471,18 +476,12 @@ py3.9:
471
476
  - .test:template
472
477
  - .test:rules
473
478
  image: registry.gitlab.com/radiandevcore/tools/pre-commit-crocodile/pre-commit-crocodile:test-oldest
474
- before_script:
475
- # Inherit before_script
476
- - !reference ['.test:template', before_script]
477
479
 
478
480
  py3.13:
479
481
  extends:
480
482
  - .test:template
481
483
  - .test:rules
482
484
  image: registry.gitlab.com/radiandevcore/tools/pre-commit-crocodile/pre-commit-crocodile:test-latest
483
- before_script:
484
- # Inherit before_script
485
- - !reference ['.test:template', before_script]
486
485
 
487
486
  quality:coverage:
488
487
  needs:
@@ -39,7 +39,7 @@ repos:
39
39
 
40
40
  # Repository: pre-commit-hooks
41
41
  - repo: https://github.com/pre-commit/pre-commit-hooks
42
- rev: v5.0.0
42
+ rev: v6.0.0
43
43
  hooks:
44
44
  - id: check-added-large-files
45
45
  args: ['--maxkb=500']
@@ -117,7 +117,7 @@ repos:
117
117
 
118
118
  # Repository: gcil
119
119
  - repo: https://gitlab.com/RadianDevCore/tools/gcil
120
- rev: 10.2.0
120
+ rev: 13.0.0
121
121
  hooks:
122
122
  - id: run-gcil-push
123
123
  name: Run GitLab CI job with gcil (codestyle)
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ <a name="6.2.1"></a>
4
+ ## [6.2.1](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/compare/6.2.0...6.2.1) (2025-08-13)
5
+
6
+ ### ✨ Features
7
+
8
+ - **entrypoint:** create missing 'README.md' if '--badges' used ([1352f4b](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/1352f4b83a35ffa924284d0eeed8017ad19694bf))
9
+
10
+ ### 🐛 Bug Fixes
11
+
12
+ - **entrypoint:** avoid 'git commit' if no differences added ([6174883](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/6174883754275cb7bdd7377a3bb8a70551118238))
13
+ - **entrypoint:** add missing '--badge' header and output flushes ([8fa468b](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/8fa468b983fe9ec4b8d0f9c38d01dfa78bf3e6de))
14
+ - **entrypoint:** re-inject partially missing badges properly ([1117ea3](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/1117ea3f0a2d27f96c92dc3f83671c439f80fb02))
15
+ - **entrypoint:** resolve unreliable 'README.md' badges line endings ([a46036e](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/a46036ed7754c0bc3dabbdfde4de68c47ffb28c4))
16
+ - **main:** avoid '--configure' if '--commit' is used with '--badges' ([f7ee29a](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/f7ee29aa2191518864b6f16d3bc75c42cee95956))
17
+
18
+ ### 🚀 CI
19
+
20
+ - **gitlab-ci:** remove redundant 'before_script:' references ([41fae52](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/41fae52f645f11983637600f20c848f6d28a19fa))
21
+
22
+
23
+ <a name="6.2.0"></a>
24
+ ## [6.2.0](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/compare/6.1.0...6.2.0) (2025-08-11)
25
+
26
+ ### ✨ Features
27
+
28
+ - **entrypoint, features:** fix configure without 'git' repository ([6719a65](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/6719a653511b8d846d5604c495a36959e885a753))
29
+ - **main:** automatically imply '--configure' if '--commit' is used ([0105b4a](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/0105b4a5d35eae046f63371e1f71d90cb081026f))
30
+ - **pre-commit-config:** migrate to 'pre-commit-hooks' v6.0.0 ([f8b3d22](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/f8b3d228c964a34b4fc3f9699662c1b253ddc5fe))
31
+ - **pre-commit-config:** migrate to 'gcil' 13.0.0 ([17f7069](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/17f70698f6d148dfd45fefc50c7e5bc7c3f7885c))
32
+
33
+ ### 🐛 Bug Fixes
34
+
35
+ - **check_commitizen_branch:** ignore missing remote branches ([f6ba7b4](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/f6ba7b4ffc4ccfabe0ae01388ab0006dffac7b76))
36
+ - **entrypoint:** register '.gitlab-ci.yml' file configurations ([655b243](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/655b24340bb1795d3c393d7d2a8a6704aa36f330))
37
+ - **entrypoint:** resolve handlings of empty 'README.md' file ([d877ba0](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/d877ba0dbf361406fbd4fbafb3761df13dcf3762))
38
+ - **entrypoint, git:** resolve diff on untracked files with intend add ([a97c10d](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/a97c10df7d6d65ff8933054432a116f59ec4ab08))
39
+
40
+ ### 🚀 CI
41
+
42
+ - **commits:** implement 'skip' CI/CD input to exclude pre-commit hooks ([3235ab4](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/3235ab47cdf4a49632e50ebed21fb28380012d4f))
43
+ - **gitlab-ci:** implement GitLab tags protection jobs ([cf6f446](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/cf6f44662ed5a28dda9ef1c585dcdf776ca9c518))
44
+
45
+ ### 📦 Build
46
+
47
+ - **commits:** install 'git-lfs' in the 'commits' image ([15c48e3](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/15c48e37293d3cda552b7d5f35dd67aa97a68149))
48
+ - **commits:** install 'bash' in the 'commits' image ([e76a933](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/commit/e76a933e846d3284cf2272b74fb78512afba38ea))
49
+
50
+
3
51
  <a name="6.1.0"></a>
4
52
  ## [6.1.0](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/compare/6.0.0...6.1.0) (2025-07-29)
5
53
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pre-commit-crocodile
3
- Version: 6.1.0
3
+ Version: 6.2.1
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
@@ -90,7 +90,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
90
90
 
91
91
  ## Preview
92
92
 
93
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/6.1.0/docs/preview.svg)
93
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/6.2.1/docs/preview.svg)
94
94
 
95
95
  ---
96
96
 
@@ -132,7 +132,7 @@ modes arguments:
132
132
  configurations arguments:
133
133
  --config FOLDER # Use configurations from a specific folder
134
134
  -D, --default # Use global default configurations instead of sources
135
- --commit # Commit configurations changes automatically
135
+ --commit # Commit configurations changes automatically (implies --configure)
136
136
  --components # Import components from GitLab with 'include: component:'
137
137
  --no-components # Import components templates locally instead of 'include: component:'
138
138
  --offline # Use offline mode to disable configurations autoupdate
@@ -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/6.1.0/docs/preview.svg)
43
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/6.2.1/docs/preview.svg)
44
44
 
45
45
  ---
46
46
 
@@ -82,7 +82,7 @@ modes arguments:
82
82
  configurations arguments:
83
83
  --config FOLDER # Use configurations from a specific folder
84
84
  -D, --default # Use global default configurations instead of sources
85
- --commit # Commit configurations changes automatically
85
+ --commit # Commit configurations changes automatically (implies --configure)
86
86
  --components # Import components from GitLab with 'include: component:'
87
87
  --no-components # Import components templates locally instead of 'include: component:'
88
88
  --offline # Use offline mode to disable configurations autoupdate
@@ -3,9 +3,11 @@ FROM $IMAGE_BASE
3
3
 
4
4
  # Install dependencies
5
5
  RUN apk add -q --no-cache \
6
+ bash \
6
7
  coreutils \
7
8
  gcc \
8
9
  git \
10
+ git-lfs \
9
11
  libc-dev
10
12
 
11
13
  # Install requirements
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pre-commit-crocodile
3
- Version: 6.1.0
3
+ Version: 6.2.1
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
@@ -90,7 +90,7 @@ Git hooks intended for developers using [pre-commit](https://pre-commit.com/) an
90
90
 
91
91
  ## Preview
92
92
 
93
- ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/6.1.0/docs/preview.svg)
93
+ ![preview.svg](https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile/raw/6.2.1/docs/preview.svg)
94
94
 
95
95
  ---
96
96
 
@@ -132,7 +132,7 @@ modes arguments:
132
132
  configurations arguments:
133
133
  --config FOLDER # Use configurations from a specific folder
134
134
  -D, --default # Use global default configurations instead of sources
135
- --commit # Commit configurations changes automatically
135
+ --commit # Commit configurations changes automatically (implies --configure)
136
136
  --components # Import components from GitLab with 'include: component:'
137
137
  --no-components # Import components templates locally instead of 'include: component:'
138
138
  --offline # Use offline mode to disable configurations autoupdate
@@ -39,7 +39,7 @@ repos:
39
39
 
40
40
  # Repository: pre-commit-hooks
41
41
  - repo: https://github.com/pre-commit/pre-commit-hooks
42
- rev: v5.0.0
42
+ rev: v6.0.0
43
43
  hooks:
44
44
  - id: check-added-large-files
45
45
  args: ['--maxkb=500']
@@ -9,6 +9,9 @@ spec:
9
9
  image:
10
10
  default: registry.gitlab.com/radiandevcore/tools/pre-commit-crocodile/pre-commit-crocodile:commits
11
11
  description: 'Specify the commits image (Default: pre-commit-crocodile:commits public image)'
12
+ skip:
13
+ default: ''
14
+ description: 'Defines the commits jobs names to skip (Default: "")'
12
15
  version_minimal:
13
16
  default: 5
14
17
  description: 'Defines the commits image minimal version (Default: 6)'
@@ -20,6 +23,7 @@ $[[ inputs.name ]]:
20
23
  needs: []
21
24
  variables:
22
25
  GIT_SUBMODULE_STRATEGY: none
26
+ PRE_COMMIT_SKIP: $[[ inputs.skip ]]
23
27
  VERSION_MINIMAL: $[[ inputs.version_minimal ]]
24
28
  before_script:
25
29
  # Validate image version
@@ -95,7 +99,12 @@ $[[ inputs.name ]]:
95
99
  - |
96
100
  set +x
97
101
  echo ' '
98
- skip=$(grep 'id: run-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g' | tr '\n' ',' | sed 's/,$//g' || true)
102
+ skip=$(
103
+ {
104
+ grep 'id: run-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g'
105
+ echo -n "${PRE_COMMIT_SKIP}" | tr ' ' '\n'
106
+ } | tr '\n' ',' | sed 's/,$//g' || true
107
+ )
99
108
  set -x
100
109
  pre-commit install --install-hooks
101
110
  SKIP="${skip}" pre-commit run --all-files --show-diff-on-failure
@@ -216,7 +216,7 @@ class Entrypoint:
216
216
  file.flush()
217
217
 
218
218
  # Autoupdate pre-commit hooks
219
- if not options.offline:
219
+ if not options.offline and Git.is_repository():
220
220
  PreCommit.autoupdate()
221
221
 
222
222
  # Configure useless excludes
@@ -242,7 +242,7 @@ class Entrypoint:
242
242
  )
243
243
 
244
244
  # Autoupdate pre-commit hooks
245
- if not options.offline:
245
+ if not options.offline and Git.is_repository():
246
246
  PreCommit.autoupdate()
247
247
 
248
248
  # Configure sources
@@ -280,7 +280,7 @@ class Entrypoint:
280
280
  sleep(0.5)
281
281
 
282
282
  # Autoupdate pre-commit hooks
283
- if not options.offline:
283
+ if not options.offline and Git.is_repository():
284
284
  PreCommit.autoupdate()
285
285
 
286
286
  # Configure useless excludes
@@ -302,7 +302,7 @@ class Entrypoint:
302
302
  )
303
303
 
304
304
  # Autoupdate pre-commit hooks
305
- if not options.offline:
305
+ if not options.offline and Git.is_repository():
306
306
  PreCommit.autoupdate()
307
307
 
308
308
  # Export components templates
@@ -432,6 +432,9 @@ class Entrypoint:
432
432
  ]))
433
433
  f.write(local_ci_data)
434
434
 
435
+ # Register configured file
436
+ configurations_files += [Gcil.FILE]
437
+
435
438
  # Enable pre-commit hooks
436
439
  if not options.enable:
437
440
  options.enable = True
@@ -440,7 +443,7 @@ class Entrypoint:
440
443
  if options.configure or options.badges:
441
444
 
442
445
  # Inject badge to README
443
- if Readme.exists():
446
+ if Readme.exists() or options.badges:
444
447
 
445
448
  # Configure README sources
446
449
  print(' ')
@@ -454,14 +457,36 @@ class Entrypoint:
454
457
  # Acquire README contents
455
458
  readme_lines: List[str] = Readme.read()
456
459
 
457
- # Validate badge in README
458
- if not any(
459
- line.startswith(f'[![{Bundle.NAME}]') for line in readme_lines):
460
+ # Prepare empty README
461
+ if not readme_lines:
462
+ readme_lines = [f'# {Path.cwd().name}{Readme.EOL}']
463
+
464
+ # Prepare README without empty lines
465
+ if all(line.strip() for line in readme_lines):
466
+ if not readme_lines[-1].endswith(Readme.EOL):
467
+ readme_lines[-1] = f'{readme_lines[-1]}{Readme.EOL}'
468
+ readme_lines += [f'{Readme.EOL}']
469
+ readme_lines += ['']
470
+
471
+ # Check badges in READE
472
+ bundle_found: bool = any(
473
+ line.startswith(f'[![{Bundle.NAME}]') for line in readme_lines)
474
+ guidelines_found: bool = any(
475
+ line.startswith(f'[![{RadianDevCore.Guidelines.BADGE_TEXT}]')
476
+ for line in readme_lines)
477
+ gcil_found: bool = any(
478
+ line.startswith(f'[![{Gcil.BADGE_TEXT}]') for line in readme_lines)
479
+
480
+ # Detect gcil usage
481
+ gcil_exists: bool = Gcil.exists()
482
+ gcil_configured: bool = Gcil.configured()
483
+ gcil_installed: bool = Gcil.installed()
484
+ gcil_needed: bool = gcil_exists and (gcil_configured or gcil_installed)
460
485
 
461
- # Detect gcil usage
462
- gcil_exists: bool = Gcil.exists()
463
- gcil_configured: bool = Gcil.configured()
464
- gcil_installed: bool = Gcil.installed()
486
+ # Validate badge in README
487
+ if not bundle_found \
488
+ or not guidelines_found \
489
+ or (not gcil_found and gcil_needed):
465
490
 
466
491
  # Inject badge lines
467
492
  print(f'injecting badge in {Readme.FILE} documentation')
@@ -471,6 +496,10 @@ class Entrypoint:
471
496
  if line.strip():
472
497
  continue
473
498
 
499
+ # Handle empty line
500
+ if not line:
501
+ line = Readme.EOL
502
+
474
503
  # Inject badges separator
475
504
  readme_lines.insert(
476
505
  i + 1,
@@ -478,23 +507,25 @@ class Entrypoint:
478
507
  )
479
508
 
480
509
  # Inject RadianDevCore guidelines badge
481
- readme_lines.insert(
482
- i + 1,
483
- f'[![{RadianDevCore.Guidelines.BADGE_TEXT}]'
484
- f'({RadianDevCore.Guidelines.BADGE_IMAGE})]'
485
- f'({RadianDevCore.Guidelines.BADGE_URL}){line}',
486
- )
510
+ if not guidelines_found:
511
+ readme_lines.insert(
512
+ i + 1,
513
+ f'[![{RadianDevCore.Guidelines.BADGE_TEXT}]'
514
+ f'({RadianDevCore.Guidelines.BADGE_IMAGE})]'
515
+ f'({RadianDevCore.Guidelines.BADGE_URL}){line}',
516
+ )
487
517
 
488
518
  # Inject pre-commit-crocodile badge
489
- readme_lines.insert(
490
- i + 1,
491
- f'[![{Bundle.NAME}]'
492
- f'({Bundle.BADGE})]'
493
- f'({Bundle.DOCUMENTATION}){line}',
494
- )
519
+ if not bundle_found:
520
+ readme_lines.insert(
521
+ i + 1,
522
+ f'[![{Bundle.NAME}]'
523
+ f'({Bundle.BADGE})]'
524
+ f'({Bundle.DOCUMENTATION}){line}',
525
+ )
495
526
 
496
527
  # Inject gcil badge
497
- if gcil_exists and (gcil_configured or gcil_installed):
528
+ if not gcil_found and gcil_needed:
498
529
  readme_lines.insert(
499
530
  i + 1,
500
531
  f'[![{Gcil.BADGE_TEXT}]'
@@ -516,17 +547,21 @@ class Entrypoint:
516
547
  print(f'keeping original {Readme.FILE} documentation')
517
548
 
518
549
  # Show sources status
519
- print(' ')
520
- print(f'{Colors.GREEN} ===['
521
- f'{Colors.YELLOW} Sources status: '
522
- f'{Colors.YELLOW_LIGHT}git status'
523
- f'{Colors.GREEN} ]==='
524
- f'{Colors.RESET}')
525
- print(' ')
526
- Git.status(untracked=True)
550
+ if Git.is_repository():
551
+ print(' ')
552
+ print(f'{Colors.GREEN} ===['
553
+ f'{Colors.YELLOW} Sources status: '
554
+ f'{Colors.YELLOW_LIGHT}git status'
555
+ f'{Colors.GREEN} ]==='
556
+ f'{Colors.RESET}')
557
+ print(' ')
558
+ Git.status(untracked=True)
527
559
 
528
560
  # Configure sources
529
- if options.configure and Git.diff(configurations_files):
561
+ if options.configure \
562
+ and Git.is_repository() \
563
+ and Git.intend(configurations_files) \
564
+ and Git.diff(configurations_files):
530
565
 
531
566
  # Show commit hints
532
567
  print(' ')
@@ -571,14 +606,17 @@ class Entrypoint:
571
606
  print(f'{Colors.BOLD} - Commit changes: '
572
607
  f'{Colors.CYAN}{command_commit_string}'
573
608
  f'{Colors.RESET}')
609
+ Platform.flush()
574
610
 
575
611
  # Commit changes automatically
576
612
  if options.commit:
577
613
  print(' ')
578
614
  Commands.run(Git.BINARY, command_add[1:])
615
+ Platform.flush()
579
616
  if not Git.staging_empty():
580
617
  print(' ')
581
618
  Commands.run(Git.BINARY, command_commit[1:])
619
+ Platform.flush()
582
620
 
583
621
  # Delay user interactions
584
622
  if Platform.IS_TTY_STDIN:
@@ -588,9 +626,16 @@ class Entrypoint:
588
626
  sleep(3)
589
627
 
590
628
  # Configure badges
591
- elif options.badges and configurations_files:
629
+ elif options.badges and configurations_files and Git.is_repository():
592
630
 
593
631
  # Show commit hints
632
+ print(' ')
633
+ print(f'{Colors.GREEN} ===['
634
+ f'{Colors.YELLOW} Update sources: '
635
+ f'{Colors.YELLOW_LIGHT}git'
636
+ f'{Colors.GREEN} ]==='
637
+ f'{Colors.RESET}')
638
+ print(' ')
594
639
  command_add = [
595
640
  Git.BINARY,
596
641
  'add',
@@ -617,13 +662,17 @@ class Entrypoint:
617
662
  print(f'{Colors.BOLD} - Commit changes: '
618
663
  f'{Colors.CYAN}{command_commit_string}'
619
664
  f'{Colors.RESET}')
665
+ Platform.flush()
620
666
 
621
667
  # Commit changes automatically
622
668
  if options.commit:
623
669
  print(' ')
624
670
  Commands.run(Git.BINARY, command_add[1:])
625
- print(' ')
626
- Commands.run(Git.BINARY, command_commit[1:])
671
+ Platform.flush()
672
+ if not Git.staging_empty():
673
+ print(' ')
674
+ Commands.run(Git.BINARY, command_commit[1:])
675
+ Platform.flush()
627
676
 
628
677
  # Delay user interactions
629
678
  if Platform.IS_TTY_STDIN:
@@ -633,7 +682,7 @@ class Entrypoint:
633
682
  sleep(3)
634
683
 
635
684
  # Enable hooks
636
- if options.enable:
685
+ if options.enable and Git.is_repository():
637
686
 
638
687
  # Detect Git remotes
639
688
  git_remotes: List[str] = Git.remotes()
@@ -733,7 +782,7 @@ class Entrypoint:
733
782
  )
734
783
 
735
784
  # Run commitizen hooks
736
- if Git.commit_exists('HEAD'):
785
+ if Git.is_repository() and Git.commit_exists('HEAD'):
737
786
  print(' ')
738
787
  print(f'{Colors.GREEN} ===['
739
788
  f'{Colors.YELLOW} Run hooks: '
@@ -185,7 +185,7 @@ def main() -> None:
185
185
  '--commit',
186
186
  dest='commit',
187
187
  action='store_true',
188
- help='Commit configurations changes automatically',
188
+ help='Commit configurations changes automatically (implies --configure)',
189
189
  )
190
190
  subgroup = group.add_mutually_exclusive_group()
191
191
  subgroup.add_argument(
@@ -285,6 +285,10 @@ def main() -> None:
285
285
  updates.check(older=True)
286
286
  sys_exit(0)
287
287
 
288
+ # Implicit modes
289
+ if options.commit and not options.configure and not options.badges:
290
+ options.configure = True
291
+
288
292
  # Arguments modes
289
293
  if options.autoupdate:
290
294
  options.enable = True
@@ -6,6 +6,7 @@ from re import search
6
6
  from typing import List
7
7
 
8
8
  # Components
9
+ from ..features.git import Git
9
10
  from ..features.precommit import PreCommit
10
11
  from ..prints.colors import Colors
11
12
  from ..system.commands import Commands
@@ -26,7 +27,7 @@ class Gcil:
26
27
  HOOK_NAME: str = 'Run GitLab CI job with gcil'
27
28
  HOOKS_LABEL: str = 'gcil'
28
29
  HOOKS_URL: str = 'https://gitlab.com/RadianDevCore/tools/gcil'
29
- HOOKS_VERSION_MINIMAL: str = '12.0.0'
30
+ HOOKS_VERSION_MINIMAL: str = '13.0.0'
30
31
  MARKER_NODE: str = '.local:'
31
32
  MARKER_VARIABLE: str = 'CI_LOCAL'
32
33
 
@@ -56,7 +57,7 @@ class Gcil:
56
57
  print(' ')
57
58
  print(f'{Colors.GREEN} ===['
58
59
  f'{Colors.YELLOW} Configure sources: '
59
- f'{Colors.YELLOW_LIGHT}run-gcil-push'
60
+ f'{Colors.YELLOW_LIGHT}{Gcil.HOOK_ID}'
60
61
  f'{Colors.GREEN} ]==='
61
62
  f'{Colors.RESET}')
62
63
  print(' ')
@@ -106,7 +107,7 @@ class Gcil:
106
107
  ]))
107
108
 
108
109
  # Autoupdate repository
109
- if autoupdate:
110
+ if autoupdate and Git.is_repository():
110
111
  print(f'updating {Gcil.HOOKS_LABEL} repository with pre-commit: ', end='')
111
112
  Platform.flush()
112
113
  PreCommit.autoupdate(Gcil.HOOKS_URL)
@@ -64,10 +64,42 @@ class Git:
64
64
  if hook.is_file() and '.' not in hook.name
65
65
  ]
66
66
 
67
+ # Intend
68
+ @staticmethod
69
+ def intend(files: List[str]) -> bool:
70
+
71
+ # Intend to add files
72
+ return Commands.run(
73
+ Git.BINARY,
74
+ [
75
+ 'add',
76
+ '--intent-to-add',
77
+ ] + files,
78
+ check=False,
79
+ )
80
+
81
+ # Is repository
82
+ @staticmethod
83
+ def is_repository() -> bool:
84
+
85
+ # Check git repository
86
+ return Commands.run(
87
+ Git.BINARY,
88
+ [
89
+ 'rev-parse',
90
+ '--is-inside-work-tree',
91
+ ],
92
+ check=False,
93
+ )
94
+
67
95
  # Remotes
68
96
  @staticmethod
69
97
  def remotes() -> List[str]:
70
98
 
99
+ # Detect git repository
100
+ if not Git.is_repository():
101
+ return []
102
+
71
103
  # List git remotes
72
104
  return [
73
105
  remote.lstrip('*').strip()
@@ -124,6 +156,10 @@ class Git:
124
156
  @staticmethod
125
157
  def urls() -> List[str]:
126
158
 
159
+ # Detect git repository
160
+ if not Git.is_repository():
161
+ return []
162
+
127
163
  # List git remotes URLs
128
164
  return [
129
165
  url.strip() for url in Commands.output(Git.BINARY, [
@@ -86,10 +86,11 @@ class PreCommit:
86
86
 
87
87
  # Prestage pre-commit configuration
88
88
  if not default or configuration_moved or configuration_tmp:
89
- Commands.run(Git.BINARY, [
90
- 'add',
91
- PreCommit.CONFIGURATION_FILE,
92
- ])
89
+ if Git.is_repository():
90
+ Commands.run(Git.BINARY, [
91
+ 'add',
92
+ PreCommit.CONFIGURATION_FILE,
93
+ ])
93
94
 
94
95
  # Configure pre-commit unused hooks
95
96
  print(' ')
@@ -119,11 +120,12 @@ class PreCommit:
119
120
 
120
121
  # Reset pre-commit configuration
121
122
  if not default or configuration_moved or configuration_tmp:
122
- Commands.run(Git.BINARY, [
123
- 'reset',
124
- 'HEAD',
125
- PreCommit.CONFIGURATION_FILE,
126
- ])
123
+ if Git.is_repository():
124
+ Commands.run(Git.BINARY, [
125
+ 'reset',
126
+ 'HEAD',
127
+ PreCommit.CONFIGURATION_FILE,
128
+ ])
127
129
 
128
130
  # Show unused hooks
129
131
  print(f'detected unused hooks in configuration: {", ".join(hooks_unused) or "-"}')
@@ -225,10 +227,11 @@ class PreCommit:
225
227
 
226
228
  # Prestage pre-commit configuration
227
229
  if not default or configuration_moved or configuration_tmp:
228
- Commands.run(Git.BINARY, [
229
- 'add',
230
- PreCommit.CONFIGURATION_FILE,
231
- ])
230
+ if Git.is_repository():
231
+ Commands.run(Git.BINARY, [
232
+ 'add',
233
+ PreCommit.CONFIGURATION_FILE,
234
+ ])
232
235
 
233
236
  # Configure pre-commit unused hooks
234
237
  print(' ')
@@ -262,11 +265,12 @@ class PreCommit:
262
265
 
263
266
  # Reset pre-commit configuration
264
267
  if not default or configuration_moved or configuration_tmp:
265
- Commands.run(Git.BINARY, [
266
- 'reset',
267
- 'HEAD',
268
- PreCommit.CONFIGURATION_FILE,
269
- ])
268
+ if Git.is_repository():
269
+ Commands.run(Git.BINARY, [
270
+ 'reset',
271
+ 'HEAD',
272
+ PreCommit.CONFIGURATION_FILE,
273
+ ])
270
274
 
271
275
  # Show unused hooks
272
276
  print(f'detected unused hooks in configuration: {", ".join(hooks_unused) or "-"}')
@@ -8,6 +8,7 @@ from typing import List
8
8
  class Readme:
9
9
 
10
10
  # Constants
11
+ EOL: str = '\n'
11
12
  FILE: str = 'README.md'
12
13
 
13
14
  # Exists
@@ -70,8 +70,10 @@ def main() -> None:
70
70
 
71
71
  # Update Git remote
72
72
  if result == 23:
73
- git_update_remote_head(remote)
74
- result = commitizen_branch(remote)
73
+ if git_update_remote_head(remote):
74
+ result = commitizen_branch(remote)
75
+ else:
76
+ result = 0
75
77
 
76
78
  # Result
77
79
  sys_exit(result)
@@ -4,7 +4,7 @@
4
4
  from pathlib import Path
5
5
  from shutil import which
6
6
  import subprocess
7
- from typing import List
7
+ from typing import List, Optional
8
8
 
9
9
  # Commands
10
10
  class Commands:
@@ -93,6 +93,10 @@ class Commands:
93
93
  @staticmethod
94
94
  def run(binary: str, arguments: List[str], check: bool = True) -> bool:
95
95
 
96
+ # Variables
97
+ stderr: Optional[int] = None if check else subprocess.DEVNULL
98
+ stdout: Optional[int] = None if check else subprocess.DEVNULL
99
+
96
100
  # Run system command
97
101
  try:
98
102
  process = subprocess.run(
@@ -100,8 +104,11 @@ class Commands:
100
104
  cwd=None,
101
105
  check=check,
102
106
  shell=False,
107
+ stderr=stderr,
108
+ stdout=stdout,
103
109
  )
104
110
  return process.returncode == 0
105
111
  except subprocess.CalledProcessError as e:
106
- print(f"Error executing command: {e}")
112
+ if check:
113
+ print(f"Error executing command: {e}")
107
114
  return False
@@ -9,6 +9,9 @@ spec:
9
9
  image:
10
10
  default: registry.gitlab.com/radiandevcore/tools/pre-commit-crocodile/pre-commit-crocodile:commits
11
11
  description: 'Specify the commits image (Default: pre-commit-crocodile:commits public image)'
12
+ skip:
13
+ default: ''
14
+ description: 'Defines the commits jobs names to skip (Default: "")'
12
15
  version_minimal:
13
16
  default: 5
14
17
  description: 'Defines the commits image minimal version (Default: 6)'
@@ -20,6 +23,7 @@ $[[ inputs.name ]]:
20
23
  needs: []
21
24
  variables:
22
25
  GIT_SUBMODULE_STRATEGY: none
26
+ PRE_COMMIT_SKIP: $[[ inputs.skip ]]
23
27
  VERSION_MINIMAL: $[[ inputs.version_minimal ]]
24
28
  before_script:
25
29
  # Validate image version
@@ -95,7 +99,12 @@ $[[ inputs.name ]]:
95
99
  - |
96
100
  set +x
97
101
  echo ' '
98
- skip=$(grep 'id: run-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g' | tr '\n' ',' | sed 's/,$//g' || true)
102
+ skip=$(
103
+ {
104
+ grep 'id: run-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g'
105
+ echo -n "${PRE_COMMIT_SKIP}" | tr ' ' '\n'
106
+ } | tr '\n' ',' | sed 's/,$//g' || true
107
+ )
99
108
  set -x
100
109
  pre-commit install --install-hooks
101
110
  SKIP="${skip}" pre-commit run --all-files --show-diff-on-failure