weavefoundry / weavefoundry/weaveffi

Warn when IDL identifiers don't follow naming conventions

Open
#36 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
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't snake_case
  • NonPascalCaseType { module, type_name } for struct, enum, interface, and error domain names that aren't PascalCase

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 lint warns on a function named createItem and a struct named kv_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.rs cover both the warning and the no-warning cases, following the existing warning_* 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_count and friends in crates/weaveffi-core/src/validate/tests.rs
  • CLI surface: cmd_lint in crates/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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.