Skip to content

Units in field names and "field names should be lowercase snake_case" incompatibility #8612

Open
@mattofak

Description

@mattofak

Our practice is to append the units to a field name if they are not SI or we just want to be clear. E.g. we have fields like charge_ampacity_mAds [1]. Unfortunately this results in the flatc compiler emitting warnings like "warning: field names should be lowercase snake_case, got: charge_ampacity_mAds". (This is generated by idl_parser.cpp, introduced by MR6005.)

Because capitalization is important in units and we don't want to spam out output logs, I'm wondering if we can come up with a special case to silence the error. Maybe something as fine grained as "the field has at least one underscore, and the last syllable is the only one that isn't lowercase." Or maybe just a blunt hammer of an argument to flatc that says "yes, I know we're breaking the rules, don't complain."

As discussed in #6032, special case handling for parsing wants to be avoided; but it's also very important to avoid unit confusion, and also to avoid spamming build logs. I'm not sure how to reconcile all these conflicting demands.

[1] milli-amp deci-seconds if any one is wondering

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions