Embed Instructions

97.73% 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 196 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 39.32%
same line - Most popular method same line 60.68%

Based on 21,058 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 38.03%
same line - Most popular method same line 61.97%

Based on 4,126 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 31.28%
upper - Most popular method upper 68.72%

Based on 19,249 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 22.02%
yes - Most popular method yes 77.98%

Based on 386 array definitions

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 13.26%
1 - Most popular method 1 83.62%
2 2 0.08%
newline newline 3.05%

Based on 10,365 concat operators

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 13.62%
1 - Most popular method 1 84.6%
newline newline 1.63%
Other other 0.14%

Based on 10,366 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 84.86%
yes yes 15.14%

Based on 8,093 assignment blocks

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

Based on 4,126 classes

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.11%
yes - Most popular method yes 85.89%

Based on 4,126 classes

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.21%
yes yes 9.79%

Based on 4,394 files

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.55%
yes - Most popular method yes 90.45%

Based on 23,834 functions

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.38%
yes - Most popular method yes 90.62%

Based on 4,126 classes

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.67%
elseif - Most popular method elseif 93.33%

Based on 1,364 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.37%
1 - Most popular method 1 94.63%

Based on 1,006 cast statements

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.86%
// ... - Most popular method // ... 94.79%

Based on 23,437 inline comments

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

Based on 539,990 lines

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.07%
yes - Most popular method yes 95.93%

Based on 4,126 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 3.46%
yes - Most popular method yes 96.54%

Based on 4,394 files

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.77%
newline newline 3.23%

Based on 90,376 object operators

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.55%
1 - Most popular method 1 97.04%
Other other 1.42%

Based on 15,315 operators

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.75%
1 - Most popular method 1 97.06%
2 2 1.16%
3 3 0.02%

Based on 4,394 files

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
new line new line 2.69%
same line - Most popular method same line 97.31%

Based on 223 closures

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.43%
yes - Most popular method yes 98.57%

Based on 20,013 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.75%
yes yes 1.25%

Based on 4,394 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.1%
yes yes 0.9%

Based on 21,441 array definitions

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 99.15%
mixed mixed 0.85%

Based on 4,103 PHP types

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.39%
yes yes 0.61%

Based on 4,394 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,552 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.7%
1 1 0.23%
3 3 0.01%
newline newline 0.06%

Based on 26,910 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.19%
1 - Most popular method 1 99.72%
2 2 0.06%
newline newline 0.04%

Based on 105,500 operators

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.72%
1 1 0.28%

Based on 30,106 control structures

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.81%
yes yes 0.19%

Based on 529 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.82%
1 1 0.17%
2 2 0.01%

Based on 30,080 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 827 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,910 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 174,748 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 416,587 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 108,540 statements

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,396 open tags

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 90,376 object operators

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,958 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,248 array definitions

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

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 11 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,394 files

Historical