Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions becs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ becwright import https://raw.githubusercontent.com/DataDave-Dev/becwright/main/b
| `no-wildcard-imports.bec.yaml` | Warns about `from x import *` | `warning` |
| `no-debugger-js.bec.yaml` | Blocks `debugger;` in JS/TS | `blocking` |
| `no-console-log-js.bec.yaml` | Warns about `console.log(...)` in JS/TS | `warning` |
| `no-debug-go.bec.yaml` | Blocks `fmt.Println()` and `panic()` in Go | `blocking` |
| `no-debug-rust.bec.yaml` | Blocks `dbg!()` and `println!()` in Rust | `blocking` |

The Python BECs use `paths: ["src/**/*.py"]` and the JS/TS ones `["**/*.js",
"**/*.ts"]`. After importing, adjust `paths` in your `.bec/rules.yaml` if your
code lives elsewhere.
The Python BECs use `paths: ["src/**/*.py"]`, the JS/TS ones `["**/*.js", "**/*.ts"]`, the Go bundles use `["**/*.go"]`, and the Rust bundles use `["**/*.rs"]`. After importing, adjust `paths` in your `.bec/rules.yaml` if your code lives elsewhere.
15 changes: 15 additions & 0 deletions becs/no-debug-go.bec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
becwright_bec: 1
exported_from: https://github.com/DataDave-Dev/becwright
rule:
id: no-debug-go
intent: >
Do not leave debug output or panic calls in Go code.
why_it_matters: >
Debug statements and unexpected panic calls should not reach production.
paths:
- "**/*.go"
Comment on lines +9 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git ls-files becs | sed -n '1,200p'
printf '\n--- becs/no-debug-go.bec.yaml ---\n'
cat -n becs/no-debug-go.bec.yaml
printf '\n--- search for no-debug-go references ---\n'
rg -n "no-debug-go|paths:|\\*\\*/\\*\\.go|_test\\.go" becs . -g '*.yaml' -g '*.yml' -g '*.bec.yaml' -g '*.bec.yml' || true

Repository: DataDave-Dev/becwright

Length of output: 2010


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "noop"

Repository: DataDave-Dev/becwright

Length of output: 165


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' "Need to inspect the BEC file and related rule definitions."

Repository: DataDave-Dev/becwright

Length of output: 219


Scope the Go rule to production files. **/*.go also matches *_test.go, so this rule will fire in tests even though the intent and rationale are production-only. Narrow the glob or add an explicit test-file exclusion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@becs/no-debug-go.bec.yaml` around lines 9 - 10, The Go rule is currently
matching test files as well as production code, so scope the file selection in
the rule configuration to exclude `*_test.go` and keep it limited to production
`.go` files. Update the glob or add an explicit test-file exclusion in the
`paths` section so the rule only applies where intended.

severity: blocking
check:
kind: builtin
module: forbid
args: "--pattern 'fmt\\.Println\\s*\\(|panic\\s*\\('"
15 changes: 15 additions & 0 deletions becs/no-debug-rust.bec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
becwright_bec: 1
exported_from: https://github.com/DataDave-Dev/becwright
rule:
id: no-debug-rust
intent: >
Do not leave debug output in Rust code.
why_it_matters: >
Debug macros and leftover println! calls should not reach production.
paths:
- "**/*.rs"
Comment on lines +9 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Files matching becs/no-debug-rust.bec.yaml and nearby docs:\n'
git ls-files 'becs/no-debug-rust.bec.yaml' 'becs/*' 'README.md' | sed -n '1,120p'

printf '\nOutline of becs/no-debug-rust.bec.yaml if supported:\n'
if command -v ast-grep >/dev/null 2>&1; then
  ast-grep outline becs/no-debug-rust.bec.yaml || true
fi

printf '\nContents of becs/no-debug-rust.bec.yaml with line numbers:\n'
cat -n becs/no-debug-rust.bec.yaml

printf '\nSearch for no-debug-rust references and glob/docs about tests:\n'
rg -n "no-debug-rust|paths:|\\*\\*/\\*\\.rs|test files|tests?" becs README.md .github . -g '!**/.git/**' || true

Repository: DataDave-Dev/becwright

Length of output: 15600


Scope the Rust rule to production files. This glob applies to all Rust files, including tests. If the rule is meant for production code only, narrow it to the production tree or exclude test paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@becs/no-debug-rust.bec.yaml` around lines 9 - 10, The Rust path glob is
currently too broad and matches test files as well as production code. Update
the paths configuration in this rule to target only the production Rust tree or
explicitly exclude test locations, using the existing paths entry in the
no-debug-rust rule so it no longer applies to test sources.

severity: blocking
check:
kind: builtin
module: forbid
args: "--pattern 'dbg!\\s*\\(|println!\\s*\\('"
Loading