Embed Instructions

98.2% of the project's source code conforms to the same coding conventions

  • Image URL
    https://squizlabs.github.io/PHP_CodeSniffer/analysis/piwik/piwik/grade.svg
  • Markdown
    [![Code consistency](https://squizlabs.github.io/PHP_CodeSniffer/analysis/piwik/piwik/grade.svg)](https://squizlabs.github.io/PHP_CodeSniffer/analysis/piwik/piwik)
Aconsistency

Analysis of Coding Conventions for Piwik

PHP_CodeSniffer, using a custom coding standard and report, was used to record various coding conventions across 197 PHP projects.

Conventions

Analysis of Coding Conventions for Piwik

Back to top

View project specific report

Project
Consistency

Function has doc comment

Does each function have a docblock comment to describe its purpose?

Current
Key Method Use
no - Most popular method no 53.38%
yes yes 46.62%

Based on 8,336 functions

Historical

Spacing after cast statement

How many spaces are there between a cast statement and the variable?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 54.39%
1 1 45.61%

Based on 399 cast statements

Historical

Class has doc comment

Does each class have a docblock comment to describe its purpose?

This project is using the popular method for this convention

Current
Key Method Use
no no 38.19%
yes - Most popular method yes 61.81%

Based on 1,427 classes

Historical

Array end comma

Does the last item end with a comma in a multi-line array definition?

Current
Key Method Use
no - Most popular method no 62.81%
yes yes 37.19%

Based on 449 array definitions

Historical
  • 01 Feb 2015: there was a 6.01% swing from no to yes

Adjacent assignments aligned

For a block of assignments, are the assignment operators (equals, plus-equals etc.) aligned?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 66.33%
yes yes 33.67%

Based on 3,822 assignment blocks

Historical

Number of newlines at EOF

How many newline characters appear at the end of the file?

This project is using the popular method for this convention

Current
Key Method Use
0 0 17.75%
1 - Most popular method 1 80.07%
2 2 2.12%
4 4 0.07%

Based on 1,465 files

Historical
  • 01 Jun 2015: there was a 4.12% swing away from 0
    • there was a 5.51% swing towards 1

Use of ELSE IF or ELSEIF

Are elseif statements defined using elseif or else if?

This project is using the popular method for this convention

Current
Key Method Use
else if else if 16.2%
elseif - Most popular method elseif 83.8%

Based on 284 elseif statements

Historical
  • 01 Jun 2015: there was a 20.83% swing from else if to elseif

Lowercase filename

Are PHP filenames lowercase?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 86.73%
yes yes 13.27%

Based on 1,469 files

Historical

PascalCase class name

Are class names defined using PascalCase?

This project is using the popular method for this convention

Current
Key Method Use
no no 11.21%
yes - Most popular method yes 88.79%

Based on 1,427 classes

Historical

Line length

Including whitespace and comments, how many characters are in non-empty code lines?

This project is using the popular method for this convention

Current
Key Method Use
80 or less - Most popular method 80 or less 90.16%
81-120 81-120 8.58%
121-150 121-150 0.93%
151 or more 151 or more 0.33%

Based on 161,653 lines

Historical

Spacing before string concat

How many spaces precede the string concatenation operator?

This project is using the popular method for this convention

Current
Key Method Use
0 0 1.73%
1 - Most popular method 1 90.3%
2 2 0.02%
newline newline 7.95%

Based on 4,919 concat operators

Historical

Declarations and side effects mixed

Do files both declare symbols (classes, functions, constants, etc.) and cause side-effects (e.g. generate output, change .ini settings, etc.)?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 93.67%
yes yes 6.33%

Based on 1,469 files

Historical

Spacing after string concat

How many spaces follow the string concatenation operator?

This project is using the popular method for this convention

Current
Key Method Use
0 0 1.38%
1 - Most popular method 1 96.4%
2 2 0.22%
newline newline 1.99%

Based on 4,919 concat operators

Historical

CamelCase method name

Are class method names defined using CamelCase?

This project is using the popular method for this convention

Current
Key Method Use
no no 2.31%
yes - Most popular method yes 97.69%

Based on 7,890 methods

Historical

Class defined in namespace

Is each class defined in a namespace of at least 1 level?

This project is using the popular method for this convention

Current
Key Method Use
no no 2.1%
yes - Most popular method yes 97.9%

Based on 1,427 classes

Historical

File has doc comment

Does each PHP file have a docblock comment to describe its purpose?

This project is using the popular method for this convention

Current
Key Method Use
no no 1.97%
yes - Most popular method yes 98.03%

Based on 1,469 files

Historical

Inline comment style

What comment style is used for non docblock comments?

This project is using the popular method for this convention

Current
Key Method Use
# ... # ... 0.37%
/* ... */ /* ... */ 1.5%
// ... - Most popular method // ... 98.14%

Based on 4,077 inline comments

Historical

Blank lines at start of control structure

How many blank lines precede the body of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 98.15%
1 1 1.85%

Based on 10,134 control structures

Historical

Space before operator

How many spaces precede comparison, arithmetic and assignment operators?

This project is using the popular method for this convention

Current
Key Method Use
0 0 0.13%
1 - Most popular method 1 98.24%
newline newline 1.63%

Based on 4,601 operators

Historical

One class per file

Is each class defined in a file by itself?

This project is using the popular method for this convention

Current
Key Method Use
no no 0.98%
yes - Most popular method yes 99.02%

Based on 1,427 classes

Historical

Blank lines at end of control structure

How many blank lines follow the body of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 99.42%
1 1 0.58%

Based on 10,084 control structures

Historical

Spacing before object operator

How many spaces precede the object operator (->)?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 99.61%
newline newline 0.39%

Based on 35,547 object operators

Historical

PHP constant case

What case are PHP constants (true, false, null) written in?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 99.64%
upper upper 0.36%

Based on 5,261 PHP constants

Historical

Space after operator

How many spaces follow comparison, arithmetic and assignment operators?

This project is using the popular method for this convention

Current
Key Method Use
0 0 0.02%
1 - Most popular method 1 99.8%
2 2 0.03%
newline newline 0.15%

Based on 32,953 operators

Historical

Class opening brace placement

Is the opening brace of a class on the same line as the class keyword or the next line?

This project is using the popular method for this convention

Current
Key Method Use
new line - Most popular method new line 99.86%
same line same line 0.14%

Based on 1,427 classes

Historical

Line indent

Are lines indented using spaces or tabs?

This project is using the popular method for this convention

Current
Key Method Use
mixed mixed < 0.01%
spaces - Most popular method spaces 99.88%
tabs tabs 0.12%

Based on 129,352 indented lines

Historical

Control structure defined inline

Are control structures defined inline (without braces)?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.88%
yes yes 0.12%

Based on 9,536 control structures

Historical

Function opening brace placement

Is the opening brace of a function on the same line as the function keyword or the next line?

This project is using the popular method for this convention

Current
Key Method Use
new line - Most popular method new line 99.93%
same line same line 0.07%

Based on 8,194 functions

Historical

Private method prefixed with underscore

Are private methods prefixed with an underscore?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.93%
yes yes 0.07%

Based on 1,469 private methods

Historical

PHP closing tag at EOF

Is there a PHP closing tag at the end of the file?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.93%
yes yes 0.07%

Based on 1,469 files

Historical

Multiple statements on same line

Are multiple statements defined on the same line of code?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 99.95%
yes yes 0.05%

Based on 46,430 statements

Historical

Spaces after control structure open parenthesis

How many spaces follow the opening parenthesis of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 99.97%
1 1 0.01%
newline newline 0.02%

Based on 8,999 control structures

Historical

PHP keyword case

What case are PHP keywords (function, echo, foreach etc.) written in?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 99.97%
mixed mixed < 0.01%
upper upper 0.03%

Based on 64,664 keywords

Historical

Array keyword case

When defining an array, how is the array keyword written?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 99.98%
mixed mixed 0.02%

Based on 5,037 array definitions

Historical

Closure opening brace placement

Is the opening brace of a closure on the same line as the function keyword or the next line?

This project is using the popular method for this convention

Current
Key Method Use
same line - Most popular method same line 100%

Based on 255 closures

Historical

PHP short open tag used

Is the PHP short open tag syntax used?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 100%

Based on 2,346 open tags

Historical

PHP type case

What case are PHP types (int, bool, string) written in?

This project is using the popular method for this convention

Current
Key Method Use
lower - Most popular method lower 100%

Based on 486 PHP types

Historical

File extension for non-class files

For files that do not contain classes, what extension does the file use?

This project is using the popular method for this convention

Current
Key Method Use
.php - Most popular method .php 100%

Based on 56 non-class files

Historical

Short array syntax used

Are arrays defined using the PHP 5.4+ short array syntax?

Current
Key Method Use
no - Most popular method no 100%

Based on 5,037 array definitions

Historical

Spaces before control structure close parenthesis

How many spaces precede the closing parenthesis of a control structure?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 100%

Based on 8,999 control structures

Historical

File extension for class files

For files that contain classes, what extension does the file use?

This project is using the popular method for this convention

Current
Key Method Use
.php - Most popular method .php 100%

Based on 1,413 class files

Historical

Spacing after object operator

How many spaces follow the object operator (->)?

This project is using the popular method for this convention

Current
Key Method Use
0 - Most popular method 0 100%

Based on 35,547 object operators

Historical

Brackets around echoed strings

Are parenthesis placed around echo'd strings?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 100%

Based on 56 echo statements

Historical

Constant name case

What case are user-defined constants defined in?

This project is using the popular method for this convention

Current
Key Method Use
upper - Most popular method upper 100%

Based on 927 constants

Historical

CamelCase function name

Are global function names defined using CamelCase?

This project is using the popular method for this convention

Current
Key Method Use
no - Most popular method no 100%

Based on 4 global functions

Historical

EOL char

What character is used for line breaks?

This project is using the popular method for this convention

Current
Key Method Use
\n - Most popular method \n 100%

Based on 1,469 files

Historical