Skip to content

Improvements#101

Merged
david-a-wheeler merged 5 commits into
masterfrom
improvements
May 17, 2026
Merged

Improvements#101
david-a-wheeler merged 5 commits into
masterfrom
improvements

Conversation

@david-a-wheeler

Copy link
Copy Markdown
Owner

No description provided.

david-a-wheeler and others added 5 commits May 17, 2026 14:31
Add _preceded_by_member_or_namespace() which checks the characters
immediately before a matched word. If the word follows '.' or '->',
it is a method call on an object rather than the dangerous global C
function, and the hit is suppressed.

Namespace-qualified calls (ns::func()) are intentionally NOT suppressed:
some are flagged by design (e.g. std::equal with three iterators), so
that distinction requires per-rule knowledge and is deferred.

Only horizontal whitespace (space, tab) is skipped in the backward scan;
newlines are treated as boundaries to avoid crossing into preceding
comment text and finding false alphanumeric matches.

Adds test_013 (test-member-calls.cpp) covering:
- obj.read() and ptr->read() produce no hit
- bare read() and ::system() still produce hits

Fixes: #83, #59 (and partially #82)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously a UnicodeDecodeError in any file would immediately abort
the entire scan (sys.exit(15)), preventing CI/CD pipelines from seeing
results for all other files.

New behaviour:
- Print the full advisory (PYTHONUTF8, LC_ALL, iconv options) and skip
  the offending file; scanning continues on remaining files.
- Track skipped files in num_encoding_errors and report the count in
  the summary alongside num_links_skipped etc.
- Always exit with code 15 if any encoding errors were encountered, so
  CI/CD pipelines see a non-zero exit and are alerted.

Fixes: #80, #68

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Percent-encode file paths in _to_uri_path so filenames with spaces or
special characters produce valid URIs accepted by GitHub's SARIF upload
API. Simplify helpuri to use re.search for reliable CWE extraction
instead of the fragile split-and-append approach.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows users to skip third-party libraries, generated code, or test
directories using repeatable --exclude flags backed by fnmatch full-path
matching (e.g. --exclude '*/third_party/*').

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
@david-a-wheeler
david-a-wheeler merged commit 1acb3df into master May 17, 2026
5 checks passed
@david-a-wheeler
david-a-wheeler deleted the improvements branch May 17, 2026 18:51
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