pre-commit-bigfix 2.3.0__tar.gz → 2.4.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 (46) hide show
  1. {pre_commit_bigfix-2.3.0/pre_commit_bigfix.egg-info → pre_commit_bigfix-2.4.0}/PKG-INFO +62 -8
  2. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/README.md +61 -7
  3. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/__init__.py +1 -1
  4. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_siterepo_validate_layout.py +379 -33
  5. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0/pre_commit_bigfix.egg-info}/PKG-INFO +62 -8
  6. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_siterepo_validate_layout.py +446 -0
  7. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/LICENSE +0 -0
  8. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/MANIFEST.in +0 -0
  9. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_actionscript_lint_schclass.py +0 -0
  10. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_actionscript_validate_prefetch.py +0 -0
  11. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_actionscript_validate_script.py +0 -0
  12. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_common.py +0 -0
  13. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_content_score_risk.py +0 -0
  14. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_conventions_check.py +0 -0
  15. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_relevance_convert_group.py +0 -0
  16. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_relevance_lint.py +0 -0
  17. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/bes_schema_validate.py +0 -0
  18. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/run_all.py +0 -0
  19. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/schclass.py +0 -0
  20. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/schclass_data/ExpandedActionScript.schclass +0 -0
  21. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/schclass_data/bigfix_overrides.schclass +0 -0
  22. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix/schclass_tokenizer.py +0 -0
  23. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix.egg-info/SOURCES.txt +0 -0
  24. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix.egg-info/dependency_links.txt +0 -0
  25. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix.egg-info/entry_points.txt +0 -0
  26. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix.egg-info/requires.txt +0 -0
  27. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pre_commit_bigfix.egg-info/top_level.txt +0 -0
  28. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/pyproject.toml +0 -0
  29. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/setup.cfg +0 -0
  30. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/setup.py +0 -0
  31. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_actionscript_lint_schclass.py +0 -0
  32. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_actionscript_validate_prefetch.py +0 -0
  33. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_actionscript_validate_script.py +0 -0
  34. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_common.py +0 -0
  35. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_content_score_risk.py +0 -0
  36. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_conventions_check.py +0 -0
  37. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_relevance_convert_group.py +0 -0
  38. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_relevance_lint.py +0 -0
  39. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_bes_schema_validate.py +0 -0
  40. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_hook_declarations.py +0 -0
  41. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_package_metadata.py +0 -0
  42. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_release_workflow.py +0 -0
  43. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_run_all.py +0 -0
  44. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_schclass.py +0 -0
  45. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/tests/test_schclass_tokenizer.py +0 -0
  46. {pre_commit_bigfix-2.3.0 → pre_commit_bigfix-2.4.0}/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.3.0
3
+ Version: 2.4.0
4
4
  Summary: pre-commit hooks for BigFix content
5
5
  Home-page: https://github.com/jgstew/pre-commit-bigfix
6
6
  Author: JGStew
@@ -837,13 +837,14 @@ warning (`W808`), since RHEL is case-sensitive.
837
837
  | --- | --- |
838
838
  | `E800` | a `.bes` file in the `.bes` folder whose name does not start with a numeric ID and a space or hyphen; `42- Name.bes` and `42 Name.bes` both work |
839
839
  | `E801` | two or more `.bes` files in one site share an ID, compared as integers, so `0042` and `42` collide; each names the others |
840
- | `E802` | a `.bes` file's server path is too long and the rename cannot fix it: even `<ID> X.bes` is too long (the folders are), it has no ID, or `E805` is disabled. Renaming a folder changes its `.fxf` or digest, so that is left to you |
840
+ | `E802` | a `.bes` file's server path is too long and the rename cannot fix it: even `<ID> X.bes` is too long (the folders are), it has no ID (and `E809` gives it none), or `E805` is disabled. Renaming a folder changes its `.fxf` or digest, so that is left to you |
841
841
  | `E803` | fix: zero padding in the ID (`0042- X.bes` -> `42- X.bes`); done even when the ID is a duplicate (`E801`), since the ID does not change |
