Embed Instructions

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

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

Analysis of Coding Conventions for OpenEMR

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 OpenEMR

Back to top

View project specific report

Project
Consistency

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 36.55%
1 - Most popular method 1 45.83%
newline newline 17.09%
Other other 0.53%

Based on 48,661 concat operators

Historical
  • 01 Oct 2016: there was a 6.93% swing away from newline
    • there was a 5.78% swing towards 0
  • 01 May 2017: there was a 7.12% swing towards 0
    • there was a 5.58% swing towards newline
    • there was a 12.66% swing away from 1
  • 01 Mar 2018: there was a 4.67% swing towards 0
    • there was a 3.28% swing away from 1

Use of ELSE IF or ELSEIF

Are elseif statements defined using elseif or else if?

Current
Key Method Use
else if - Most popular method else if 53.94%
elseif elseif 46.06%

Based on 3,430 elseif statements

Historical
  • 01 Oct 2016: there was a 7.32% swing from elseif to else if
  • 01 May 2017: there was a 11.37% swing from elseif to else if
  • 01 Mar 2018: there was a 13.02% swing from elseif to else if
  • 01 Aug 2018: there was a 3.69% swing from else if to elseif

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

Based on 1,531 classes

Historical
  • 01 Aug 2016: there was a 4.1% swing from no to yes
  • 01 Oct 2016: there was a 54.91% swing from yes to no
  • 01 May 2017: there was a 3.64% swing from yes to no
  • 01 Mar 2018: there was a 37.89% swing from no to yes

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 38.02%
1 - Most popular method 1 57.56%
2 2 1.32%
Other other 3.1%

Based on 48,661 concat operators

Historical
  • 01 Oct 2016: there was a 5.94% swing towards 0
    • there was a 6.84% swing away from 1
  • 01 May 2017: there was a 7.64% swing towards 0
    • there was a 10.88% swing away from newline
  • 01 Mar 2018: there was a 4.55% swing towards 0
    • there was a 4.19% swing away from 1

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

Based on 2,570 files

Historical
  • 01 Oct 2016: there was a 11.06% swing from yes to no
  • 01 May 2017: there was a 5.77% swing from yes to no
  • 01 Mar 2018: there was a 21.9% swing from yes to no

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 58.68%
yes yes 41.32%

Based on 2,570 files

Historical
  • 01 Aug 2016: there was a 3.22% swing from yes to no
  • 01 Oct 2016: there was a 32.02% swing from no to yes
  • 01 Apr 2017: there was a 3.73% swing from yes to no
  • 01 Mar 2018: there was a 15.88% swing from yes to no

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 35.83%
1 - Most popular method 1 63.85%
Other other 0.32%

Based on 46,548 operators

Historical
  • 01 Oct 2016: there was a 5.77% swing towards 0
    • there was a 5.52% swing away from 1
  • 01 May 2017: there was a 21.07% swing away from 0
    • there was a 21.49% swing towards 1

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

Based on 21,582 functions

Historical
  • 01 Oct 2016: there was a 22.49% swing from yes to no
  • 01 May 2017: there was a 18.02% swing from yes to no
  • 01 Mar 2018: there was a 36.55% swing from no to yes

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

Based on 18,821 methods

Historical
  • 01 Aug 2016: there was a 3.61% swing from no to yes
  • 01 Oct 2016: there was a 23.31% swing from yes to no
  • 01 May 2017: there was a 10.61% swing from yes to no
  • 01 Mar 2018: there was a 27.82% swing from no to yes

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

Based on 1,531 classes

Historical
  • 01 Aug 2016: there was a 4.31% swing from no to yes
  • 01 Oct 2016: there was a 37.82% swing from yes to no
  • 01 Apr 2017: there was a 6.63% swing from no to yes
  • 01 Jul 2017: there was a 5.27% swing from no to yes
  • 01 Mar 2018: there was a 19.62% swing from no to yes

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 79.31%
1 1 20.69%

Based on 551 cast statements

Historical
  • 01 Aug 2016: there was a 4.46% swing from 0 to 1
  • 01 Oct 2016: there was a 38.5% swing from 1 to 0
  • 01 May 2017: there was a 7.41% swing from 1 to 0
  • 01 Mar 2018: there was a 16.72% swing from 1 to 0

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 79.57%
yes yes 20.43%

Based on 2,570 files

Historical
  • 01 Oct 2016: there was a 19.73% swing from no to yes
  • 01 May 2017: there was a 7.59% swing from yes to no
  • 01 Mar 2018: there was a 7.76% swing from yes to no

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 82.98%
yes yes 17.02%

Based on 10,780 assignment blocks

Historical
  • 01 Oct 2016: there was a 7.55% swing from yes to no
  • 01 May 2017: there was a 4.38% swing from yes to no

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 9.94%
1 - Most popular method 1 84.53%
newline newline 4.99%
Other other 0.54%

Based on 168,545 operators

Historical
  • 01 Oct 2016: there was a 5.68% swing towards 0
    • there was a 5.78% swing away from 1
  • 01 May 2017: there was a 13.44% swing away from 0
    • there was a 13.1% swing towards 1
  • 01 Mar 2018: there was a 4.29% swing away from 0
    • there was a 4.9% swing towards newline

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

Based on 1,531 classes

Historical
  • 01 Oct 2016: there was a 22.78% swing from no to yes
  • 01 May 2017: there was a 8.9% swing from yes to no
  • 01 Jul 2017: there was a 4.74% swing from no to yes
  • 01 Mar 2018: there was a 12.1% swing from no to yes

Short array syntax used

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

Current
Key Method Use
no - Most popular method no 86.44%
yes yes 13.56%

Based on 20,883 array definitions

Historical
  • 01 Mar 2018: there was a 12.33% swing from no to yes

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 89.33%
yes yes 10.67%

