mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-03 08:09:11 +00:00
## What - **CLAUDE.md** (new, tracked): project-level rules for AI coding sessions — build/workflow basics, Rust code organization (item order `mod → use → const/static → types → impls → fns`, pub/private function grouping, `#[cfg(test)] mod tests` always last, structural thresholds are ratchet-only), comment discipline (one line, only for non-obvious constraints), PR conventions, and enterprise-gated code verification (including keeping `Cargo.toml.openobserve` in the o2-enterprise repo in sync with this repo's root `Cargo.toml`). Replaces `.claude/.clauderc`, which is not a file Claude Code reads. - **Structural clippy ratchets in CI**: the clippy step now also enables `too_many_lines`, `cognitive_complexity`, and `excessive_nesting`, with clippy.toml thresholds set just above today's worst offenders (1024 lines / complexity 100 / nesting 10), so the current tree passes clean. Measured across the workspace with `--all-targets`: max function 1019 lines, max complexity 94, max nesting 10. The thresholds only ratchet down as code is cleaned up — CI failing on one of these means split the function, not raise the number. - **clippy.toml**: add `source-item-ordering = ["module"]` so the opt-in `clippy::arbitrary_source_item_ordering` lint checks module-level item order only (its default also forces alphabetical struct fields/enum variants). - **.gitignore**: reorganized into commented sections and slimmed from 116 to 75 lines — removed duplicate entries, patterns shadowed by other patterns, one dead rule, and 14 stale one-off entries with no matching files; simplified the `.vscode`/`.opencode`/`.claude` blocks. ## Why Coding sessions kept placing functions in arbitrary positions (above constants, mixed into the wrong visibility group, tests at the top of files) and writing multi-line comment essays, and nothing bounded function size/complexity growth. CLAUDE.md states the conventions once for every contributor's sessions; enforcement stays with the standard Rust toolchain (rustfmt, clippy thresholds, CI's `-D warnings`). ## Notes for reviewers - The enterprise CI clippy step runs its own command without these `-W` flags, so it is unaffected. - An earlier revision of this branch added a PostToolUse hook script for style checking; it was dropped in favor of toolchain + prompt rules only, and `.claude/settings.json` stays gitignored. - The gitignore rewrite was verified behavior-preserving at each step: the untracked-file list and an 86-path rule battery were compared before/after every change; the only intentional semantic changes are the removals listed above.
9 lines
284 B
TOML
9 lines
284 B
TOML
large-error-threshold = 200
|
|
|
|
source-item-ordering = ["module"]
|
|
|
|
# Ratchets for CI's -W flags: set just above today's worst offenders; tighten
|
|
# over time by fixing code, never raise.
|
|
too-many-lines-threshold = 1024
|
|
cognitive-complexity-threshold = 100
|
|
excessive-nesting-threshold = 10 |