842
842
  | `E804` | fix: non-ASCII characters in the name, folded to ASCII |
843
843
  | `E805` | fix: the server path is too long, or the name is over 255 bytes, so the file is renamed `<ID> <Title>.bes` |
844
- | `E806` | a rename was skipped: the new name is taken (ignoring case), the file has unstaged changes pre-commit set aside, the commit uses a temporary index (`git commit -a`, `git commit <paths>`), or the rename failed |
844
+ | `E806` | a rename was skipped: the new name is taken (ignoring case), the file has unstaged changes pre-commit set aside, the commit uses a temporary index (`git commit -a`, `git commit <paths>`), the rename failed, or `E809` could not choose an ID safely (shallow clone, unknown base branch) |
845
845
  | `E807` | another tracked file's server path is too long, inside the site roots or not (the server clones the whole repo). It is not renamed, since actions may refer to it by name |
846
846
  | `E808` | a file or folder name over 255 bytes in UTF-8 (Linux `NAME_MAX`) that the rename cannot fix; each folder once |
847
+ | `E809` | fix: a file with no ID (`E800`), or a duplicate (`E801`) that is not the one keeping the ID, gets a new ID no file in git history has used; see **New IDs** |
847
848
  | `W800` | a `.bes` file outside the `.bes` folder; the server does not gather it |
848
849
  | `W801` | a `.bes` file directly in the `.bes` folder, or deeper than `<BesFileDir>/<fxf>/<digest>/` (how the server handles either is undocumented) |
849
850
  | `W802` | a file in the `.bes` folder other than `.bes` or `digest.xml`; an `.xsd` too, since `bes-schema-validate` already has the schemas |
@@ -877,6 +878,8 @@ count in full. The options:
877
878
  | `--repo-name` | the last part of the `origin` remote URL without `.git`, or the repo folder's name |
878
879
  | `--branch` | `main` |
879
880
  | `--max-path` | `259` |
881
+ | `--base-ref` | `PRE_COMMIT_FROM_REF`, else `origin/$GITHUB_BASE_REF`, else `HEAD` (see **New IDs**) |
882
+ | `--min-id` | `1` (see **New IDs**) |
880
883
 
881
884
  **Renames.** By default each `.bes` file in the `.bes` folder is renamed at
882
885
  most once, combining the fixes it needs: zero padding stripped from the ID
@@ -887,7 +890,7 @@ cut to fit both limits (`E805`). The title comes from the file's `<Title>`,
887
890
  or from its current name if the title has no letter or digit; it is made
888
891
  ASCII and safe on Windows, cut short, and any trailing space, dot or hyphen
889
892
  is dropped. A name that already fits is left alone, even when it differs
890
- from the title. The ID never changes and no file moves between folders.
893
+ from the title. Only `E809` changes an ID, and no file moves between folders.
891
894
 
892
895
  Tracked files are renamed with `git mv`, so the renames are staged and the
893
896
  next commit carries them whole; a plain rename would leave an unstaged
@@ -907,10 +910,61 @@ renamed (`E806`) where the rename would be lost:
907
910
  Any rename makes the hook exit 1, so review the renames and commit again.
908
911
  `--check` is a dry run that reports what would be renamed.
909
912
 
