check-config 0.8.6__tar.gz → 0.9.0a1__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 (165) hide show
  1. {check_config-0.8.6 → check_config-0.9.0a1}/CHANGES.md +5 -1
  2. {check_config-0.8.6 → check_config-0.9.0a1}/PKG-INFO +10 -7
  3. {check_config-0.8.6 → check_config-0.9.0a1}/README.md +9 -6
  4. {check_config-0.8.6 → check_config-0.9.0a1}/docs/checkers.md +142 -87
  5. check_config-0.9.0a1/docs/examples.md +32 -0
  6. check_config-0.9.0a1/docs/glossary.md +8 -0
  7. {check_config-0.8.6 → check_config-0.9.0a1}/docs/index.md +3 -0
  8. {check_config-0.8.6 → check_config-0.9.0a1}/docs/usage.md +1 -2
  9. check_config-0.9.0a1/example/check-config-for-usage-doc.toml +22 -0
  10. check_config-0.9.0a1/example/checkers/check-config.toml +139 -0
  11. check_config-0.9.0a1/example/checkers/folder/local_file.toml +8 -0
  12. check_config-0.9.0a1/example/checkers/folder/relative_local_file.toml +3 -0
  13. check_config-0.9.0a1/example/checkers/http_check_config.toml +5 -0
  14. check_config-0.9.0a1/example/checkers/http_check_config_relative.toml +3 -0
  15. {check_config-0.8.6 → check_config-0.9.0a1}/example/pyproject.toml +1 -1
  16. {check_config-0.8.6 → check_config-0.9.0a1}/example/test.sh +1 -1
  17. check_config-0.9.0a1/example_checkers/bash.toml +3 -0
  18. {check_config-0.8.6 → check_config-0.9.0a1}/example_checkers/black.toml +7 -3
  19. {check_config-0.8.6 → check_config-0.9.0a1}/example_checkers/mypy.toml +10 -5
  20. check_config-0.9.0a1/example_checkers/python.toml +32 -0
  21. {check_config-0.8.6 → check_config-0.9.0a1}/example_checkers/ruff.toml +15 -11
  22. {check_config-0.8.6 → check_config-0.9.0a1}/mkdocs.yml +2 -1
  23. {check_config-0.8.6 → check_config-0.9.0a1}/pyproject.toml +1 -1
  24. check_config-0.9.0a1/src/checkers/base.rs +89 -0
  25. {check_config-0.8.6/src/checkers → check_config-0.9.0a1/src/checkers/file}/entry_absent.rs +55 -44
  26. check_config-0.9.0a1/src/checkers/file/entry_present.rs +119 -0
  27. check_config-0.9.0a1/src/checkers/file/file_absent.rs +87 -0
  28. check_config-0.9.0a1/src/checkers/file/file_present.rs +282 -0
  29. check_config-0.9.0a1/src/checkers/file/key_absent.rs +113 -0
  30. check_config-0.9.0a1/src/checkers/file/key_value_present.rs +114 -0
  31. {check_config-0.8.6/src/checkers → check_config-0.9.0a1/src/checkers/file}/key_value_regex_match.rs +59 -18
  32. check_config-0.9.0a1/src/checkers/file/lines_absent.rs +184 -0
  33. check_config-0.9.0a1/src/checkers/file/lines_present.rs +291 -0
  34. check_config-0.9.0a1/src/checkers/file/mod.rs +346 -0
  35. check_config-0.9.0a1/src/checkers/mod.rs +324 -0
  36. check_config-0.9.0a1/src/checkers/package/mod.rs +7 -0
  37. check_config-0.8.6/src/checkers/file_present.rs → check_config-0.9.0a1/src/checkers/package/package_absent.rs +20 -28
  38. check_config-0.9.0a1/src/checkers/package/package_present.rs +279 -0
  39. {check_config-0.8.6 → check_config-0.9.0a1}/src/checkers/utils.rs +9 -9
  40. {check_config-0.8.6 → check_config-0.9.0a1}/src/cli.rs +52 -64
  41. {check_config-0.8.6 → check_config-0.9.0a1}/src/integration_test.rs +2 -4
  42. {check_config-0.8.6 → check_config-0.9.0a1}/src/mapping/generic.rs +32 -24
  43. {check_config-0.8.6 → check_config-0.9.0a1}/src/mapping/toml.rs +3 -3
  44. check_config-0.9.0a1/tests/resources/checkers/entry_absent/1/checker.toml +1 -0
  45. check_config-0.9.0a1/tests/resources/checkers/entry_absent/2/checker.toml +1 -0
  46. check_config-0.9.0a1/tests/resources/checkers/entry_present/1/checker.toml +2 -0
  47. check_config-0.9.0a1/tests/resources/checkers/entry_present/2/checker.toml +2 -0
  48. check_config-0.8.6/docs/examples.md +0 -129
  49. check_config-0.8.6/example/check-config-for-usage-doc.toml +0 -9
  50. check_config-0.8.6/example/checkers/check-config.toml +0 -100
  51. check_config-0.8.6/example/checkers/folder/local_file.toml +0 -7
  52. check_config-0.8.6/example/checkers/folder/relative_local_file.toml +0 -2
  53. check_config-0.8.6/example/checkers/http_check_config.toml +0 -4
  54. check_config-0.8.6/example/checkers/http_check_config_relative.toml +0 -2
  55. check_config-0.8.6/example_checkers/bash.toml +0 -2
  56. check_config-0.8.6/example_checkers/python.toml +0 -25
  57. check_config-0.8.6/src/checkers/base.rs +0 -160
  58. check_config-0.8.6/src/checkers/entry_present.rs +0 -107
  59. check_config-0.8.6/src/checkers/file_absent.rs +0 -65
  60. check_config-0.8.6/src/checkers/file_regex.rs +0 -184
  61. check_config-0.8.6/src/checkers/key_absent.rs +0 -94
  62. check_config-0.8.6/src/checkers/key_value_present.rs +0 -91
  63. check_config-0.8.6/src/checkers/lines_absent.rs +0 -201
  64. check_config-0.8.6/src/checkers/lines_present.rs +0 -301
  65. check_config-0.8.6/src/checkers/mod.rs +0 -503
  66. check_config-0.8.6/tests/resources/checkers/entry_absent/1/checker.toml +0 -2
  67. check_config-0.8.6/tests/resources/checkers/entry_absent/2/checker.toml +0 -2
  68. check_config-0.8.6/tests/resources/checkers/entry_present/1/checker.toml +0 -2
  69. check_config-0.8.6/tests/resources/checkers/entry_present/2/checker.toml +0 -2
  70. {check_config-0.8.6 → check_config-0.9.0a1}/.gitignore +0 -0
  71. {check_config-0.8.6 → check_config-0.9.0a1}/.pre-commit-hook.yaml +0 -0
  72. {check_config-0.8.6 → check_config-0.9.0a1}/.readthedocs.yaml +0 -0
  73. {check_config-0.8.6 → check_config-0.9.0a1}/.zellij/env +0 -0
  74. {check_config-0.8.6 → check_config-0.9.0a1}/.zellij/layout.kdl +0 -0
  75. {check_config-0.8.6 → check_config-0.9.0a1}/Cargo.lock +0 -0
  76. {check_config-0.8.6 → check_config-0.9.0a1}/Cargo.toml +0 -0
  77. {check_config-0.8.6 → check_config-0.9.0a1}/LICENSE +0 -0
  78. {check_config-0.8.6 → check_config-0.9.0a1}/docs/features.md +0 -0
  79. {check_config-0.8.6 → check_config-0.9.0a1}/docs/installation.md +0 -0
  80. {check_config-0.8.6 → check_config-0.9.0a1}/docs/requirements.txt +0 -0
  81. {check_config-0.8.6 → check_config-0.9.0a1}/docs/support.md +0 -0
  82. {check_config-0.8.6 → check_config-0.9.0a1}/example/.gitignore +0 -0
  83. {check_config-0.8.6 → check_config-0.9.0a1}/example/expected_output/.bashrc +0 -0
  84. {check_config-0.8.6 → check_config-0.9.0a1}/example/expected_output/.gitconfig +0 -0
  85. {check_config-0.8.6 → check_config-0.9.0a1}/example/expected_output/test.json +0 -0
  86. {check_config-0.8.6 → check_config-0.9.0a1}/example/expected_output/test.toml +0 -0
  87. {check_config-0.8.6 → check_config-0.9.0a1}/example/expected_output/test.yaml +0 -0
  88. {check_config-0.8.6 → check_config-0.9.0a1}/example/input/.bashrc +0 -0
  89. {check_config-0.8.6 → check_config-0.9.0a1}/example/input/test.json +0 -0
  90. {check_config-0.8.6 → check_config-0.9.0a1}/example/input/test.toml +0 -0
  91. {check_config-0.8.6 → check_config-0.9.0a1}/example/input/test.yaml +0 -0
  92. {check_config-0.8.6 → check_config-0.9.0a1}/example/input/to_be_removed +0 -0
  93. {check_config-0.8.6 → check_config-0.9.0a1}/example/test_via_pyproject.sh +0 -0
  94. {check_config-0.8.6 → check_config-0.9.0a1}/src/bin/check-config.rs +0 -0
  95. {check_config-0.8.6 → check_config-0.9.0a1}/src/checkers/schema_validate.rs +0 -0
  96. {check_config-0.8.6 → check_config-0.9.0a1}/src/checkers/test_helpers.rs +0 -0
  97. {check_config-0.8.6 → check_config-0.9.0a1}/src/file_types/ini.rs +0 -0
  98. {check_config-0.8.6 → check_config-0.9.0a1}/src/file_types/json.rs +0 -0
  99. {check_config-0.8.6 → check_config-0.9.0a1}/src/file_types/mod.rs +0 -0
  100. {check_config-0.8.6 → check_config-0.9.0a1}/src/file_types/toml.rs +0 -0
  101. {check_config-0.8.6 → check_config-0.9.0a1}/src/file_types/yaml.rs +0 -0
  102. {check_config-0.8.6 → check_config-0.9.0a1}/src/lib.rs +0 -0
  103. {check_config-0.8.6 → check_config-0.9.0a1}/src/mapping/json.rs +0 -0
  104. {check_config-0.8.6 → check_config-0.9.0a1}/src/mapping/mod.rs +0 -0
  105. {check_config-0.8.6 → check_config-0.9.0a1}/src/mapping/yaml.rs +0 -0
  106. {check_config-0.8.6 → check_config-0.9.0a1}/src/uri.rs +0 -0
  107. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/1/expected_output.json +0 -0
  108. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/1/expected_output.toml +0 -0
  109. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/1/expected_output.yaml +0 -0
  110. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/1/input.json +0 -0
  111. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/1/input.toml +0 -0
  112. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/1/input.yaml +0 -0
  113. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/2/expected_output.json +0 -0
  114. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/2/expected_output.toml +0 -0
  115. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/2/expected_output.yaml +0 -0
  116. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/2/input.json +0 -0
  117. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/2/input.toml +0 -0
  118. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_absent/2/input.yaml +0 -0
  119. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/1/expected_output.json +0 -0
  120. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/1/expected_output.toml +0 -0
  121. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/1/expected_output.yaml +0 -0
  122. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/1/input.json +0 -0
  123. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/1/input.toml +0 -0
  124. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/1/input.yaml +0 -0
  125. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/2/expected_output.json +0 -0
  126. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/2/expected_output.toml +0 -0
  127. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/2/expected_output.yaml +0 -0
  128. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/2/input.json +0 -0
  129. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/2/input.toml +0 -0
  130. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/entry_present/2/input.yaml +0 -0
  131. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_absent/1/checker.toml +0 -0
  132. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_absent/1/expected_output.json +0 -0
  133. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_absent/1/expected_output.toml +0 -0
  134. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_absent/1/expected_output.yaml +0 -0
  135. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_absent/1/input.json +0 -0
  136. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_absent/1/input.toml +0 -0
  137. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_absent/1/input.yaml +0 -0
  138. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/1/checker.toml +0 -0
  139. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/1/expected_output.json +0 -0
  140. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/1/expected_output.toml +0 -0
  141. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/1/expected_output.yaml +0 -0
  142. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/1/input.json +0 -0
  143. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/1/input.toml +0 -0
  144. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/1/input.yaml +0 -0
  145. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/2/checker.toml +0 -0
  146. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/2/expected_output.json +0 -0
  147. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/2/expected_output.toml +0 -0
  148. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/2/expected_output.yaml +0 -0
  149. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/2/input.json +0 -0
  150. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/2/input.toml +0 -0
  151. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_present/2/input.yaml +0 -0
  152. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/1/checker.toml +0 -0
  153. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/1/expected_output.json +0 -0
  154. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/1/expected_output.toml +0 -0
  155. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/1/expected_output.yaml +0 -0
  156. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/1/input.json +0 -0
  157. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/1/input.toml +0 -0
  158. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/1/input.yaml +0 -0
  159. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/2/checker.toml +0 -0
  160. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/2/expected_output.json +0 -0
  161. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/2/expected_output.toml +0 -0
  162. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/2/expected_output.yaml +0 -0
  163. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/2/input.json +0 -0
  164. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/2/input.toml +0 -0
  165. {check_config-0.8.6 → check_config-0.9.0a1}/tests/resources/checkers/key_value_regex_match/2/input.yaml +0 -0
