Skip to content

Additional name style categories #158

@AndreaWalchshoferSCCH

Description

@AndreaWalchshoferSCCH

There are 2 concepts in Lua for which I'd like to set a name style specifically:

  1. Constants, constants_name_style
    e.g. for local PI <const> = 3.14, I want to force UPPER_SNAKE_CASE, but don't want to allow it for all local variables (as I am now)

  2. Module-local variables, module_local_name_style
    e.g.

local _module1 = {};

local _variable = "module_local_variable"

-- more code

return _module1;

I want to force variables like _variable to be named with e.g. a leading underscore, but it is currently mixed into all local variable name styles as well. As these may collide with other namestyles, e.g. the constants above, the rule should be applied if it's not constant/module definition/module import already.

  • Is it technically possible to add these options to the namestyle configurations?
  • And is it something you would accept (/implement) in the formatter, or do you see any problems with it we should discuss?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions