Skip to content

snake_case #340

@Simbiat

Description

@Simbiat

This ticket is to document the reasoning behind multiple coming commits with renames.

After some careful consideration, it was decided to finally start applying some naming convention. This started as desire to resolve grammar highlights in IDE without adding various things to dictionary, but having a convention helps, and one of the reasons is communication between frontend and backend: adapting snake_case will minimize potential issues that can be cause difference in case in places.

As such, going forward, variables in most places are expected to be in snake_case, with constant using SCREAMING_SNAKE_CASE. This is applicable both to JS/TS, CSS and, of course, PHP. And everything else, really. These exceptions may apply:

  • path names and URLs, at least those that aim to "replicate" other sources, for example freecompany may be used for FFTracker, because this is how it's spelled on Lodestone
  • array keys that are used to render text directly, especially those that have "unique" values (like DPS and PvP for Free Company processing in tracker)
  • array keys that use common abbreviations (like IP, HTML, URL, etc.)
  • variables when used as part of some 3rd-party library to maintain its conventions and/or its original names (for example attributes' names from BIC library, when parsing it, as well as names of respective columns) or that are based on 3rd-party specifications (like RSS/Atom attributes)
  • SCREAMING_SNAKE_CASE is applied to constants in JS only if they are public (otherwise half the code will be screaming)

Retrospective is not enforced besides cases where renaming of columns in database or settings for respective libraries is required. For everything else, changes are to be applied when combined with other modifications or when the change is easy enough.

As for class names - they should be PascalCase, and function names - camelCase, as per PSR-12. Exception to these may be use of acronyms in names (for example NL2Tag class name, since NL is a common acronym for New Line).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions