repo: refactor using LATE, Ollama, and Qwen 3.6 #30

Merged
danielfdickinson merged 1 commit from pr-refactor-using-late-and-qwen into main 2026-04-24 03:24:08 -04:00

Tested refactoring for best practices, code quality, etc using
all local (no cloud) tools: L.A.T.E., Ollama, and Qwen 3.6

A.I. Generated Summary:

  1. Fixed pipeline subshell return bug
    ( tests/hyperstickler/check_formalities.sh )

    The git rev-list ... | { while ... done; return "$FAIL"; }
    pipeline was broken because the { ... } block runs in a
    subshell — changes to FAIL were lost.
    Fixed: Replaced the pipeline with while ... done
    < <(git rev-list ...) using process substitution so everything
    runs in the same shell.

  2. Fixed check_duplicate_sob fragile sed pattern
    ( tests/git-hooks/commit-msg )

    Original grep | sort | uniq -c | sed -e '/^[ \t]*1[ \t]/d'
    was fragile and depended on exact sed regex syntax.
    Fixed: Replaced with grep -c '^Signed-off-by:' "$1" and
    grep '^Signed-off-by:' "$1" | sort -u | wc -l for reliable
    comparison.

  3. Removed clear from CI/dev wrapper scripts (
    tests/ci/ci-wrapper.sh , tests/scripts/dev-wrapper.sh )

    clear produces ANSI escape sequences that corrupt TAP output
    in CI environments.

  4. Removed erroneous unstash_after_hook_check call
    ( tests/git-hooks/commit-msg )

    The commit-msg hook never called stash_before_hook_check , so
    calling unstash_after_hook_check was a no-op and a code smell.

  5. Changed GITLEAKS_BASELINE="error" to GITLEAKS_BASELINE=""
    ( tests/git-hooks/commit-msg )

    The "pre-commit" comment was misleading (this is commit-msg,
    not pre-commit). The gitleaks baseline was being set to "error"
    which could cause unexpected warnings.

  6. Removed --no-git flag from check_gitleak
    ( tests/scripts/check-worktree.sh )

    --no-git tells gitleaks to ignore git entirely and scan all
    files — wrong for a pre-commit hook which should only scan
    staged/changed files.

  7. Fixed echo → printf '%s\n' in helper functions
    ( tests/common.sh )

    echo can interpret -n , -e , and backslash sequences as
    arguments or escape sequences. Fixed in 6 output functions
    ( output_pass , output_warn , output_fail , output_skip ,
    output_raw , and check_files_fail ).

  8. Fixed stash_before_hook_check and unstash_after_hook_check
    ( tests/common.sh )

    Added || true to stash_before_hook_check to prevent set -e
    abort on stash failure. Made unstash_after_hook_check use a safe
    pattern with || true .

  9. Fixed dependency iteration in check-depends.sh

    Changed for dep in $(<"$1") to while IFS= read -r dep;
    do ... done <"$1" to handle dependencies with spaces.

Added resolve_script_dir helper ( tests/common.sh ) and simplified
ALL path resolution across all scripts:

Before: Nested realpath -m "$(realpath -m "$(dirname
"$(realpath -m "$0")")")/" chains that were unreadable and fragile.
After: Single _SOURCE_DIR="$(realpath -m -- "$0")"
\n _SOURCE_DIR="${_SOURCE_DIR%/*}" pattern, then
$(_SOURCE_DIR)/../common.sh etc.

Added resolve_script_dir helper ( tests/common.sh ) and simplified
ALL path resolution across all scripts:

Before: Nested realpath -m "$(realpath -m "$(dirname
"$(realpath -m "$0")")")/" chains that were unreadable and fragile.
After: Single _SOURCE_DIR="$(realpath -m -- "$0")" \n
_SOURCE_DIR="${_SOURCE_DIR%/*}" pattern, then
$(_SOURCE_DIR)/../common.sh etc.

  1. Standardized set -o pipefail → set -e ordering across all
    scripts (pipefail BEFORE errexit is best practice).

  2. Removed redundant bash version check from check_formalities.sh
    (already present in common.sh which is sourced first).

  3. Removed misleading comment from commit-msg hook about
    "pre-commit" gitleaks.

  4. Fixed output_header to use printf instead of heredoc with
    variable interpolation.

Non-ASCII filename check
Whitespace error check
Sorted file check
Shellcheck check
shfmt check
JSON validity check
JSON prettification check
Spelling check
Markdown formatting check
YAML formatting check
Commit subject prefix check
Commit subject case check
Commit subject length checks (soft/warning + hard/fail)
Commit subject no-trailing-period check
Commit message exists check
Commit message line length check
Signed-off-by match check
Branch check
Cherry-pick check
Merge commit check
Author/committer name format check
Author/committer email format check
Gitlint check
Duplicate SoB check
Subject-body separator check
Secrets detection (gitleaks)

Daniel: The results were not perfect and required some hand editing,
but appears to have generated mostly useful results.

