1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Introduce coding style guidelines

This commit is contained in:
Jermolene 2014-01-12 16:56:05 +00:00
parent e254529763
commit a4f895dc4d
3 changed files with 45 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,15 @@
created: 20131101111400000
modified: 20140110101537722
modified: 20140112164329806
tags: introduction
title: Contributing
type: text/vnd.tiddlywiki
TiddlyWiki5 welcomes contributions to its code and documentation via [[GitHub|https://github.com/Jermolene/TiddlyWiki5]]. Please take a moment to read these notes to help make the process as smooth as possible.
!! Coding Style
Code contributions should follow the [[TiddlyWiki Coding Style Guidelines]].
!! GitHub Issues
We use GitHub Issues to manage bug reports, feature requests for TiddlyWiki. To maintain their effectiveness we endeavour to have as few open issues as possible.

View File

@ -0,0 +1,39 @@
title: TiddlyWiki Coding Style Guidelines
tag: dev
! Motivation
TiddlyWiki is a large project with many interested parties. It benefits everyone if the code is as easy to read as possible. A key part of that it must be written and laid out consistently.
! Guidelines
!! Tabs and whitespace
TiddlyWiki uses 4-character tabs for indenting.
One blank line is used to separate blocks of code. Occasional blank lines are permitted within blocks for clarity, but should be avoided unless they solve a specific readability problem.
!! Layout of basic constructs
See the following example for layout of basic JavaScript constructs:
```
/*
Multiline comments are used to introduce a block of code such as a function definition
*/
function demoFunction(param,more) {
// Proper sentence capitalisation for comments
if(condition == "something") {
// No space between "if" and the brackets; always spaces around operators
myOtherFunction(one,two); // No whitespace within function parameters
do {
myCondition.explore(); // Always use semicolons
} while(myCondition < worsens);
}
}
```
!! Strings
Double quotes are preferred over single quotes for string literals.