@@ -1,5 +1,9 @@
1
1
  # CHANGES
2
2
 
3
+ ## 0.9.0.alpha.1
4
+
5
+ - BREAKING: refactor the check-config toml files. See documentation for new format.
6
+
3
7
  ## 0.8.6
4
8
 
5
9
  - The path specified on the cli with, can also be a URL.
@@ -30,7 +34,7 @@
30
34
 
31
35
  ## 0.8.0
32
36
 
33
- - Add __replacements_regex in lines_present
37
+ - Add \_\_replacements_regex in lines_present
34
38
  - BREAKING: use [__config__] in stead of [check-config] as config table
35
39
  - BREAKING: use `check-config.toml` as default name
36
40
  - preserve formatting of toml files, including comments
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: check-config
3
- Version: 0.8.6
3
+ Version: 0.9.0a1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -39,14 +39,16 @@ Define your configuration requirements in simple TOML files, then let check-conf
39
39
 
40
40
  ```toml
41
41
  # Set your preferred editor
42
- ["~/.bashrc".lines_present]
43
- __lines__ = "export EDITOR=hx"
42
+ [[lines_present]]
43
+ file = "~/.bashrc"
44
+ lines = "export EDITOR=hx"
44
45
  ```
45
46
 
46
47
  ```toml
47
48
  # Ensure git signing is configured
48
- ["~/.gitconfig".lines_present]
49
- __lines__ = """
49
+ [[lines_present]]
50
+ file = "~/.gitconfig"
51
+ lines = """
50
52
  [gpg]
51
53
  format = ssh
52
54
  [commit]
@@ -101,8 +103,9 @@ Make a `check-config.toml` according your needs:
101
103
 
102
104
  ```toml
