6 Commits
Author SHA1 Message Date
Dan GuidoandClaude Opus 4.5 b4da3e93e8 docs: clarify traversal pattern guidance in CLAUDE.md (#2940)
The previous guidance ("Use `_declared` suffix") was too simplistic and
caused incorrect code review feedback. The new guidance distinguishes
three traversal patterns based on analysis type:

- Per-definition analysis: contracts_derived + functions_declared
- Reachability analysis: contracts_derived + functions (needs inherited)
- Global deduplication: compilation_unit.functions directly

This prevents false negatives when reviewers suggest functions_declared
for detectors that require reachability analysis of inherited functions.

Co-authored-by: Claude Opus 4.5 <[email protected]>
2026-01-20 10:59:29 -05:00
Dan GuidoandClaude Opus 4.5 d311989355 perf: cache Literal.__str__ conversion for numeric types (#2934)
* perf: cache Literal.__str__ conversion for numeric types

Optimize Literal.__str__() by caching the result of convert_string_to_int()
during construction. This avoids repeated expensive conversions when the
same literal is stringified multiple times during detector execution.

Changes:
- Add module-level _NUMERIC_TYPES frozenset for O(1) type lookup
- Cache converted string in __init__ for numeric string types
- Skip caching when subdenomination is set (uses converted_value instead)
- Preserve original behavior for ElementaryType inputs (no conversion)

Benchmark: ~16% faster on optimism codebase (50.7s vs ~61s)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix: use lenient threshold for timing test on Windows

Windows has lower timer resolution (~15.6ms default) and time.sleep()
can return slightly early. Lower the assertion threshold from 0.01 to
0.005 to account for this variance.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* fix: address PR review feedback for Literal caching

- Add unit tests for Literal class covering caching behavior
- Restore comment explaining non-numeric type fallback path
- Note: test_timing.py threshold lowered for Windows timer resolution

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
2026-01-19 21:02:24 -05:00
Dan GuidoandClaude Opus 4.5 a68c3ab2a0 chore: modernize pre-commit hooks with prek (#2894)
- Replace pre-commit with prek (Rust-based, faster)
- Add shellcheck and shfmt for shell script linting
- Add actionlint for GitHub Actions validation
- Add actionlint.yaml config for ubuntu-slim runner label
- Update Makefile: lint target adds actionlint/zizmor, reformat adds ruff format
- Update make dev to auto-install hooks
- Update CLAUDE.md and CONTRIBUTING.md to document prek
- Remove redundant hooks (debug-statements, check-yaml, mixed-line-ending)
- Auto-fix formatting issues caught by new hooks

Co-authored-by: Claude Opus 4.5 <[email protected]>
2026-01-16 00:57:56 -05:00
Dan GuidoandClaude Opus 4.5 9277defc3b docs: Add comprehensive CLAUDE.md for AI-assisted development (#2889)
* Add .worktrees/ to .gitignore

Prevent git worktree directories from being tracked.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* docs: Add comprehensive CLAUDE.md for AI-assisted development

Add project-specific coding standards and Slither internals documentation
to help developers using Claude Code (or similar AI tools) work effectively
on the codebase.

CLAUDE.md includes:
- Architecture overview and development setup
- Code standards (philosophy, quality, hard limits)
- Working on code (incremental improvement, git conventions)
- Testing guidelines
- Slither internals (APIs, traversal patterns, SlithIR/SSA, detector quality)

CONTRIBUTING.md additions:
- PR description guidelines
- Commit message conventions
- Markdown documentation standards

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* docs: Condense CONTRIBUTING.md and improve readability

- Code section: Remove verbose PR model explanation, fork link, "work from master"
- Testing section: Tighten test categories to scannable list
- Tips: Condense while adding coverage commands
- crytic-compile section: Rename and simplify to numbered steps with example
- CLAUDE.md: Add analyses/ to architecture, alphabetize directories

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
2026-01-15 23:11:44 -05:00
SimoneandEmilio López d3870a32e5 Update CLAUDE.md
Co-authored-by: Emilio López <[email protected]>
2026-01-06 21:23:05 +01:00
Dan GuidoandClaude Opus 4.5 45240cd407 docs: add CLAUDE.md coding standards for AI assistants
Add project-specific coding standards file that provides guidance for AI
assistants (like Claude) working on the Slither codebase. Includes:
- Runtime and tooling requirements (Python 3.9+, uv, ruff, pytest)
- Python guidelines for build system and CI
- Hard rules for code quality (function length, complexity, imports)
- Common development commands

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-01-06 10:56:55 -05:00