910
- Files with no ID are reported (`E800`), not given one. An opt-in
911
- `--assign-ids` is deferred: choosing IDs is a policy decision, best backed
912
- by a counter file as CommunityContent does, since taking the highest ID plus
913
- one could reuse a deleted item's ID.
913
+ **New IDs (`E809`).** A file with no ID, or a duplicate ID, gets a new one
914
+ in the same rename, which also applies `E804` and `E805`:
915
+
916
+ - No ID: `Name.bes` becomes `<ID> Name.bes`. The server never gathered it,
917
+ so nothing deployed refers to it.
918
+ - Duplicate ID: the one file on the base branch keeps the ID, and the others
919
+ get new ones (`42- X.bes` -> `1043- X.bes`). Renumbering only new content
920
+ keeps actions and baselines that refer to the old ID working. A file
921
+ renamed from one on the base branch counts as on it, as `git diff -M`
922
+ pairs them. When every file in the group is new, the first by path keeps
923
+ the ID. Nothing is renumbered, and `E806` says why, when two or more are
924
+ already on the base branch (which one keeps the ID is for a person to
925
+ decide), or when the ID is on the base branch but git sees no file here as
926
+ that file renamed (it may be one, changed too much to pair).
927
+ - The new ID is one more than the highest ID any `.bes` path has had in git
928
+ history (`git log --all --full-history -m`: every branch and tag, both
929
+ sides of every merge, every site in the repo) or has now, so it never
930
+ reuses the ID of a deleted or renamed file. It sees only the branches and
931
+ tags this clone has fetched: fetch first. Gaps are never filled. For a site whose older IDs predate the git
932
+ repo, set a floor with `--min-id`.
933
+ - The base branch is the first of `--base-ref`, `PRE_COMMIT_FROM_REF` (set by `pre-commit run --from-ref`)
934
+ and `origin/$GITHUB_BASE_REF` (set in a GitHub `pull_request` run) that is
935
+ a commit in the clone. Without any, it is `HEAD`: in a local commit, the
936
+ staged files are the new ones. Once both files of a duplicate are
937
+ committed on a feature branch, `HEAD` sees neither as new: run with
938
+ `--base-ref origin/main` (or the branch it merges into), as `E806` says.
939
+ - In a shallow clone, git history is incomplete, so no ID is assigned
940
+ (`E806`); likewise for duplicates when `--base-ref` is not a commit.
941
+ - `--disable E809` reports `E800` and `E801` only, as before. Disabling
942
+ `E800` or `E801` also stops `E809` for those files.
943
+
944
+ In GitHub Actions, check out the full history (the default is one commit),
945
+ and give pre-commit the PR's base so that it knows which files are new:
946
+
947
+ ```yaml
948
+ - uses: actions/checkout@v7
949
+ with:
950
+ fetch-depth: 0
951
+ - uses: pre-commit/action@v3.0.1
952
+ with:
953
+ extra_args: >-
954
+ --from-ref ${{ github.event.pull_request.base.sha }}
955
+ --to-ref ${{ github.event.pull_request.head.sha }}
956
+ ```
957
+
958
+ The hook renames the files on the runner and fails, and the log names each
959
+ new file name, for the author to apply (or run the hook locally with
960
+ `--base-ref` naming the PR's base branch). To commit
961
+ the fix back to a PR branch instead, check out `github.head_ref` with
962
+ `contents: write`, then commit and push any change. Fork PRs cannot be
963
+ pushed to, and a push with `GITHUB_TOKEN` starts no new workflow run. Two
964
+ open PRs can choose the same ID; the one merged second then has a duplicate
965
+ on the base branch and is renumbered when it runs again, so require branches
966
+ to be up to date before merging. A site that assigns IDs after merge from a
967
+ counter file, as CommunityContent does, should use `--disable E809`.
914
968
 
915
969
  Not checked here: more than one object in a `.bes` file, or Baselines
916
970
  (repository sites are thought to handle both); schemas, GroupRelevance and
@@ -805,13 +805,14 @@ warning (`W808`), since RHEL is case-sensitive.
805
805
  | --- | --- |
806
806
  | `E800` | a `.bes` file in the `.bes` folder whose name does not start with a numeric ID and a space or hyphen; `42- Name.bes` and `42 Name.bes` both work |
807
807
  | `E801` | two or more `.bes` files in one site share an ID, compared as integers, so `0042` and `42` collide; each names the others |
808
- | `E802` | a `.bes` file's server path is too long and the rename cannot fix it: even `<ID> X.bes` is too long (the folders are), it has no ID, or `E805` is disabled. Renaming a folder changes its `.fxf` or digest, so that is left to you |
808
+ | `E802` | a `.bes` file's server path is too long and the rename cannot fix it: even `<ID> X.bes` is too long (the folders are), it has no ID (and `E809` gives it none), or `E805` is disabled. Renaming a folder changes its `.fxf` or digest, so that is left to you |
809
809
  | `E803` | fix: zero padding in the ID (`0042- X.bes` -> `42- X.bes`); done even when the ID is a duplicate (`E801`), since the ID does not change |
810
810
  | `E804` | fix: non-ASCII characters in the name, folded to ASCII |
811
811
  | `E805` | fix: the server path is too long, or the name is over 255 bytes, so the file is renamed `<ID> <Title>.bes` |
812
- | `E806` | a rename was skipped: the new name is taken (ignoring case), the file has unstaged changes pre-commit set aside, the commit uses a temporary index (`git commit -a`, `git commit <paths>`), or the rename failed |
812
+ | `E806` | a rename was skipped: the new name is taken (ignoring case), the file has unstaged changes pre-commit set aside, the commit uses a temporary index (`git commit -a`, `git commit <paths>`), the rename failed, or `E809` could not choose an ID safely (shallow clone, unknown base branch) |
813
813
  | `E807` | another tracked file's server path is too long, inside the site roots or not (the server clones the whole repo). It is not renamed, since actions may refer to it by name |
814
814
  | `E808` | a file or folder name over 255 bytes in UTF-8 (Linux `NAME_MAX`) that the rename cannot fix; each folder once |
815
+ | `E809` | fix: a file with no ID (`E800`), or a duplicate (`E801`) that is not the one keeping the ID, gets a new ID no file in git history has used; see **New IDs** |
815
816
  | `W800` | a `.bes` file outside the `.bes` folder; the server does not gather it |
816
817
  | `W801` | a `.bes` file directly in the `.bes` folder, or deeper than `<BesFileDir>/<fxf>/<digest>/` (how the server handles either is undocumented) |
817
818
  | `W802` | a file in the `.bes` folder other than `.bes` or `digest.xml`; an `.xsd` too, since `bes-schema-validate` already has the schemas |
@@ -845,6 +846,8 @@ count in full. The options:
845
846
  | `--repo-name` | the last part of the `origin` remote URL without `.git`, or the repo folder's name |
846
847
  | `--branch` | `main` |
847
848
  | `--max-path` | `259` |
849
+ | `--base-ref` | `PRE_COMMIT_FROM_REF`, else `origin/$GITHUB_BASE_REF`, else `HEAD` (see **New IDs**) |
850
+ | `--min-id` | `1` (see **New IDs**) |
848
851
 
849
852
  **Renames.** By default each `.bes` file in the `.bes` folder is renamed at
850
853
  most once, combining the fixes it needs: zero padding stripped from the ID
@@ -855,7 +858,7 @@ cut to fit both limits (`E805`). The title comes from the file's `<Title>`,
855
858
  or from its current name if the title has no letter or digit; it is made
856
859
  ASCII and safe on Windows, cut short, and any trailing space, dot or hyphen
857
860
  is dropped. A name that already fits is left alone, even when it differs
858
- from the title. The ID never changes and no file moves between folders.
861
+ from the title. Only `E809` changes an ID, and no file moves between folders.
859
862
 
860
863
  Tracked files are renamed with `git mv`, so the renames are staged and the
861
864
  next commit carries them whole; a plain rename would leave an unstaged
@@ -875,10 +878,61 @@ renamed (`E806`) where the rename would be lost:
875
878
  Any rename makes the hook exit 1, so review the renames and commit again.
876
879
  `--check` is a dry run that reports what would be renamed.
877
880
 
878
- Files with no ID are reported (`E800`), not given one. An opt-in
879
- `--assign-ids` is deferred: choosing IDs is a policy decision, best backed
880
- by a counter file as CommunityContent does, since taking the highest ID plus
881
- one could reuse a deleted item's ID.
881
+ **New IDs (`E809`).** A file with no ID, or a duplicate ID, gets a new one
882
+ in the same rename, which also applies `E804` and `E805`:
883
+
884
+ - No ID: `Name.bes` becomes `<ID> Name.bes`. The server never gathered it,
885
+ so nothing deployed refers to it.
886
+ - Duplicate ID: the one file on the base branch keeps the ID, and the others
887
+ get new ones (`42- X.bes` -> `1043- X.bes`). Renumbering only new content
888
+ keeps actions and baselines that refer to the old ID working. A file
889
+ renamed from one on the base branch counts as on it, as `git diff -M`
890
+ pairs them. When every file in the group is new, the first by path keeps
891
+ the ID. Nothing is renumbered, and `E806` says why, when two or more are
892
+ already on the base branch (which one keeps the ID is for a person to
893
+ decide), or when the ID is on the base branch but git sees no file here as
894
+ that file renamed (it may be one, changed too much to pair).
895
+ - The new ID is one more than the highest ID any `.bes` path has had in git
896
+ history (`git log --all --full-history -m`: every branch and tag, both
897
+ sides of every merge, every site in the repo) or has now, so it never
898
+ reuses the ID of a deleted or renamed file. It sees only the branches and
899
+ tags this clone has fetched: fetch first. Gaps are never filled. For a site whose older IDs predate the git
900
+ repo, set a floor with `--min-id`.
901
+ - The base branch is the first of `--base-ref`, `PRE_COMMIT_FROM_REF` (set by `pre-commit run --from-ref`)
902
+ and `origin/$GITHUB_BASE_REF` (set in a GitHub `pull_request` run) that is
903
+ a commit in the clone. Without any, it is `HEAD`: in a local commit, the
904
+ staged files are the new ones. Once both files of a duplicate are
905
+ committed on a feature branch, `HEAD` sees neither as new: run with
906
+ `--base-ref origin/main` (or the branch it merges into), as `E806` says.
907
+ - In a shallow clone, git history is incomplete, so no ID is assigned
908
+ (`E806`); likewise for duplicates when `--base-ref` is not a commit.
909
+ - `--disable E809` reports `E800` and `E801` only, as before. Disabling
910
+ `E800` or `E801` also stops `E809` for those files.
911
+
912
+ In GitHub Actions, check out the full history (the default is one commit),
913
+ and give pre-commit the PR's base so that it knows which files are new:
914
+
915
+ ```yaml
916
+ - uses: actions/checkout@v7
917
+ with:
918
+ fetch-depth: 0
919
+ - uses: pre-commit/action@v3.0.1
920
+ with:
921
+ extra_args: >-
922
+ --from-ref ${{ github.event.pull_request.base.sha }}
923
+ --to-ref ${{ github.event.pull_request.head.sha }}
924
+ ```
925
+
926
+ The hook renames the files on the runner and fails, and the log names each
927
+ new file name, for the author to apply (or run the hook locally with
928
+ `--base-ref` naming the PR's base branch). To commit
929
+ the fix back to a PR branch instead, check out `github.head_ref` with
930
+ `contents: write`, then commit and push any change. Fork PRs cannot be
931
+ pushed to, and a push with `GITHUB_TOKEN` starts no new workflow run. Two
932
+ open PRs can choose the same ID; the one merged second then has a duplicate
933
+ on the base branch and is renumbered when it runs again, so require branches
934
+ to be up to date before merging. A site that assigns IDs after merge from a
935
+ counter file, as CommunityContent does, should use `--disable E809`.
882
936
 
883
937
  Not checked here: more than one object in a `.bes` file, or Baselines
884
938
  (repository sites are thought to handle both); schemas, GroupRelevance and
@@ -1,3 +1,3 @@
1
1
  """To support running this directly as a python module."""
2
2
 
3
- __version__ = "2.3.0"
3
+ __version__ = "2.4.0"