Skip to content

demo: suppression showcase (inline + global) with verification#6

Open
eitamring wants to merge 2 commits intomainfrom
demo/suppressions-showcase
Open

demo: suppression showcase (inline + global) with verification#6
eitamring wants to merge 2 commits intomainfrom
demo/suppressions-showcase

Conversation

@eitamring
Copy link
Copy Markdown
Contributor

Purpose

Show all practical suppression levels with working examples:

  1. Query-level suppression (specific rule)
  2. Query-level suppression (disable all rules for next statement)
  3. Global rule suppression via config

What Is Included

  • demo/suppressions/inline/sql_inline.sql
  • demo/suppressions/inline/go_inline.go
  • demo/suppressions/inline/python_inline.py
  • demo/suppressions/config/global_disable_vg001.yaml
  • demo/suppressions/README.md

How It Works

1) Specific query suppression

Use a directive on the line before the statement:

  • SQL: -- valk-guard:disable VG001
  • Go: // valk-guard:disable VG001
  • Python: # valk-guard:disable VG001

This suppresses only that rule for the next statement.

2) Statement-wide suppression

Use a bare directive:

  • -- valk-guard:disable
  • // valk-guard:disable
  • # valk-guard:disable

This suppresses all rules for the next statement.

3) Global suppression

Disable a rule in config:

rules:
  VG001:
    enabled: false

Verification (Run Locally)

valk-guard scan demo/suppressions/inline --config .valk-guard.yaml --format json
valk-guard scan demo/suppressions/inline --config demo/suppressions/config/global_disable_vg001.yaml --format json

Verified result on this branch:

  • Baseline config: 3 findings (VG001 only; unsuppressed statements)
  • Global suppression config: 0 findings

Additional CI Reliability Fixes Included

This PR also carries the already-proven workflow compatibility fix for Convert to reviewdog format and pins VALK_GUARD_INSTALL_REF to a known working build so the suppression demo is not blocked by unrelated JSON-shape drift.

// valk-guard:disable VG001
_, _ = db.QueryContext(ctx, "SELECT * FROM users LIMIT 1")

_, _ = db.QueryContext(ctx, "SELECT * FROM users LIMIT 1")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [valk-guard] reported by reviewdog 🐶
VG001: avoid SELECT *; project only required columns | Query: SELECT * FROM users LIMIT 1

# valk-guard:disable VG001
session.execute(text("SELECT * FROM users LIMIT 1")).all()

session.execute(text("SELECT * FROM users LIMIT 1")).all()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [valk-guard] reported by reviewdog 🐶
VG001: avoid SELECT *; project only required columns | Query: SELECT * FROM users LIMIT 1

-- valk-guard:disable VG001
SELECT * FROM users LIMIT 1;

SELECT * FROM users LIMIT 1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ [valk-guard] reported by reviewdog 🐶
VG001: avoid SELECT *; project only required columns | Query: SELECT * FROM users LIMIT 1

@eitamring eitamring force-pushed the demo/suppressions-showcase branch from aac5d82 to 8bdbc19 Compare March 6, 2026 18:05
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.

1 participant