Signed-off-by: Daniel F. Dickinson dfdpublic@wildtechgarden.ca

Tested refactoring for best practices, code quality, etc using all local (no cloud) tools: L.A.T.E., Ollama, and Qwen 3.6 A.I. Generated Summary: 1. Fixed pipeline subshell return bug ( tests/hyperstickler/check_formalities.sh ) The git rev-list ... | { while ... done; return "$FAIL"; } pipeline was broken because the { ... } block runs in a subshell — changes to FAIL were lost. Fixed: Replaced the pipeline with while ... done < <(git rev-list ...) using process substitution so everything runs in the same shell. 2. Fixed check_duplicate_sob fragile sed pattern ( tests/git-hooks/commit-msg ) Original grep | sort | uniq -c | sed -e '/^[ \t]*1[ \t]/d' was fragile and depended on exact sed regex syntax. Fixed: Replaced with grep -c '^Signed-off-by:' "$1" and grep '^Signed-off-by:' "$1" | sort -u | wc -l for reliable comparison. 3. Removed clear from CI/dev wrapper scripts ( tests/ci/ci-wrapper.sh , tests/scripts/dev-wrapper.sh ) clear produces ANSI escape sequences that corrupt TAP output in CI environments. 4. Removed erroneous unstash_after_hook_check call ( tests/git-hooks/commit-msg ) The commit-msg hook never called stash_before_hook_check , so calling unstash_after_hook_check was a no-op and a code smell. 5. Changed GITLEAKS_BASELINE="error" to GITLEAKS_BASELINE="" ( tests/git-hooks/commit-msg ) The "pre-commit" comment was misleading (this is commit-msg, not pre-commit). The gitleaks baseline was being set to "error" which could cause unexpected warnings. 6. Removed --no-git flag from check_gitleak ( tests/scripts/check-worktree.sh ) --no-git tells gitleaks to ignore git entirely and scan all files — wrong for a pre-commit hook which should only scan staged/changed files. 7. Fixed echo → printf '%s\n' in helper functions ( tests/common.sh ) echo can interpret -n , -e , and backslash sequences as arguments or escape sequences. Fixed in 6 output functions ( output_pass , output_warn , output_fail , output_skip , output_raw , and check_files_fail ). 8. Fixed stash_before_hook_check and unstash_after_hook_check ( tests/common.sh ) Added || true to stash_before_hook_check to prevent set -e abort on stash failure. Made unstash_after_hook_check use a safe pattern with || true . 9. Fixed dependency iteration in check-depends.sh Changed for dep in $(<"$1") to while IFS= read -r dep; do ... done <"$1" to handle dependencies with spaces. Added resolve_script_dir helper ( tests/common.sh ) and simplified ALL path resolution across all scripts: Before: Nested realpath -m "$(realpath -m "$(dirname "$(realpath -m "$0")")")/" chains that were unreadable and fragile. After: Single _SOURCE_DIR="$(realpath -m -- "$0")" \n _SOURCE_DIR="${_SOURCE_DIR%/*}" pattern, then $(_SOURCE_DIR)/../common.sh etc. Added resolve_script_dir helper ( tests/common.sh ) and simplified ALL path resolution across all scripts: Before: Nested realpath -m "$(realpath -m "$(dirname "$(realpath -m "$0")")")/" chains that were unreadable and fragile. After: Single _SOURCE_DIR="$(realpath -m -- "$0")" \n _SOURCE_DIR="${_SOURCE_DIR%/*}" pattern, then $(_SOURCE_DIR)/../common.sh etc. 10. Standardized set -o pipefail → set -e ordering across all scripts (pipefail BEFORE errexit is best practice). 11. Removed redundant bash version check from check_formalities.sh (already present in common.sh which is sourced first). 12. Removed misleading comment from commit-msg hook about "pre-commit" gitleaks. 13. Fixed output_header to use printf instead of heredoc with variable interpolation. Non-ASCII filename check Whitespace error check Sorted file check Shellcheck check shfmt check JSON validity check JSON prettification check Spelling check Markdown formatting check YAML formatting check Commit subject prefix check Commit subject case check Commit subject length checks (soft/warning + hard/fail) Commit subject no-trailing-period check Commit message exists check Commit message line length check Signed-off-by match check Branch check Cherry-pick check Merge commit check Author/committer name format check Author/committer email format check Gitlint check Duplicate SoB check Subject-body separator check Secrets detection (gitleaks) Daniel: The results were not perfect and required some hand editing, but appears to have generated mostly useful results. Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
repo: refactor using LATE, Ollama, and Qwen 3.6
All checks were successful
/ pre-commit-checks (push) Successful in 16s
/ pre-commit-checks (pull_request) Successful in 16s
5d7a567aa2
Tested refactoring for best practices, code quality, etc using
all local (no cloud) tools: L.A.T.E., Ollama, and Qwen 3.6

A.I. Generated Summary:

