Coding Style Homogenization
Rainrider opened this issue ยท 8 comments
Code review, guidelines, contribution guide.
- Lint existing files
- Create code styleguide
- Create contribution guidelines
Work being done in the lint branch.
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
- e.g
- Global functions (methods) should be named in "pascal case"
- e.g
OneTwoThree
- e.g
- 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
becomesmath_abs
- With the exception of libraries, e.g
- 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')
- With the exception of on variables, e.g
- Multiline comment should use
--
, as--[[ ]]
is reserved for documentation - Define local variables for table references when referring more than twice
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
- Commit messages should be prefixed with the element you're modifying
- Submit as a pull request
- Make sure you keep up with feedback as needed
Moved to https://github.com/oUF-wow/oUF/wiki/Guidelines-for-Layout-oriented-Documentation to ease collaboration (wiki has revisions)
@haste tell me if you need further specs on that when your time permits. Return values for functions are missing for now.