103
105
  # Set your preferred editor
104
- ["~/.bashrc".lines_present]
105
- __lines__ = "export EDITOR=hx"
106
+ [[lines_present]]
107
+ file = "~/.bashrc"
108
+ lines = "export EDITOR=hx"
106
109
  ```
107
110
 
108
111
  And use it:
@@ -12,14 +12,16 @@ Define your configuration requirements in simple TOML files, then let check-conf
12
12
 
13
13
  ```toml
14
14
  # Set your preferred editor
15
- ["~/.bashrc".lines_present]
16
- __lines__ = "export EDITOR=hx"
15
+ [[lines_present]]
16
+ file = "~/.bashrc"
17
+ lines = "export EDITOR=hx"
17
18
  ```
18
19
 
19
20
  ```toml
20
21
  # Ensure git signing is configured
21
- ["~/.gitconfig".lines_present]
22
- __lines__ = """
22
+ [[lines_present]]
23
+ file = "~/.gitconfig"
24
+ lines = """
23
25
  [gpg]
24
26
  format = ssh
25
27
  [commit]
@@ -74,8 +76,9 @@ Make a `check-config.toml` according your needs:
74
76
 
75
77
  ```toml
76
78
  # Set your preferred editor
77
- ["~/.bashrc".lines_present]
78
- __lines__ = "export EDITOR=hx"
79
+ [[lines_present]]
80
+ file = "~/.bashrc"
81
+ lines = "export EDITOR=hx"
79
82
  ```