1. Fixed pipeline subshell  return  bug
   ( tests/hyperstickler/check_formalities.sh )

   The  git rev-list ... | { while ... done; return "$FAIL"; }
   pipeline was broken because the  { ... }  block runs in a
   subshell — changes to  FAIL  were lost.
   Fixed: Replaced the pipeline with  while ... done
   < <(git rev-list ...)  using process substitution so everything
   runs in the same shell.

2. Fixed  check_duplicate_sob  fragile sed pattern
   ( tests/git-hooks/commit-msg )

   Original  grep | sort | uniq -c | sed -e '/^[ \t]*1[ \t]/d'
   was fragile and depended on exact sed regex syntax.
   Fixed: Replaced with  grep -c '^Signed-off-by:' "$1"  and
   grep '^Signed-off-by:' "$1" | sort -u | wc -l  for reliable
   comparison.

3. Removed  clear  from CI/dev wrapper scripts (
   tests/ci/ci-wrapper.sh ,  tests/scripts/dev-wrapper.sh )

   clear  produces ANSI escape sequences that corrupt TAP output
   in CI environments.

4. Removed erroneous  unstash_after_hook_check  call
   ( tests/git-hooks/commit-msg )

   The commit-msg hook never called  stash_before_hook_check , so
   calling  unstash_after_hook_check  was a no-op and a code smell.

5. Changed  GITLEAKS_BASELINE="error"  to  GITLEAKS_BASELINE=""
   ( tests/git-hooks/commit-msg )

   The "pre-commit" comment was misleading (this is commit-msg,
   not pre-commit). The gitleaks baseline was being set to "error"
   which could cause unexpected warnings.

6. Removed  --no-git  flag from  check_gitleak
   ( tests/scripts/check-worktree.sh )

   --no-git  tells gitleaks to ignore git entirely and scan all
   files — wrong for a pre-commit hook which should only scan
   staged/changed files.

7. Fixed  echo  →  printf '%s\n'  in helper functions
   ( tests/common.sh )

   echo  can interpret  -n ,  -e , and backslash sequences as
   arguments or escape sequences. Fixed in 6 output functions
   ( output_pass ,  output_warn ,  output_fail ,  output_skip ,
   output_raw , and  check_files_fail ).

8. Fixed  stash_before_hook_check  and  unstash_after_hook_check
   ( tests/common.sh )

   Added  || true  to  stash_before_hook_check  to prevent  set -e
   abort on stash failure. Made  unstash_after_hook_check  use a safe
   pattern with  || true .

9. Fixed dependency iteration in  check-depends.sh

   Changed  for dep in $(<"$1")  to  while IFS= read -r dep;
   do ... done <"$1"  to handle dependencies with spaces.

Added  resolve_script_dir  helper ( tests/common.sh ) and simplified
ALL path resolution across all scripts:

Before: Nested  realpath -m "$(realpath -m "$(dirname
  "$(realpath -m "$0")")")/"  chains that were unreadable and fragile.
After: Single  _SOURCE_DIR="$(realpath -m -- "$0")"
  \n _SOURCE_DIR="${_SOURCE_DIR%/*}"  pattern, then
  $(_SOURCE_DIR)/../common.sh  etc.

Added  resolve_script_dir  helper ( tests/common.sh ) and simplified
ALL path resolution across all scripts:

Before: Nested  realpath -m "$(realpath -m "$(dirname
"$(realpath -m "$0")")")/"  chains that were unreadable and fragile.
After: Single  _SOURCE_DIR="$(realpath -m -- "$0")" \n
_SOURCE_DIR="${_SOURCE_DIR%/*}"  pattern, then
$(_SOURCE_DIR)/../common.sh  etc.

10. Standardized  set -o pipefail  →  set -e  ordering across all
scripts (pipefail BEFORE errexit is best practice).

11. Removed redundant bash version check from  check_formalities.sh
(already present in  common.sh  which is sourced first).

12. Removed misleading comment from  commit-msg  hook about
"pre-commit" gitleaks.

13. Fixed  output_header  to use  printf  instead of heredoc with
variable interpolation.

Non-ASCII filename check
Whitespace error check
Sorted file check
Shellcheck check
shfmt check
JSON validity check
JSON prettification check
Spelling check
Markdown formatting check
YAML formatting check
Commit subject prefix check
Commit subject case check
Commit subject length checks (soft/warning + hard/fail)
Commit subject no-trailing-period check
Commit message exists check
Commit message line length check
Signed-off-by match check
Branch check
Cherry-pick check
Merge commit check
Author/committer name format check
Author/committer email format check
Gitlint check
Duplicate SoB check
Subject-body separator check
Secrets detection (gitleaks)

Daniel: The results were not perfect and required some hand editing,
but appears to have generated mostly useful results.

Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
danielfdickinson scheduled this pull request to auto merge when all checks succeed 2026-04-24 03:23:58 -04:00
danielfdickinson deleted branch pr-refactor-using-late-and-qwen 2026-04-24 03:24:08 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dfd-actions/pre-commit-action!30
No description provided.