Embed Instructions

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

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

Analysis of Coding Conventions for Drupal

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

Conventions

Analysis of Coding Conventions for Drupal

Back to top

View project specific report

Project
Consistency

Function opening brace placement

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

Current
Key Method Use
new line new line 38.07%
same line - Most popular method same line 61.93%

Based on 20,630 functions

Historical

Class opening brace placement

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

Current
Key Method Use
new line new line 36.69%
same line - Most popular method same line 63.31%

Based on 4,037 classes

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
.inc .inc 20.64%
.module .module 14.22%
.php - Most popular method .php 65.14%

Based on 436 non-class files

Historical

PHP constant case

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

Current
Key Method Use
lower lower 30.58%
upper - Most popular method upper 69.42%

Based on 19,026 PHP constants

Historical

Array end comma

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

Current
Key Method Use
no no 21.64%
yes - Most popular method yes 78.36%

Based on 379 array definitions

Historical

CamelCase class name

Are class names defined using CamelCase?

This project is using the popular method for this convention

Current
Key Method Use
no no 15.33%
yes - Most popular method yes 84.67%

Based on 4,037 classes

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 12.38%
1 - Most popular method 1 84.98%
2 2 0.08%
newline newline 2.57%

Based on 10,165 concat operators

Historical

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 85.13%
yes yes 14.87%

Based on 7,967 assignment blocks

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 14.42%
yes - Most popular method yes 85.58%

Based on 4,037 classes

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 12.2%
1 - Most popular method 1 86.01%
newline newline 1.64%
Other other 0.15%

Based on 10,165 concat operators

Historical

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 90.01%
yes yes 9.99%

Based on 4,305 files

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 9.59%
yes - Most popular method yes 90.41%

Based on 4,037 classes

Historical

Function has doc comment

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

This project is using the popular method for this convention

Current
Key Method Use
no no 9.47%
yes - Most popular method yes 90.53%

Based on 23,392 functions

Historical

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 6.34%
elseif - Most popular method elseif 93.66%

Based on 1,325 elseif statements

Historical

Spacing after cast statement

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

Current
Key Method Use
0 0 5.33%
1 - Most popular method 1 94.67%

Based on 976 cast statements

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 94.99%
81-120 81-120 3.74%
121-150 121-150 0.8%
151 or more 151 or more 0.47%

Based on 530,936 lines

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.35%
/* ... */ /* ... */ 4.53%
// ... - Most popular method // ... 95.12%

Based on 23,273 inline comments

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 4.16%
yes - Most popular method yes 95.84%

Based on 4,037 classes

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 96.29%
newline newline 3.71%

Based on 77,804 object operators

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 3.53%
yes - Most popular method yes 96.47%

Based on 4,305 files

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 1.79%
1 - Most popular method 1 97%
2 2 1.18%
3 3 0.02%

Based on 4,305 files

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 1.51%
1 - Most popular method 1 97.06%
Other other 1.43%

Based on 14,979 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 1.4%
yes - Most popular method yes 98.6%

Based on 19,617 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 98.72%
yes yes 1.28%

Based on 4,305 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 99.09%
yes yes 0.91%

Based on 21,212 array definitions

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 99.37%
yes yes 0.63%

Based on 4,305 files

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.61%
yes yes 0.39%

Based on 29,045 control structures

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.69%
1 1 0.23%
3 3 0.02%
newline newline 0.06%

Based on 26,443 control structures

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 99.71%
1 1 0.29%

Based on 29,593 control structures

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.18%
1 - Most popular method 1 99.73%
2 2 0.06%
newline newline 0.04%

Based on 104,316 operators

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.8%
yes yes 0.2%

Based on 494 private methods

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.83%
1 1 0.17%
2 2 0.01%

Based on 29,567 control structures

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
mixed mixed 0.12%
upper - Most popular method upper 99.88%

Based on 804 constants

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 99.96%
1 1 0.04%

Based on 26,443 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.02%
upper upper < 0.01%

Based on 172,353 keywords

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.98%
tabs tabs 0.01%

Based on 409,934 indented lines

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.98%
yes yes 0.02%

Based on 106,808 statements

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 77,804 object operators

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 4,305 open tags

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 2,130 global functions

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 3,869 class files

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 100%

Based on 21,019 array definitions

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 10 echo statements

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 4,305 files

Historical