oUF

99.9k Downloads

Coding Style Homogenization

Rainrider opened this issue ยท 8 comments

commented

Code review, guidelines, contribution guide.

  • Lint existing files
  • Create code styleguide
  • Create contribution guidelines
commented

Work being done in the lint branch.

commented
commented

Styleguide (WIP)

  • Readability above all
    • Use whitespace generously
    • Descriptive variable and function names
  • Tabs, not spaces
    • With the exception of in documentation
  • Local functions should be defined as local function foo() end
  • Local functions should be named in "mixed case"
    • e.g oneTwoThree
    • With the exception of in elements where they should be named alike global functions
  • Global functions (methods) should be named in "pascal case"
    • e.g OneTwoThree
  • Constants should be named in all uppercase
  • Blizzard-provided constants used should be upvalued and contain fallback values
  • Local references to global API (upvalues) should be named the same as the original
    • With the exception of libraries, e.g math.abs becomes math_abs
  • Use single quotes (') for strings
    • With the exception in XML files where double quotes (") should be used
  • Call libraries by the library reference, e.g string.match('foo', 'bar')
    • With the exception of on variables, e.g foo:match('bar')
  • Multiline comment should use --, as --[[ ]] is reserved for documentation
  • Define local variables for table references when referring more than twice
commented

Contribution guidelines should probably be handled in the .github subdirectory.

commented

Would like feedback on both of these.

commented

Contribution Guidelines (WIP)

Submitting Issues

Before submitting an issue, make sure of the following:

  • oUF is updated to the latest version
  • It's not a layout-caused issue
  • Occurs with only oUF and the layout loaded
  • Issue is reproducible

When submitting a bug report, please provide the following:

  • Error log (if relevant)
  • Screenshot (if relevant)
  • Short snippet of code (proof-of-concept)
  • Detailed explanation

Submitting Pull Requests

  • Make a fork of the repository and make sure it's up-to-date to the master branch
  • Create a new branch for your fork
  • Follow the code styleguides
  • Keep commits concise
    • Commit messages should be prefixed with the element you're modifying
      (see commit history for examples)
    • No all-in-one commits spanning multiple files and features
  • Submit as a pull request
  • Make sure you keep up with feedback as needed
commented
commented

@haste tell me if you need further specs on that when your time permits. Return values for functions are missing for now.