Home

daschl edited this page Jun 14, 2012 · 20 revisions
Clone this wiki locally

This plugin adds uber-awesome coding standards to your Lithium application.

Supported Lithium Specs:

Files

Spec Status Rule
Filenames should be CamelCase. Implemented HasCorrectFilename
There should be no whitespace before/after open/close tags. Implemented BeginsWithOpenTag, EndsWithCloseTag
The close tag should be on the last line. Implemented HasNoEOLatEOF
There should be no new line char after the closing tag. Implemented HasNoEOLatEOF
The file should be encoded in UTF-8. Implemented HasCorrectEncoding
Default permissions for folders should be octal 0755, and for files octal 0644. Partially Implemented IsNotExecutable
Line Lengths should not exceed 100 chars. Implemented DoesntExceedMaxLineLength
There should be no trailing whitespace at the end of a line. Implemented HasNoTrailingWhitespace
No short open tags should be used. Implemented BeginsWithOpenTag

Indentations

Spec Status Rule
Indentations should use tabs. Implemented HasTabsAsIndentation
Intendations should be symmetrical. Not Implemented -

Operators

Spec Status Rule
Operators should be surrounded by spaces (see exceptions). Not Implemented -

Control Structures

Spec Status Rule
Control structures should be surrounded by spaces. Not Implemented -
Curly brackets should always be used. Not Implemented -
Opening curly brackets should be placed on the same line as the control structure. Not Implemented -
Closing curly brackets should be placed on new lines. Not Implemented -
Switch statements should be correctly indented. Not Implemented -

Variables & Constants

Spec Status Rule
Normal variables should start with a lowercase letter and should use camelBack. Implemented HasCorrectVariableNames
Constants should be defined in capital letters and should use underscores. Not Implemented -
Casts should not have whitespace in them, but one afterwards. Not Implemented -

Functions

Spec Status Rule
Function names should be written in camelBack. Implemented HasCorrectFunctionNames
Functions should be called without space between function's name and starting bracket. Not Implemented -
There should be one space between every parameter of a function call. Not Implemented -
Functions without bodies should have the braces on the same line. Not Implemented -

Classes

Spec Status Rule
Class names should be written in CamelCase. Implemented HasCorrectClassName
A protected method or variable name start with a single underscore. Partly implemented (only checks for single underscore yes/no on protected methods) Variables to follow. ProtectedMethodStartsWithUnderscore
No private methods are allowed. Implemented HasNoPrivateMethods

Namespaces & Importing

Spec Status Rule
Namespaces appear directly after the opening php tag, separated by an empty line. Not Implemented -
Any static dependencies appear as one block after the namespace declaration, separated by an empty line. Not Implemented -
Namespaces should be written in lowercase singular form. Not Implemented -
No braces around includes. Not Implemented -
Always use require_once. Not Implemented -
Names appearing after the use keyword are always fully qualified but must not have a leading backslash.. Not Implemented -

Errors & Exceptions

Spec Status Rule
Sentences usually end with a period. Not Implemented -