commit-check 2.2.2__py3-none-any.whl → 2.3.0__py3-none-any.whl

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.
commit_check/config.py CHANGED
@@ -15,6 +15,8 @@ except ImportError:
15
15
  DEFAULT_CONFIG_PATHS = [
16
16
  Path("cchk.toml"),
17
17
  Path("commit-check.toml"),
18
+ Path(".github/cchk.toml"),
19
+ Path(".github/commit-check.toml"),
18
20
  ]
19
21
 
20
22
 
commit_check/main.py CHANGED
@@ -43,7 +43,7 @@ def _get_parser() -> argparse.ArgumentParser:
43
43
  parser.add_argument(
44
44
  "-c",
45
45
  "--config",
46
- help="path to config file (cchk.toml or commit-check.toml). If not specified, searches for cchk.toml in current directory",
46
+ help="path to config file (cchk.toml or commit-check.toml). If not specified, searches for config in: cchk.toml, commit-check.toml, .github/cchk.toml, .github/commit-check.toml",
47
47
  )
48
48
 
49
49
  parser.add_argument(
commit_check/util.py CHANGED
@@ -24,7 +24,7 @@ except Exception: # pragma: no cover
24
24
  _toml = None # type: ignore[assignment]
25
25
 
26
26
 
27
- def _find_check(checks: list, check_type: str) -> dict | None:
27
+ def _find_check(checks: list, check_type: str) -> Optional[dict]:
28
28
  """Return the first check dict matching check_type, else None."""
29
29
  for check in checks:
30
30
  if check.get("check") == check_type:
@@ -164,13 +164,18 @@ def _load_toml(path: PurePath) -> Dict[str, Any]:
164
164
  def _find_config_file(path_hint: str) -> Optional[PurePath]:
165
165
  """Resolve config file.
166
166
 
167
- - If a directory is passed, search in priority: commit-check.toml, cchk.toml
167
+ - If a directory is passed, search in priority: cchk.toml, commit-check.toml, .github/cchk.toml, .github/commit-check.toml
168
168
  - If a file ending with .toml is passed, use it if exists.
169
169
  - Ignore legacy .commit-check.yml entirely.
170
170
  """
171
171
  p = Path(path_hint)
172
172
  if p.is_dir():
173
- for name in ("commit-check.toml", "cchk.toml"):
173
+ for name in (
174
+ "cchk.toml",
175
+ "commit-check.toml",
176
+ ".github/cchk.toml",
177
+ ".github/commit-check.toml",
178
+ ):
174
179
  candidate = p / name
175
180
  if candidate.exists():
176
181
  return candidate
@@ -254,7 +259,7 @@ def print_error_message(check_type: str, regex: str, error: str, reason: str):
254
259
  print(error)
255
260
 
256
261
 
257
- def print_suggestion(suggest: str | None) -> None:
262
+ def print_suggestion(suggest: Optional[str]) -> None:
258
263
  """Print suggestion to user
259
264
  :param suggest: what message to print out
260
265
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commit-check
3
- Version: 2.2.2
3
+ Version: 2.3.0
4
4
  Summary: Check commit message formatting, branch naming, commit author, email, and more.
5
5
  Author-email: Xianpeng Shen <xianpeng.shen@gmail.com>
6
6
  License-Expression: MIT
@@ -121,7 +121,7 @@ Use Default Configuration
121
121
  Use Custom Configuration
122
122
  ~~~~~~~~~~~~~~~~~~~~~~~~
123
123
 
124
- To customize the behavior, create a configuration file named ``cchk.toml`` or ``commit-check.toml`` in your repository's root directory, e.g., `cchk.toml <https://github.com/commit-check/commit-check/blob/main/cchk.toml>`_
124
+ To customize the behavior, create a configuration file named ``cchk.toml`` or ``commit-check.toml`` in your repository's root directory or in the ``.github`` folder, e.g., `cchk.toml <https://github.com/commit-check/commit-check/blob/main/cchk.toml>`_ or ``.github/cchk.toml``.
125
125
 
126
126
  Usage
127
127
  -----
@@ -0,0 +1,14 @@
1
+ commit_check/__init__.py,sha256=6bUw-6fUjCN5qAxe6i4mUztQiAHpjOhyPHsegW1tbBc,1297
2
+ commit_check/config.py,sha256=88zOLW6W2DHQjglxfSR3LQhCXgw-QcfEg118-OaWxIg,1031
3
+ commit_check/engine.py,sha256=O9H39JgqrzWclfVTZYf-tJP8lAhHzGfV7j-CIxAsXWA,19348
4
+ commit_check/imperatives.py,sha256=b_olcxhoHW2LMHaO9COVlVUdLE-7uifo9WeSY7rPql4,3582
5
+ commit_check/main.py,sha256=SSQfN5p5AQoG0G_AFXA2wAoTcOJK8N8m8_gj8hkH-OI,7040
6
+ commit_check/rule_builder.py,sha256=0UqMQxDiPNgqEjmRTYnyHimCA7vZRZqgqdm7ughp3DY,9205
7
+ commit_check/rules_catalog.py,sha256=FSRsdecwfUteEp3J8lnfehLu4j6owZlWfDzPa1ar1Fg,4288
8
+ commit_check/util.py,sha256=4c9cxbBR3ZBSmYGNmzj87XWWr0zsCV8tmg1Z1yZ3iBI,8501
9
+ commit_check-2.3.0.dist-info/licenses/LICENSE,sha256=VAJ9TE1ov8aUKmeoBRYqciMs0CXag1TeDCoLhwbeQmA,1095
10
+ commit_check-2.3.0.dist-info/METADATA,sha256=TlR6GZ1noth7Nx-brsfWEs9bSur2rRiu4GaE5N2zle4,9540
11
+ commit_check-2.3.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
+ commit_check-2.3.0.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
13
+ commit_check-2.3.0.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
14
+ commit_check-2.3.0.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- commit_check/__init__.py,sha256=6bUw-6fUjCN5qAxe6i4mUztQiAHpjOhyPHsegW1tbBc,1297
2
- commit_check/config.py,sha256=1Th_57ekaYorJFLpSjZq-HW5U5iuVGYWBBAUj8kp9pI,961
3
- commit_check/engine.py,sha256=O9H39JgqrzWclfVTZYf-tJP8lAhHzGfV7j-CIxAsXWA,19348
4
- commit_check/imperatives.py,sha256=b_olcxhoHW2LMHaO9COVlVUdLE-7uifo9WeSY7rPql4,3582
5
- commit_check/main.py,sha256=-leaum2NqejOixOWNtUnuxEfNcxP_gVQyZRUr8gh8jE,6985
6
- commit_check/rule_builder.py,sha256=0UqMQxDiPNgqEjmRTYnyHimCA7vZRZqgqdm7ughp3DY,9205
7
- commit_check/rules_catalog.py,sha256=FSRsdecwfUteEp3J8lnfehLu4j6owZlWfDzPa1ar1Fg,4288
8
- commit_check/util.py,sha256=bvB4w0jSdgot5eOThmn9iV1IwKjBX_B8hB2T9hhrskQ,8340
9
- commit_check-2.2.2.dist-info/licenses/LICENSE,sha256=VAJ9TE1ov8aUKmeoBRYqciMs0CXag1TeDCoLhwbeQmA,1095
10
- commit_check-2.2.2.dist-info/METADATA,sha256=o4qUeKoPNUCGae1ewzvKSjRwyZvuUDMIyoL9ku6vTEQ,9485
11
- commit_check-2.2.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
- commit_check-2.2.2.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
13
- commit_check-2.2.2.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
14
- commit_check-2.2.2.dist-info/RECORD,,