-
Notifications
You must be signed in to change notification settings - Fork 667
VexFlow Coding Style
0xFE edited this page Oct 13, 2015
·
11 revisions
- Code must be readable.
- Code must be testable.
- In general, try to stick with the conventions in the existing code.
- No hard-tabs. Use 2 spaces.
- Comments get preprocessed through Docco. This allows Markdown in comments.
- Take a look at
src/accidentals.js
for commenting boilerplate.- In particular, note the header at the top of the file.
- If you contributed significantly to the file, feel free to add an "Author:" comment below the copyright.
- All methods and parameters must be documented.
- Run
grunt docco
to regenerate the documentation indocs/
. - Take a look at docs/accidental.html for an example of a generated document.
- Respect API boundaries. If you don't want your code to break, don't reach into its internals. E.g., prefer
note.getStave()
tonote.stave
. - Run
grunt jshint
before sending in a pull request.
If you're writing code that requires a new file, e.g., a new element, class, modifier, etc.
- Create the
.js
file insrc/
- Add the file to
SOURCES
inGruntfile
. - Add a test file to
tests/
.- If your file was called
slurs.js
the test file should beslurs_test.js
.
- If your file was called
- Add
VF.Test.YourTest.Start()
totests/run.js
- Run
grunt
to lint, build, and generate docs, and visually inspect the docs to verify correctness.
[ VexFlow.com ] [ API ] [ GitHub Repo ] [ Contributors ]