80
83
 
81
84
  And use it:
@@ -1,13 +1,13 @@
1
1
  # Checkers
2
2
 
3
- Check Config uses `checkers` which define the desired state of the configuration files. There are several
3
+ `check-config` uses `checkers` which define the desired state of the configuration files. There are several
4
4
  checker types (and more to come):
5
5
 
6
- | name | description | fixable |
6
+ | checker type | description | fixable |
7
7
  |------|-------------|---------|
8
8
  | [file_absent](#file-absent) | the file must be absent | yes |
9
9
  | [file_present](#file-present) | the file must be present, indifferent the content | yes |
10
- | [file_regex_match](#file-regex-match) | the content of the file must match the regex expression | when placeholder is prsent |
10
+ | [file_regex_match](#file-regex-match) | the content of the file must match the regex expression | when placeholder is present |
11
11
  | [key_absent](#key-absent) | a specified key must be absent in a toml / yaml / json file | yes |
12
12
  | [key_value_present](#key-value-present) | a specified key with a specified value must be present in a toml / yaml / json file | yes |
13
13
  | [key_value_regex_match](#key-value-regex-match) | the value of a specified key must be match the specified regex in a toml / yaml / json file | no |
@@ -16,12 +16,12 @@ checker types (and more to come):
16
16
  | [lines_absent](#lines-absent) | the specified lines must be absent | yes |
17
17
  | [lines_present](#lines-present) | the specified lines must be present | yes |
18
18
 
19
- ## Checker.toml
19
+ ## check-config.toml
20
20
 
21
- The `check-config.toml` consist of an optional toplevel keys with configuration for check-config itself:
21
+ The `check-config.toml` is the default entrypoint to define all checkers and configure check-config:
22
22
 
23
23
  ```toml
24
- __include__ = [ # optional list of toml files with additional checks
24
+ include = [ # optional list of toml files with additional checks
25
25
  "/home/me/.checkers/check.toml", # absolute path
26
26
  "~/.checkers/check.toml", # relative to home dir of current user
27
27
  "check.toml", # relative to this parent toml, indifferent if it is a filesystem path or a webserver path
@@ -30,26 +30,35 @@ __include__ = [ # optional list of toml files with additional checks
30
30
  ]
31
31
  ```
32
32
 
33
+ Note: When using a path to a Python package to include checkers, the activated Python (virtual) environment will be used.
34
+
33
35
  And one or more checkers
34
36
 
35
37
  ```toml
36
- ["<file_path>".<checker_name>.<checker_keys>]
37
- key = "value"
38
+ [[<checker_name>]]
39
+ <checker object> = "<file_path>"
40
+ <checker specific key/values>
38
41
  ```
39
42
 
40
- The syntax is slightly different per check type. See the next sections for help about the checker definitions.
43
+ Note the double square brackets. We use an array of tables to define the checkers, so multiple
44
+ checkers of the same type may exist in the same toml file. If you use only one checker for
45
+ a certain type, you can also use single square brackets. However, to be consistent and
46
+ extensible, we advice to always use double brackets.
47
+
48
+ The syntax is slightly different per checker type. See the next sections for help about the checker definitions.
41
49
 
42
50
  You can use arrays of toml tables when when a check has to be done more than once, ie:
43
51
 
44
52
  ```toml
45
- [[".gitignore".lines_present]]
46
- __lines__ = "__pycache__"
53
+ [[lines_present]]
54
+ file = ".gitignore"
55
+ lines = "__pycache__"
47
56
 
48
- [[".gitignore".lines_present]]
49
- __lines__ = ".cache"
50
- ```
51
57
 
52
- When using a path to a Python package to include checkers, the activated Python (virtual) environment will be used.
58
+ [[lines_present]]
59
+ file = ".gitignore"
60
+ lines = ".cache"
61
+ ```
53
62
 
54
63
  ## Tags
55
64
 
@@ -57,9 +66,10 @@ All checkers can have a `__tags__` key to make it possible to exclude or include
57
66
  See [cli tags options](usage#Tags) for more information.
58
67
 
59
68
  ```toml
60
- [[".gitignore".lines_present]]
61
- __tags__ = ["linux"]
62
- __lines__ = ".cache"
69
+ [[lines_present]]
70
+ file = ".gitignore"
71
+ tags = ["linux"]
72
+ lines = ".cache"
63
73
  ```
64
74
 
65
75
  ## File Absent
@@ -69,7 +79,8 @@ __lines__ = ".cache"
69
79
  The next example will check that `test/absent_file` will be absent.
70
80
 
71
81
  ```toml
72
- ["test/absent_file".file_absent]
82
+ [[file_absent]]
83
+ file = "test/absent_file"
73
84
  ```
74
85
 
75
86
  ## File Present
@@ -80,67 +91,101 @@ The next example will check that `test/present_file` will be present. It will
80
91
  not check the contents.
81
92
 
82
93
  ```toml
83
- ["test/present_file".file_present]
94
+ [[file_present]]
95
+ file = "test/present_file"
84
96
  ```
85
97
 
86
98
  When the file does not exists, running with fix will create the file. At default an empty file
87
- will be created. When a placeholder is given, the created file will contain the placeholder as content.
99
+ will be created.
100
+
101
+ This checker type can handle any text file.
102
+
103
+ This checker can also check for:
104
+ - placeholder
105
+ - regex
106
+ - permissions
107
+
108
+ ### Placeholder
109
+
110
+ When a placeholder is given, the created file will contain the placeholder as content.
88
111
 
89
112
  ```toml
90
- ["test/present_file".file_present]
91
- __placeholder__ = "sample content"
113
+ [[file_present]]
114
+ file = "test/present_file"
115
+ placeholder = "sample content"
92
116
  ```
93
117
 
94
- ## Key Absent
118
+ ### Regex Match
95
119
 
96
- `key_absent` will check if the key is not present in the file.
97
-
98
- The next example will check that `test/present_file` has no key named `key`.
120
+ Checks whether the contents of the file matches the regex expression.
99
121
 
100
122
  ```toml
101
- ["test/present.toml".key_absent.key]
123
+ [[file_present]]
124
+ file = ".bashrc"
125
+ regex = 'export KEY=.*'
102
126
  ```
103
127
 
104
- The key can be nested. In the next case it is sufficient that `key` is not present.
105
- `super_key` may be present or absent.
128
+ Multiple regex can be given when the file.checker_type pair is an array, ie:
106
129
 
107
130
  ```toml
108
- ["test/present.toml".key_absent.super_key.key]
131
+ [[file_present]]
132
+ file = ".bashrc"
133
+ regex = 'export KEY=.*'
134
+
135
+ [[file_present]]
136
+ file = ".bashrc"
137
+ regex = 'export ANOTHER_KEY=.*'
109
138
  ```
110
139
 
111
- This checker type can handle different kind of [mapping file types](#mapping-file-types)
140
+ Note: specify the regex as a raw toml string (single quotes) to prevent escaping.
112
141
 
113
- ## File Regex Match
142
+ ### Permissions
114
143
 
115
- Checks whether the contents of the file matches the regex expression.
144
+ On Unix systems, you can check for the permissions:
116
145
 
117
146
  ```toml
118
- [".bashrc".file_regex_match]
119
- __regex__ = 'export KEY=.*'
147
+ [[file_present]]
148
+ file = ".bashrc"
149
+ permissions = "644"
120
150
  ```
121
151
 
122
- Multiple regex can be given when the file.checker_type pair is an array, ie:
152
+ The permissions need to be defined in the octal representation. See [chmod calculator](https://chmod-calculator.com/)
153
+ an explanation.
123
154
 
124
- ```toml
125
- [[".bashrc".file_regex_match]]
126
- __regex__ = 'export KEY=.*'
155
+ ### Combinations
156
+
157
+ These extra checks can also be combined in one definition:
127
158
 
128
- [[".bashrc".file_regex_match]]
129
- __regex__ = 'export ANOTHER_KEY=.*'
159
+ ```toml
160
+ [[file_present]]
161
+ file = ".bashrc"
162
+ regex = 'export KEY=.*'
163
+ placeholder = "export KEY=hi"
164
+ permissions = "644"
130
165
  ```
131
166
 
132
- When the file does not exists, running with fix will create the file if a `__placeholder__` value is given
133
- with that value as content. If no `__placeholder__` is given, no file is created.
167
+ ## Key Absent
168
+
169
+ `key_absent` will check if the key is not present in the file.
170
+
171
+ The next example will check that `test/present_file` has no key named `key_to_be_absent`.
134
172
 
135
173
  ```toml
136
- [".bashrc".file_regex_match]
137
- __regex__ = 'export KEY=.*'
138
- __placeholder__ = "export KEY=value"
174
+ [[key_absent]]
175
+ file = "test/present.toml"
176
+ key.key_to_be_absent = {}
139
177
  ```
140
178
 
141
- Note: specify the regex as a raw toml string (single quotes) to prevent escaping.
179
+ The key can be nested. In the next case it is sufficient that `key_to_be_absent` is not present.
180
+ `super_key` will not be removed if it contains also other keys.
142
181
 
143
- This checker type can handle any text file.
182
+ ```toml
183
+ [[key_absent]]
184
+ file = "test/present.toml"
185
+ key.super_key.key_to_be_absent = {}
186
+ ```
187
+
188
+ This checker type can handle different kind of [mapping file types](#mapping-file-types)
144
189
 
145
190
  ## Key Value Present
146
191
 
@@ -149,37 +194,44 @@ Keys may be nested. Intermediate keys has to have mappings as values. When inter
149
194
  are not present, they will be added.
150
195
 
151
196
  ```toml
152
- ["test/present.toml".key_value_present]
153
- key1 = 1
154
- key2 = "value"
197
+ [[key_value_present]]
198
+ file = "test/present.toml"
199
+ key.key_to_add = 1
200
+ key.key_to_add_also = "value"
155
201
  ```
156
202
 
157
203
  ```toml
158
- ["test/present.toml".key_value_present.super_key]
159
- key1 = 1
160
- key2 = "value"
204
+ [key_value_present.super_key]
205
+ file = "test/present.toml"
206
+ key.super_key.key_to_add = {"inline_table" = "is also possible"}
161
207
  ```
162
208
 
163
209
  This checker type can handle different kind of [mapping file types](#mapping-file-types)
164
210
 
165
211
  ## Entry Absent
166
212
 
167
- `entry_absent` will check that specified `__items__` are not present on the specified path.
213
+ `entry_absent` will check that all array items `entry.key<.key> = ["item"]` will be removed from the specified
214
+ file.
168
215
 
169
216
  ```toml
170
- ["test/present.toml".entry_absent.key]
171
- __items__ = [1, 2]
217
+ [[entry_absent]]
218
+ file = "test/present.toml"
219
+ key.list = [1, 2]
172
220
  ```
173
221
 
222
+ This checker type can handle different kind of [mapping file types](#mapping-file-types)
174
223
  ## Entry Present
175
224
 
176
- `entry_present` will check that specified `__items__` are not present on the specified path.
225
+ `entry_present` will check that all array items `entry.key<.key> = ["item"]` will be added to the specified
226
+ file, if they do not exists already.
177
227
 
178
228
  ```toml
179
- ["test/present.toml".entry_present.key]
180
- __items__ = [1, 2]
229
+ [[entry_present]]
230
+ file = "test/present.toml"
231
+ key.list = [1, 2]
181
232
  ```
182
233
 
234
+ This checker type can handle different kind of [mapping file types](#mapping-file-types)
183
235
  ## Key Value Regex Match
184
236
 
185
237
  `key_value_regex_match` will check that the keys specified are present and the value matches the specified regex.
@@ -188,13 +240,9 @@ Keys may be nested. Intermediate keys has to have mappings as values. When inter
188
240
  are not present, they will be added.
189
241
 
190
242
  ```toml
191
- ["test/present.toml".key_value_regex_match]
192
- key = 'v.*'
193
- ```
194
-
195
- ```toml
196
- ["test/present.toml".key_value_regex_match.super_key]
197
- key = '[0-9]*'
243
+ [[key_value_regex_match]]
244
+ file = "test/present.toml"
245
+ key.key = 'v.*'
198
246
  ```
199
247
 
200
248
  Note: specify the regex as a raw string (single quotes) to be prevent escaping.
@@ -206,22 +254,25 @@ This checker type can handle different kind of [mapping file types](#mapping-fil
206
254
  `lines_absent` will check that the file does not contain the lines as specified.
207
255
 
208
256
  ```toml
209
- ["test/present.txt".lines_absent]
210
- __lines__ = """\
257
+ [[lines_absent]]
258
+ file = "test/present.txt"
259
+ lines = """\
211
260
  multi
212
261
  line"""
213
262
  ```
214
263
 
215
264
  ```toml
216
- ["test/present.txt".lines_absent]
217
- __lines__ = """single line"""
265
+ [lines_absent]
266
+ file = "test/present.txt"
267
+ lines = """single line"""
218
268
  ```
219
269
 
220
270
  You can also remove text between markers which removes the markers also
221
271
 
222
272
  ```toml
223
- ["test/present.txt".lines_absent]
224
- __marker_ = "# marker""
273
+ [[lines_absent]]
274
+ file = "test/present.txt"
275
+ marker = "# marker""
225
276
  ```
226
277
 
227
278
  This will change the next text:
@@ -246,32 +297,36 @@ Bla
246
297
  `lines_present` will check that the file does contain the lines as specified.
247
298
 
248
299
  ```toml
249
- ["test/present.txt".lines_present]
250
- __lines__ = """\
300
+ [[lines_present]]
301
+ file = "test/present.txt"
302
+ lines = """\
251
303
  multi
252
304
  line"""
253
305
  ```
254
306
 
255
307
  ```toml
256
308
  ["test/present.txt".lines_present]
257
- __lines__ = """single line"""
309
+ file = "test/present.txt"
310
+ lines = """single line"""
258
311
  ```
259
312
 
260
313
  Optionnally it can replace strings by regex, ie if you want to replace an export with a new value:
261
314
 
262
315
  ```toml
263
- ["~/.bahsrc".lines_present]
264
- __lines__ = "export EDITOR=hx"
265
- __replacement_regex = "(?m)^export EDITOR=.*$"
316
+ [[lines_present]]
317
+ file = "~/.bashrc"
318
+ lines = "export EDITOR=hx"
319
+ replacement_regex = "(?m)^export EDITOR=.*$"
266
320
  ```
267
321
 
268
322
  Or you can use marker lines:
269
323
 
270
324
 
271
325
  ```toml
272
- ["~/.bahsrc".lines_present]
273
- __lines__ = "export EDITOR=hx"
274
- __marker = "# marker"
326
+ [[lines_present]]
327
+ file = "~/.bashrc"
328
+ lines = "export EDITOR=hx"
329
+ marker = "# marker"
275
330
  ```
276
331
 
277
332
  Which replaces text from
@@ -311,8 +366,8 @@ which contains mappings:
311
366
  The filetype will be determined by the extension. You can override this by specifying the filetype:
312
367
 
313
368
  ```toml
314
- ["test/present.toml".key_value_present]
315
- __filetype__ = "json"
316
- key1 = 1
317
- key2 = "value"
369
+ [[key_value_present]]
370
+ file = "test/present.toml"
371
+ file_type = "json"
372
+ key.key = 1
318
373
  ```
@@ -0,0 +1,32 @@
1
+ # Examples
2
+
3
+ ## Python
4
+
5
+ ```toml
6
+ {! ../example_checkers/python.toml!}
7
+ ```
8
+
9
+ ## Ruff
10
+
11
+ ```toml
12
+ {! ../example_checkers/ruff.toml!}
13
+ ```
14
+
15
+ ## Black
16
+
17
+ ```toml
18
+ {! ../example_checkers/black.toml!}
19
+ ```
20
+
21
+ ## Mypy
22
+
23
+ ```toml
24
+ {! ../example_checkers/mypy.toml!}
25
+ ```
26
+
27
+ ## Bashrc
28
+
29
+ ```toml
30
+ {! ../example_checkers/bash.toml!}
31
+ ```
32
+
@@ -0,0 +1,8 @@
1
+ # Glossary
2
+
3
+ | item | definition|
4
+ |------|-----------|
5
+ | checker type | A type of the check to be executed. Like `lines_present` |
6
+ | checker object | The object being checked, like a file |
7
+ | checker | A concrete instance of a check to be executed, like an `lines_present` for the object `~/.bashrc` |
8
+ | check | A concrete execution of a checker |
@@ -34,6 +34,7 @@ Run `check-config --fix` to apply changes, or `check-config` to verify everythin
34
34
  ### 🔧 **Shareable Configuration Snippets**
35
35
 
36
36
  Traditional dotfile repositories force users to adopt entire configuration files. check-config lets you share just the essential parts:
37
+
37
38
  - Share your preferred Python formatting rules without forcing your entire `pyproject.toml`
38
39
  - Distribute security settings without overwriting personal aliases
39
40
  - Collaborate on team standards while preserving individual preferences
@@ -55,6 +56,7 @@ Perfect for ensuring tools like Ruff, Black, and ESLint use consistent settings
55
56
  ### 📦 **Composable Configuration**
56
57
 
57
58
  Combine multiple configuration files to build your complete setup:
59
+
58
60
  - Base configurations for your team
59
61
  - Personal tweaks and preferences
60
62
  - Project-specific requirements
@@ -63,6 +65,7 @@ Combine multiple configuration files to build your complete setup:
63
65
  ## Beyond Simple Lines
64
66
 
65
67
  check-config supports multiple checker types for different configuration needs:
68
+
66
69
  - **Lines present/absent**: Shell configs, text files
67
70
  - **Key-value pairs**: TOML, JSON, YAML files
68
71
  - **File existence**: Ensure critical files exist
@@ -127,7 +127,6 @@ check-config --any-tags tag1,tag2 --all-tags tag3,tag4 --skip-tags tag5,tag6
127
127
  This invocation call checkers which has one of [tag1, tag2], all of [tag3, tag4] and not one of [tag5, tag6]
128
128
  specified in their `__tags__` key.
129
129
 
130
-
131
130
  ## Pre-commit
132
131
 
133
132
  [pre-commit](https://pre-commit.com/) helps checking your code before committing git, so you can catch errors
@@ -139,7 +138,7 @@ you want to use:
139
138
  ```yaml
140
139
  repos:
141
140
  - repo: https://github.com/mrijken/check-config
142
- rev: v0.8.6
141
+ rev: v0.9.0.alpha.1
143
142
  hooks:
144
143
  # Install via Cargo and execute `check-config --fix`
145
144
  - id: check_config_fix_install_via_rust
@@ -0,0 +1,22 @@
1
+ [[lines_present]]
2
+ file = "~/.bashrc"
3
+ lines = "export SHELL=/bin/bash"
4
+
5
+ [[lines_present]]
6
+ file = "~/.bashrc"
7
+ lines = "export EDITOR=hx"
8
+
9
+
10
+ [[key_value_present]]
11
+ file = "test.json"
12
+ key1.key2.key3="value"
13
+
14
+
15
+ [[key_value_present]]
16
+ file = "test.toml"
17
+ inline_table.key="value"
18
+
19
+
20
+ [[key_value_present.table]]
21
+ file = "test.toml"
22
+ key="value"