Skip to content

feat: add bats-python-one-liner lint rule (#47)#65

Open
olavostauros wants to merge 2 commits into
KnickKnackLabs:mainfrom
olavostauros:feat/bats-python-one-liner
Open

feat: add bats-python-one-liner lint rule (#47)#65
olavostauros wants to merge 2 commits into
KnickKnackLabs:mainfrom
olavostauros:feat/bats-python-one-liner

Conversation

@olavostauros

Copy link
Copy Markdown

Summary

Add a codebase lint rule that detects unreadable Python assertion one-liners (python3 -c "...assert...") in BATS test files, flagging them in favor of heredoc Python scripts for readability.

Fixes #47.

Detection

  • Flags any .bats file line containing python3 -c or python -c where the inline code contains assert
  • Skips @test description lines, full-line comments, heredoc context, and # codebase:ignore-annotated lines
  • Supports file-level ignore via codebase:ignore bats-python-one-liner in mise.toml
  • Outputs file:line citations with remediation hint

Files

File Purpose
.mise/tasks/lint/bats-python-one-liner Lint rule task
test/lint/bats-python-one-liner/bats-python-one-liner.bats 14 BATS tests
test/lint/bats-python-one-liner/fixtures/ 9 fixture directories (clean, dirty-assert, dirty-python, dirty-long, heredoc, ignored-inline, ignored-file, empty)

Validation

  • mise run test — all 232 tests pass (0 failures)
  • codebase lint:bats-python-one-liner . — self-hosting passes clean (16 files, 0 violations)
  • bash -n .mise/tasks/lint/bats-python-one-liner — syntax valid
  • git diff --check

Detect unreadable Python assertion one-liners (`python3 -c "...assert..."`)
in BATS test files. Prefer heredoc Python scripts for readability.

Closes KnickKnackLabs#47
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.

Lint unreadable Python assertion one-liners in BATS tests

1 participant