Based on 178 private methods

Historical
  • 01 Mar 2016: there was a 3.48% swing from yes to no
  • 01 Oct 2016: there was a 10.4% swing from no to yes
  • 01 Apr 2017: there was a 5.3% swing from yes to no
  • 01 May 2017: there was a 63.29% swing from yes to no
  • 01 Mar 2018: there was a 4.49% swing from no to yes

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.22%
81-120 81-120 6.66%
121-150 121-150 1.65%
151 or more 151 or more 1.47%

Based on 643,929 lines

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 90.98%
yes yes 9.02%

Based on 721 array definitions

Historical
  • 01 Oct 2016: there was a 6.77% swing from yes to no

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
# ... # ... 1.03%
/* ... */ /* ... */ 5.24%
// ... - Most popular method // ... 93.73%

Based on 31,746 inline comments

Historical
  • 01 May 2017: there was a 3.88% swing away from /* ... */
    • there was a 3.63% swing towards // ...

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 93.93%
yes yes 6.07%

Based on 2,570 files

Historical
  • 01 Feb 2016: there was a 4.03% swing from yes to no
  • 01 Mar 2016: there was a 9.72% swing from yes to no
  • 01 Oct 2016: there was a 18.7% swing from no to yes
  • 01 Apr 2017: there was a 5.04% swing from no to yes
  • 01 May 2017: there was a 12% swing from no to yes
  • 01 Aug 2017: there was a 43.45% swing from yes to no

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 2.7%
.php - Most popular method .php 97.3%

Based on 1,075 non-class files

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

Based on 1,531 classes

Historical
  • 01 Oct 2016: there was a 5.23% swing from yes to no
  • 01 Jul 2017: there was a 3.96% swing from no to yes

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
lower lower 0.88%
mixed mixed 0.98%
upper - Most popular method upper 98.13%

Based on 1,018 constants

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 98.51%
yes yes 1.49%

Based on 25,927 echo statements

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 98.54%
yes yes 1.46%

Based on 53,481 control structures

Historical
  • 01 Oct 2016: there was a 3.55% swing from no to yes
  • 01 May 2017: there was a 5.94% swing from no to yes
  • 01 Aug 2017: there was a 15.79% swing from yes to no

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.29%
tabs tabs 0.71%

Based on 541,223 indented lines

Historical
  • 01 Aug 2016: there was a 4.06% swing from tabs to spaces
  • 01 Oct 2016: there was a 9.26% swing away from spaces
    • there was a 8.77% swing towards tabs
  • 01 Apr 2017: there was a 3.98% swing from spaces to tabs
  • 01 May 2017: there was a 6.31% swing away from spaces
    • there was a 5.57% swing towards tabs
  • 01 Aug 2017: there was a 33.18% swing towards spaces
    • there was a 31.12% swing away from tabs

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 99.42%
\r\n \r\n 0.58%

Based on 2,570 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 0.25%
1 - Most popular method 1 99.75%
2 2 0%

Based on 2,024 files

Historical
  • 01 Feb 2016: there was a 4.15% swing away from 0
    • there was a 4.12% swing towards 1
  • 01 Oct 2016: there was a 5.59% swing towards 0
    • there was a 9.77% swing away from 1
    • there was a 3.83% swing towards 2
  • 01 Apr 2017: there was a 8.35% swing towards 0
    • there was a 7.67% swing away from 1
  • 01 May 2017: there was a 7.75% swing towards 0
    • there was a 3.89% swing away from 1
    • there was a 4% swing away from 2
  • 01 Aug 2017: there was a 25.05% swing away from 0
    • there was a 26.53% swing towards 1

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.76%
same line same line 0.24%

Based on 21,462 functions

Historical
  • 01 Oct 2016: there was a 26.28% swing from new line to same line
  • 01 May 2017: there was a 12.22% swing from new line to same line
  • 01 Aug 2017: there was a 70.85% swing from same line to new line

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.84%
1 1 0.16%

Based on 52,904 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.85%
1 1 0.07%
newline newline 0.08%

Based on 75,297 object operators

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.86%
yes yes 0.14%

Based on 166,433 statements

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.87%
same line same line 0.13%

Based on 1,531 classes

Historical
  • 01 Aug 2016: there was a 4.75% swing from same line to new line
  • 01 Oct 2016: there was a 13.08% swing from new line to same line
  • 01 Apr 2017: there was a 8.34% swing from new line to same line
  • 01 May 2017: there was a 10.64% swing from new line to same line
  • 01 Jul 2017: there was a 3.98% swing from new line to same line
  • 01 Aug 2017: there was a 44.17% swing from same line to new line

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 99.93%
1 1 0.07%

Based on 75,297 object operators

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 217,903 keywords

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.99%
1 1 < 0.01%
newline newline 0.01%

Based on 47,845 control structures

Historical
  • 01 Aug 2017: there was a 8.93% swing from 1 to 0

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

Based on 52,871 control structures

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 52 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 135,360 open tags

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%
1 1 0%

Based on 47,845 control structures

Historical
  • 01 May 2017: there was a 3.21% swing from 0 to 1
  • 01 Aug 2017: there was a 9.9% swing towards 0
    • there was a 9.75% swing away from 1

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,495 class files

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 991 global functions

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%
mixed mixed 0%

Based on 18,051 array definitions

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

Based on 18,959 PHP constants

Historical
  • 01 Oct 2016: there was a 3.24% swing away from lower
    • there was a 3.12% swing towards upper
  • 01 May 2017: there was a 3.62% swing away from lower
    • there was a 3.46% swing towards upper
  • 01 Aug 2017: there was a 10.59% swing towards lower
    • there was a 10.17% swing away from upper

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 582 PHP types

Historical