commit | 9c420bb0f059d97d06efe1f0be52a7ac80d4947d | [log] [tgz] |
---|---|---|
author | Oliver Newman <olivernewman@google.com> | Wed Jun 28 16:52:57 2023 +0000 |
committer | CQ Bot <fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Jun 28 16:52:57 2023 +0000 |
tree | 80b3eaf75c24a56a5bffd4b08928c2d097d47725 | |
parent | 7dc750b070340be4faf7760879b5f81e3438fec3 [diff] |
[engine] Make end_col exclusive `end_col` now indicates the column of the character *after* the last character of the span. Rationale: - Consistent with SARIF (see section 3.30.8 at https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html). - Consistent with Rust's Clippy and Go's staticcheck. - Consistent with Tricium (which uses zero-based column indexing unlike shac, but still an exclusive end column). - Makes some common patterns work as expected. E.g. if end_col is inclusive then this is wrong: match = ctx.re.match("foo", line) if match: col = match.offset + 1 ctx.emit.finding( message = "found foo", col = col, end_col = col + len(match.groups[0]), # Wrong, 1 too high ) Change-Id: I7131a8fce93bce2701ef60d352a8e8d24453e553 Reviewed-on: https://fuchsia-review.googlesource.com/c/shac-project/shac/+/878432 Fuchsia-Auto-Submit: Oliver Newman <olivernewman@google.com> Reviewed-by: Marc-Antoine Ruel <maruel@google.com> Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Shac (Scalable Hermetic Analysis and Checks) is a unified and ergonomic tool and framework for writing and running static analysis checks.
Shac checks are written in Starlark.
go install go.fuchsia.dev/shac-project/shac@latest shac check shac doc shac.star | less
⚠ The source of truth is at https://fuchsia.googlesource.com/shac-project/shac.git and uses Gerrit for code review.
See CONTRIBUTING.md to submit changes.