pre-commit-bigfix 2.1.0__tar.gz → 2.1.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 (44) hide show
  1. {pre_commit_bigfix-2.1.0/pre_commit_bigfix.egg-info → pre_commit_bigfix-2.1.1}/PKG-INFO +3 -2
  2. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/README.md +2 -1
  3. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/__init__.py +1 -1
  4. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/run_all.py +15 -7
  5. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1/pre_commit_bigfix.egg-info}/PKG-INFO +3 -2
  6. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_run_all.py +27 -4
  7. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/LICENSE +0 -0
  8. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/MANIFEST.in +0 -0
  9. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_actionscript_lint_schclass.py +0 -0
  10. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_actionscript_validate_prefetch.py +0 -0
  11. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_actionscript_validate_script.py +0 -0
  12. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_common.py +0 -0
  13. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_conventions_check.py +0 -0
  14. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_relevance_convert_group.py +0 -0
  15. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_relevance_lint.py +0 -0
  16. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_schema_validate.py +0 -0
  17. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/bes_siterepo_validate_layout.py +0 -0
  18. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/schclass.py +0 -0
  19. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/schclass_data/ExpandedActionScript.schclass +0 -0
  20. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/schclass_data/bigfix_overrides.schclass +0 -0
  21. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix/schclass_tokenizer.py +0 -0
  22. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix.egg-info/SOURCES.txt +0 -0
  23. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix.egg-info/dependency_links.txt +0 -0
  24. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix.egg-info/entry_points.txt +0 -0
  25. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix.egg-info/requires.txt +0 -0
  26. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pre_commit_bigfix.egg-info/top_level.txt +0 -0
  27. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/pyproject.toml +0 -0
  28. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/setup.cfg +0 -0
  29. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/setup.py +0 -0
  30. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_actionscript_lint_schclass.py +0 -0
  31. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_actionscript_validate_prefetch.py +0 -0
  32. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_actionscript_validate_script.py +0 -0
  33. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_common.py +0 -0
  34. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_conventions_check.py +0 -0
  35. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_relevance_convert_group.py +0 -0
  36. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_relevance_lint.py +0 -0
  37. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_schema_validate.py +0 -0
  38. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_bes_siterepo_validate_layout.py +0 -0
  39. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_hook_declarations.py +0 -0
  40. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_package_metadata.py +0 -0
  41. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_release_workflow.py +0 -0
  42. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_schclass.py +0 -0
  43. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_schclass_tokenizer.py +0 -0
  44. {pre_commit_bigfix-2.1.0 → pre_commit_bigfix-2.1.1}/tests/test_schema_guard.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pre-commit-bigfix
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: pre-commit hooks for BigFix content
5
5
  Home-page: https://github.com/jgstew/pre-commit-bigfix
6
6
  Author: JGStew
@@ -96,7 +96,8 @@ line per hook is printed at the end. The exit code is 1 if any hook fails, and
96
96
  `OtherFiles` folder at its top (names compared ignoring case).
97
97
  - A hook with more than 20 results is summarized instead of listed: a count
98
98
  per code, and the files with the most results. The summary table at the end
99
- shows each hook's result count.
99
+ shows each hook's result count. If anything was summarized and no log file
100
+ is being written, the last line says to run again with `--log-file`.
100
101
  - `--log-file [FILE]` writes every hook's full output to FILE (default
101
102
  `pre-commit-bigfix-results.log`), replacing it if it exists. This is the
102
103
  only file the command writes, and it will not replace a given path or a
@@ -64,7 +64,8 @@ line per hook is printed at the end. The exit code is 1 if any hook fails, and
64
64
  `OtherFiles` folder at its top (names compared ignoring case).
65
65
  - A hook with more than 20 results is summarized instead of listed: a count
66
66
  per code, and the files with the most results. The summary table at the end
67
- shows each hook's result count.
67
+ shows each hook's result count. If anything was summarized and no log file
68
+ is being written, the last line says to run again with `--log-file`.
68
69
  - `--log-file [FILE]` writes every hook's full output to FILE (default
69
70
  `pre-commit-bigfix-results.log`), replacing it if it exists. This is the
70
71
  only file the command writes, and it will not replace a given path or a
@@ -1,3 +1,3 @@
1
1
  """To support running this directly as a python module."""
2
2
 
3
- __version__ = "2.1.0"
3
+ __version__ = "2.1.1"
@@ -28,7 +28,8 @@ OtherFiles folder at its top (names compared ignoring case).
28
28
 
29
29
  A hook that reports more than 20 results (`path:line: message` or
30
30
  `path: message` lines) has them summarized, counted by code and by file,
31
- instead of listed. --log-file writes the full output of every hook to FILE
31
+ instead of listed; with no --log-file, the last line of the run then says
32
+ how to get them all. --log-file writes the full output of every hook to FILE
32
33
  (default pre-commit-bigfix-results.log), replacing it if it exists; that is
33
34
  the only file this command writes. It will not replace a PATH or a file some
34
35
  hook checks. Give PATHs before --log-file, or use --log-file=FILE, so a PATH
@@ -132,6 +133,11 @@ SUMMARY_OVER = 20
132
133
  # files and folders listed in the summary, most results first
133
134
  SUMMARY_TOP_FILES = 5
134
135
  DEFAULT_LOG_FILE = "pre-commit-bigfix-results.log"
136
+ # the last line of a run that summarized something and wrote no log
137
+ RERUN_HINT = (
138
+ f"Run again with --log-file to write all of them to {DEFAULT_LOG_FILE}"
139
+ " (or --log-file=FILE)."
140
+ )
135
141
 
