Skip to content

Warn when IDL identifiers don't follow naming conventions #36

Description

@owenthcarey

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions