Skip to content

feat(lint): make bash_local_underscore_prefix an error - #251

Merged
furedea merged 3 commits into
mainfrom
feat/bash-local-underscore-error
Nov 19, 2026
Merged

furedea merged 3 commits into
mainfrom
feat/bash-local-underscore-error

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

概要

bash_local_underscore_prefix を severity: error にする(ADR-0021「Static rules block」,ユーザー決定:ast-grep の規則はすべて error).規則の本体は変えていない.

Closes #248
Refs #169

調査

user の非 archive repository(obsidian と archive 済みの apple-mail-cli,reflex-state,k8s-guideline-bench を除く)の tracked な bash(.sh,.bash,.bats,および bash/sh の shebang を持つファイル,計 67 件)に規則をかけた.読み取りのみで,agent-config 以外は変更していない.

repository 本物の違反 誤検知
revisiting-pgd-evaluation 6 0
dotfiles 6 0
agent-config,FIRE-Bench,agent-harness,swe-bench-trial,swe-conform 0 0
合計 12 0
  • revisiting-pgd-evaluation: run_all_ex100.sh,run_timing_ex100.sh の関数内 local script,local name,local log(各 3 件).
  • dotfiles: tests/esa/zsh.bats の @test 内 local marked_file,recovery_file,expected_calls(計 6 件).bats の @test は関数に展開されるため,関数ローカル変数として本物の違反.

誤検知は 0 件.追加で,規則が誤って反応しうる形(local -a/-n/-i/-A,1 行に複数の変数,文字列中の local,$(...) 内の local,大文字名の IFS)を手元で当てても検出は出なかった.

テスト

rule-tests/bash_local_underscore_prefix.yml に追加(ast-grep test --skip-snapshot-tests で全 28 規則が通過).

  • valid: local -a/-n/-i/-A の宣言,1 行の複数変数,文字列中の local,代入の $(...)
  • invalid: local -r src=...,local _src=... dst

レビュー指摘の扱い

  • P2(note に修正方法が無い,ADR-0021 の契約): 修正済み.note の先頭に local src="$1" → local _src="$1" の例を足した.
  • P2(修正例の「every use」が local src="$src" の右辺の外側変数まで改名させる): 修正済み.改名するのは宣言名と宣言後の参照で,右辺で読む外側変数は除くと note に明記した.

範囲外

既存コードの違反の修正(Issue の受け入れ条件どおり,CI は PR が足した行だけを見る).他の規則,CI や hook の配線,他 repository のコード.

🤖 Generated with Claude Code

Scanning the user's tracked bash found 12 findings, all real violations and no false positives.

Closes #248
Refs #169

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 19, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T02:40:36.612294Z 361ada5 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Review summary: no findings. The change is a one-line severity bump (warning to error) plus new valid and invalid rule tests. I read the rule and the new test cases and found no correctness or security problems. The inside check matches only the direct parent, so local flags such as -a, -n, -i and -A and command substitutions are not flagged, which matches the new valid cases. The new invalid cases are matched by the existing variable_assignment and variable_name branches. I did not run ast-grep test myself, because sg on this runner is probably the shadow-utils command. I am relying on the PR's stated result of 28 passing rules.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b85ab4bf24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@furedea

furedea commented Nov 19, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary: no findings.

The change flips bash_local_underscore_prefix from warning to error and adds a note with the rename instruction. The rule logic is unchanged. The new valid and invalid cases in the rule test file match the rule's any/inside structure when I read through them. The local -a/-n/-i/-A flags and extra declarations on a line are covered.

I did not run ast-grep test myself. ast-grep isn't installed in this environment, and sg resolves to the system sg command instead. The PR description says all 28 rules pass.

No P0–P3 issues.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06fcc7e66a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@furedea

furedea commented Nov 19, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary: no findings. The change flips bash_local_underscore_prefix to severity: error, adds a fix example to note, and adds valid and invalid rule tests. I read the rule's matching logic against the new test cases and found no correctness or security problems. I did not run ast-grep test myself, because ast-grep isn't installed in this environment. The PR description says all 28 rules pass, and I'm relying on that. The test coverage matches the behavior that changed.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 361ada56ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@furedea
furedea merged commit cd8c5b8 into main Nov 19, 2026
29 checks passed
@furedea
furedea deleted the feat/bash-local-underscore-error branch November 19, 2026 02:57
furedea pushed a commit that referenced this pull request Nov 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.0](v0.2.0...v0.3.0)
(2026-11-19)


### Features

* **lint:** fit the bash and yaml model rule cutoffs
([#243](#243))
([d5eab6b](d5eab6b))
* **lint:** fit the Go model rules on eval fixtures
([#244](#244))
([cf87c36](cf87c36))
* **lint:** fit the Rust model rules to eval fixtures
([#241](#241))
([3275ce2](3275ce2))
* **lint:** fit the TypeScript model rules on eval fixtures
([#242](#242))
([bb41bb7](bb41bb7))
* **lint:** make bash_local_underscore_prefix an error
([#251](#251))
([cd8c5b8](cd8c5b8))


### Bug Fixes

* **hooks:** let cleanup_worktrees remove worktrees left with only
regenerable outputs
([#235](#235))
([a25ce5b](a25ce5b))
* **hooks:** raise the model rules subject cap and keep cached findings
under it ([#246](#246))
([a451e93](a451e93))
* **hooks:** show each Stop model-rule finding once per session
([#252](#252))
([49cd6f9](49cd6f9))
* **hooks:** skip commits already on the default branch in model rules
([#247](#247))
([3df49a2](3df49a2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(lint): make bash_local_underscore_prefix an error

1 participant