136
142
  # one result line: `path:line: message`, maybe `[CODE] ` first; a Windows
137
143
  # drive letter (C:\...) does not end the path, as `:\d+: ` must follow it
@@ -292,11 +298,7 @@ def summarize(results, other, log_path):
292
298
  lines += other
293
299
  if log_path:
294
300
  lines.append(f"All of them are in {log_path}.")
295
- else:
296
- lines.append(
297
- "Run again with --log-file to write all of them to"
298
- f" {DEFAULT_LOG_FILE} (or --log-file=FILE)."
299
- )
301
+ # with no log, main() prints RERUN_HINT once, at the very end
300
302
  return "\n".join(lines) + "\n"
301
303
 
302
304
 
@@ -330,6 +332,7 @@ class Report:
330
332
  def __init__(self, log=None, log_path=None):
331
333
  self.log = log
332
334
  self.log_path = log_path
335
+ self.summarized = False # some hook's output was summarized
333
336
 
334
337
  def show(self, text):
335
338
  """Write `text` to stdout only."""
@@ -398,6 +401,7 @@ class Report:
398
401
  if len(folders) > 1:
399
402
  self.show(f"=== {hook.id} ({', '.join(folders)})\n")
400
403
  self.show(summarize(results, other, self.log_path))
404
+ self.summarized = True
401
405
  else:
402
406
  for header, text in zip(headers, texts):
403
407
  self.show(text if len(folders) == 1 else header + text)
@@ -505,7 +509,11 @@ def main(argv=None):
505
509
  roots = repo_roots(args.paths)
506
510
 
507
511
  if not args.log_file:
508
- return _run_all(args, files, roots, Report())
512
+ report = Report()
513
+ code = _run_all(args, files, roots, report)
514
+ if report.summarized:
515
+ print(f"\n{RERUN_HINT}")
516
+ return code
509
517
  if _would_replace_input(args.log_file, args.paths):
510
518
  print(
511
519
  f"pre-commit-bigfix: --log-file {args.log_file} is a file to check,"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pre-commit-bigfix
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: pre-commit hooks for BigFix content
5
5
  Home-page: https://github.com/jgstew/pre-commit-bigfix
6
6
  Author: JGStew
@@ -96,7 +96,8 @@ line per hook is printed at the end. The exit code is 1 if any hook fails, and
96
96
  `OtherFiles` folder at its top (names compared ignoring case).
97
97
  - A hook with more than 20 results is summarized instead of listed: a count
98
98
  per code, and the files with the most results. The summary table at the end
99
- shows each hook's result count.
99
+ shows each hook's result count. If anything was summarized and no log file
100
+ is being written, the last line says to run again with `--log-file`.
100
101
  - `--log-file [FILE]` writes every hook's full output to FILE (default
101
102
  `pre-commit-bigfix-results.log`), replacing it if it exists. This is the
102
103
  only file the command writes, and it will not replace a given path or a
@@ -475,16 +475,39 @@ def test_more_than_20_results_are_summarized(tmp_path, monkeypatch, capsys):
475
475
  write_invalid_files(tmp_path, 21)
476
476
  monkeypatch.chdir(tmp_path)
477
477
  assert run_all.main([]) == 1
478
- out = section(capsys.readouterr().out, "bes-schema-validate")
478
+ full = capsys.readouterr().out
479
+ out = section(full, "bes-schema-validate")
479
480
  assert "invalid00.bes:3:" not in out
480
481
  assert "21 results in 21 file(s)" in out
481
482
  assert "(no code) 21" in out
482
- # with no log file, it says how to get every result
483
- assert "Run again with --log-file" in out
484
- assert run_all.DEFAULT_LOG_FILE in out
483
+ assert "Run again" not in out # the hint is at the end, not per hook
485
484
  assert not (tmp_path / run_all.DEFAULT_LOG_FILE).exists()
486
485
 
487
486
 
487
+ def test_rerun_hint_is_the_last_line_once(tmp_path, monkeypatch, capsys):
488
+ """With no log file, one hint after the table, a blank line above it."""
489
+ write_invalid_files(tmp_path, 21) # schema and conventions both summarized
490
+ monkeypatch.chdir(tmp_path)
491
+ assert run_all.main([]) == 1
492
+ out = capsys.readouterr().out
493
+ assert out.count("Run again with --log-file") == 1
494
+ lines = out.splitlines()
495
+ assert lines[-1].startswith("Run again with --log-file")
496
+ assert run_all.DEFAULT_LOG_FILE in lines[-1]
497
+ assert lines[-2] == ""
498
+ assert re.match(r"bes-siterepo-validate-layout \.+ ", lines[-3])
499
+
500
+
501
+ def test_no_rerun_hint_when_nothing_is_summarized(tmp_path, monkeypatch, capsys):
502
+ write_invalid_files(tmp_path, 20)
503
+ monkeypatch.chdir(tmp_path)
504
+ assert run_all.main([]) == 1
505
+ out = capsys.readouterr().out
506
+ assert "Run again" not in out
507
+ assert "--log-file" not in out
508
+ assert re.match(r"bes-siterepo-validate-layout \.+ ", out.splitlines()[-1])
509
+
510
+
488
511
  def test_summary_counts_by_code(tmp_path, monkeypatch, capsys):
489
512
  write_invalid_files(tmp_path, 21)
490
513
  monkeypatch.chdir(tmp_path)