weavefoundry / weavefoundry/weaveffi
Warn when IDL identifiers don't follow naming conventions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 61
- Forks
- 5
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 8
Description
Summary
weaveffi lint surfaces the advisory warnings collected in crates/weaveffi-core/src/validate/warnings.rs, but none of them check identifier casing. The naming conventions in docs/src/reference/naming.md (snake_case for functions and parameters, PascalCase for structs, enums, and interfaces) are currently unenforced, so a stray createItem or kv_error sails through silently even though the per-target generators assume conventional input casing when they re-case identifiers.
Proposed change
Add new ValidationWarning variants to crates/weaveffi-core/src/validate/warnings.rs, for example:
NonSnakeCaseFunction { module, function }for function and parameter names that aren'tsnake_caseNonPascalCaseType { module, type_name }for struct, enum, interface, and error domain names that aren'tPascalCase
Then extend collect_warnings to walk the API and emit them, and add Display messages that tell the user the expected casing (see the existing variants for the message style).
Acceptance criteria
-
weaveffi lintwarns on a function namedcreateItemand a struct namedkv_item, with messages that name the offending identifier and the expected convention - Conventionally cased IDLs (e.g. everything under
samples/) produce no new warnings - Unit tests in
crates/weaveffi-core/src/validate/tests.rscover both the warning and the no-warning cases, following the existingwarning_*test pattern - New public items carry doc comments (the crate uses
#![deny(missing_docs)])
Pointers
- Warning enum and collector:
crates/weaveffi-core/src/validate/warnings.rs - Existing tests to mimic:
warning_large_enum_variant_countand friends incrates/weaveffi-core/src/validate/tests.rs - CLI surface:
cmd_lintincrates/weaveffi-cli/src/commands/validate.rs - Conventions reference:
docs/src/reference/naming.md
Suggested commit message
feat: warn when IDL identifiers don't follow naming conventions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the warning variants and collector in crates/weaveffi-core/src/validate/warnings.rs, then read warning_large_enum_variant_count and related tests in crates/weaveffi-core/src/validate/tests.rs. Check the naming conventions in docs/src/reference/naming.md and the lint entry point in crates/weaveffi-cli/src/commands/validate.rs. Done means the specified casing warnings and messages work, conventional samples stay quiet, tests cover both cases, and new public items have doc comments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100