Embed Instructions

Across all 195 projects, 87.41% of the source code conforms to the same coding conventions

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

Analysis of Coding Conventions

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

Back to top

View project specific report

Project
Consistency

Short array syntax used

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

Current
Key Method Use
no no 49.81%
preferred by 41.45% of projects
yes - Most popular method yes 50.19%
preferred by 56.48% of projects
undecided 2.07% of projects are undecided

Based on 496,105 array definitions in 193 projects

109 projects prefer yes

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 53.1%
preferred by 29.29% of projects
yes yes 46.9%
preferred by 45.71% of projects
undecided 25% of projects are undecided

Based on 14,121 array definitions in 140 projects

Historical
  • 01 Dec 2015: there was a 0.8% swing from no to yes
    • Anchor CMS saw a 19.05% swing from no to yes
    • Chamilo saw a 4.97% swing from no to yes
    • Monolog saw a 12.5% swing from no to yes
    • Chamilo added 77 array definitions using yes
  • 01 Nov 2016: there was a 1.11% swing from no to yes
  • 01 May 2017: there was a 2.16% swing from no to yes
    • OpenEMR removed 783 array definitions using no

Spacing after string concat

How many spaces follow the string concatenation operator?

Current
Key Method Use
0 0 38.19%
preferred by 12.5% of projects
1 - Most popular method 1 54.08%
preferred by 73.37% of projects
newline newline 7.56%
preferred by 1.63% of projects
Other other 0.17%
undecided 12.5% of projects are undecided

Based on 425,345 concat operators in 184 projects

135 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.65% swing away from 0
    • Zikula saw a 3.52% swing away from 0
    • Chamilo removed 7404 concat operators using 0
  • 01 Dec 2015: there was a 0.64% swing from 1 to 0
  • 01 Oct 2016: there was a 1.18% swing away from newline
    • OpenEMR saw a 6.94% swing away from newline
    • OpenEMR removed 5793 concat operators using newline
    • there was a 1.1% swing towards 0
    • OpenEMR saw a 5.79% swing towards 0
    • OpenEMR added 1577 concat operators using 0
  • 01 Nov 2016: there was a 0.61% swing away from 0
  • 01 May 2017: there was a 0.93% swing towards 0
    • OpenEMR saw a 7.14% swing towards 0
    • concrete5 added 361 concat operators using 0
    • there was a 1.12% swing away from 1
    • OpenEMR saw a 12.65% swing away from 1
    • OpenEMR removed 16775 concat operators using 1

Spacing before string concat

How many spaces precede the string concatenation operator?

Current
Key Method Use
0 0 38.91%
preferred by 12.5% of projects
1 - Most popular method 1 56.56%
preferred by 62.5% of projects
newline newline 3.85%
preferred by 1.63% of projects
Other other 0.67%
undecided 23.37% of projects are undecided

Based on 425,345 concat operators in 184 projects

115 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.63% swing away from 0
    • Chamilo removed 7448 concat operators using 0
  • 01 Dec 2015: there was a 0.62% swing from 1 to 0
  • 01 Oct 2016: there was a 1.12% swing from 1 to 0
    • OpenEMR saw a 6.86% swing away from 1
    • OpenEMR saw a 5.95% swing towards 0
    • OpenEMR removed 9057 concat operators using 1 and added 1593 concat operators using 0
  • 01 Nov 2016: there was a 0.63% swing away from 0
  • 01 May 2017: there was a 0.96% swing towards 0
    • OpenEMR saw a 7.67% swing towards 0
    • concrete5 added 410 concat operators using 0
    • there was a 1.47% swing away from newline
    • OpenEMR saw a 10.88% swing away from newline
    • OpenEMR removed 6988 concat operators using newline

Spacing after cast statement

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

Current
Key Method Use
0 - Most popular method 0 59.02%
preferred by 15.47% of projects
1 1 40.97%
preferred by 77.35% of projects
2 2 < 0.01%
preferred by 0% of projects
8 8 < 0.01%
preferred by 0% of projects
undecided 7.18% of projects are undecided

Based on 37,410 cast statements in 181 projects

140 projects prefer 1

Historical
  • 01 Mar 2015: there was a 0.66% swing from 1 to 0
  • 01 Apr 2015: there was a 0.56% swing from 1 to 0
    • Chamilo saw a 5.86% swing away from 1
    • TYPO3 CMS saw a 3.17% swing from 1 to 0
    • Chamilo saw a 5.83% swing towards 0
    • Chamilo removed 188 cast statements using 1
  • 01 Oct 2016: there was a 1.81% swing from 1 to 0
    • OpenEMR saw a 38.5% swing from 1 to 0
    • OpenEMR removed 1132 cast statements using 1
  • 01 Nov 2016: there was a 2.15% swing from 0 to 1
    • Moodle saw a 3.14% swing from 0 to 1
    • TYPO3 CMS removed 330 cast statements using 0 and added 6 cast statements using 1

Class defined in namespace

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

Current
Key Method Use
no no 38.93%
preferred by 14.36% of projects
yes - Most popular method yes 61.07%
preferred by 84.1% of projects
undecided 1.54% of projects are undecided

Based on 51,599 classes in 195 projects

164 projects prefer yes

3 projects are undecided

Historical
  • 01 Jun 2015: there was a 0.68% swing from yes to no
  • 01 Sep 2015: there was a 3.81% swing from yes to no
  • 01 Nov 2015: there was a 0.6% swing from no to yes
    • Chamilo saw a 4.45% swing from no to yes
    • phpMyAdmin saw a 70.26% swing from no to yes
  • 01 Dec 2015: there was a 1.96% swing from no to yes
    • Chamilo saw a 12.09% swing from no to yes
    • TYPO3 CMS saw a 39.86% swing from no to yes
    • Chamilo added 270 classes using yes
    • TYPO3 CMS removed 1318 classes using no
  • 01 Feb 2016: there was a 0.7% swing from no to yes
    • pimcore saw a 4.55% swing from no to yes
    • pimcore added 576 classes using yes
  • 01 Oct 2016: there was a 1.89% swing from yes to no
    • OpenEMR saw a 54.95% swing from yes to no
    • OpenEMR removed 2179 classes using yes
  • 01 Nov 2016: there was a 2.27% swing from no to yes
  • 01 Jan 2017: there was a 0.81% swing from no to yes
    • PHPUnit saw a 93.75% swing from no to yes

Lowercase filename

Are PHP filenames lowercase?

Current
Key Method Use
no - Most popular method no 64.85%
preferred by 87.18% of projects
yes yes 35.15%
preferred by 6.15% of projects
undecided 6.67% of projects are undecided

Based on 58,202 files in 195 projects

170 projects prefer no

Historical
  • 01 Mar 2015: there was a 0.56% swing from yes to no
    • Chamilo removed 1377 files using yes
  • 01 Apr 2015: there was a 2.76% swing from yes to no
  • 01 May 2016: there was a 0.58% swing from yes to no
    • ownCloud saw a 32.66% swing from yes to no
  • 01 Jun 2016: there was a 1.23% swing from yes to no
  • 01 Oct 2016: there was a 1.63% swing from no to yes
    • OpenEMR saw a 32.13% swing from no to yes
    • OpenEMR removed 2425 files using no and added 9 files using yes
  • 01 Nov 2016: there was a 1.84% swing from yes to no
  • 01 May 2017: there was a 1.38% swing from no to yes

Class has doc comment

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

Current
Key Method Use
no no 33.71%
preferred by 16.41% of projects
yes - Most popular method yes 66.29%
preferred by 63.08% of projects
undecided 20.51% of projects are undecided

Based on 51,599 classes in 195 projects

123 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.67% swing from yes to no
    • Chamilo removed 1599 classes using yes
  • 01 Apr 2015: there was a 0.64% swing from yes to no
  • 01 Sep 2015: there was a 3.23% swing from yes to no
  • 01 Dec 2015: there was a 0.91% swing from yes to no
  • 01 Oct 2016: there was a 1.09% swing from no to yes
  • 01 Nov 2016: there was a 2.53% swing from no to yes
    • pimcore saw a 27.86% swing from no to yes
  • 01 Jan 2017: there was a 0.77% swing from yes to no
  • 01 May 2017: there was a 1.73% swing from yes to no

Function has doc comment

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

Current
Key Method Use
no no 29.34%
preferred by 5.64% of projects
yes - Most popular method yes 70.66%
preferred by 78.97% of projects
undecided 15.38% of projects are undecided

Based on 344,365 functions in 195 projects

154 projects prefer yes

Historical
  • 01 Sep 2015: there was a 5.05% swing from yes to no
  • 01 Oct 2016: there was a 1.08% swing from yes to no
    • OpenEMR saw a 22.54% swing from yes to no
    • OpenEMR removed 11790 functions using yes
  • 01 Nov 2016: there was a 1.67% swing from no to yes
    • RoboTask saw a 50.37% swing from no to yes
  • 01 May 2017: there was a 0.81% swing from yes to no

CamelCase class name

Are class names defined using CamelCase?

Current
Key Method Use
no no 27.23%
preferred by 7.18% of projects
yes - Most popular method yes 72.77%
preferred by 89.74% of projects
undecided 3.08% of projects are undecided

Based on 51,599 classes in 195 projects

175 projects prefer yes

Historical
  • 01 Sep 2015: there was a 4.68% swing from yes to no
  • 01 Dec 2015: there was a 2.25% swing from no to yes
    • Chamilo saw a 4.68% swing from no to yes
    • TYPO3 CMS saw a 39.71% swing from no to yes
    • Chamilo added 271 classes using yes
    • TYPO3 CMS removed 1312 classes using no
  • 01 Feb 2016: there was a 0.7% swing from yes to no
    • pimcore saw a 47.63% swing from yes to no
    • pimcore added 558 classes using no
  • 01 Oct 2016: there was a 1.38% swing from yes to no
    • OpenEMR saw a 37.65% swing from yes to no
    • OpenEMR removed 2178 classes using yes
  • 01 Nov 2016: there was a 1.22% swing from no to yes
  • 01 Jan 2017: there was a 0.7% swing from no to yes
    • PHPUnit saw a 93.75% swing from no to yes
  • 01 Apr 2017: there was a 0.89% swing from no to yes
    • OpenEMR saw a 6.62% swing from no to yes
    • pimcore saw a 53.67% swing from no to yes
    • pimcore removed 600 classes using no

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 - Most popular method new line 72.91%
preferred by 90.26% of projects
same line same line 27.09%
preferred by 7.69% of projects
undecided 2.05% of projects are undecided

Based on 327,783 functions in 195 projects

176 projects prefer new line

4 projects are undecided

Historical
  • 01 Sep 2015: there was a 2.23% swing from same line to new line
    • Pux saw a 48.99% swing from same line to new line
    • SugarCRM CE saw a 27.79% swing from same line to new line
    • SugarCRM CE added 23601 functions using new line
  • 01 Nov 2015: there was a 4.02% swing from same line to new line
    • TYPO3 CMS saw a 94.97% swing from same line to new line
  • 01 Mar 2016: there was a 1.41% swing from same line to new line
    • Anchor CMS saw a 88.8% swing from same line to new line
    • Faveo Help-desk saw a 75.09% swing from same line to new line
    • pimcore saw a 69.15% swing from same line to new line
  • 01 Oct 2016: there was a 0.8% swing from new line to same line
    • OpenEMR saw a 26.4% swing from new line to same line
    • OpenEMR removed 11266 functions using new line
  • 01 Nov 2016: there was a 2.54% swing from new line to same line
  • 01 May 2017: there was a 0.85% swing from new line to same line
    • OpenEMR saw a 12.33% swing from new line to same line
    • concrete5 added 3292 functions using same line
    • OpenEMR removed 2746 functions using new line

Use of ELSE IF or ELSEIF

Are elseif statements defined using elseif or else if?

Current
Key Method Use
else if else if 25.54%
preferred by 6.47% of projects
elseif - Most popular method elseif 74.46%
preferred by 86.47% of projects
undecided 7.06% of projects are undecided

Based on 28,831 elseif statements in 170 projects

147 projects prefer elseif

Historical
  • 01 Mar 2015: there was a 1.35% swing from else if to elseif
    • Chamilo saw a 14.7% swing from else if to elseif
    • Chamilo removed 922 elseif statements using else if
  • 01 Aug 2015: there was a 1.06% swing from else if to elseif
  • 01 Mar 2016: there was a 1.58% swing from else if to elseif
    • Anchor CMS saw a 53.33% swing from else if to elseif
    • pimcore saw a 95.6% swing from else if to elseif
    • phpMyAdmin removed 1 elseif statements using else if
  • 01 Jun 2016: there was a 0.66% swing from else if to elseif
    • Chamilo saw a 4.76% swing from else if to elseif
    • Joomla! CMS removed 15 elseif statements using else if and added 197 elseif statements using elseif
  • 01 Oct 2016: there was a 0.62% swing from elseif to else if
    • OpenEMR saw a 7.33% swing from elseif to else if
    • OpenEMR removed 757 elseif statements using elseif and added 36 elseif statements using else if
  • 01 Nov 2016: there was a 0.87% swing from else if to elseif
    • PHP Parser saw a 9.82% swing from else if to elseif
  • 01 May 2017: there was a 1.53% swing from elseif to else if
    • concrete5 saw a 31.3% swing from elseif to else if
    • OpenEMR saw a 11.38% swing from elseif to else if
    • React.http saw a 25% swing from elseif to else if
    • concrete5 added 330 elseif statements using else if
    • OpenEMR removed 977 elseif statements using elseif

Line indent

Are lines indented using spaces or tabs?

Current
Key Method Use
mixed mixed 0.35%
preferred by 0% of projects
spaces - Most popular method spaces 75.99%
preferred by 82.05% of projects
tabs tabs 23.66%
preferred by 16.92% of projects
undecided 1.03% of projects are undecided

Based on 7,638,391 indented lines in 195 projects

160 projects prefer spaces

2 projects are undecided

Historical
  • 01 Aug 2015: there was a 1.79% swing from tabs to spaces
    • PrestaShop saw a 81.97% swing from tabs to spaces
  • 01 Sep 2015: there was a 0.79% swing from tabs to spaces
  • 01 Nov 2015: there was a 4.62% swing from tabs to spaces
    • TYPO3 CMS saw a 96.62% swing from tabs to spaces
  • 01 Oct 2016: there was a 0.67% swing from spaces to tabs
    • OpenEMR saw a 9.14% swing from spaces to tabs
    • OpenEMR removed 218759 indented lines using spaces and added 1274 indented lines using tabs
  • 01 Nov 2016: there was a 1.36% swing from tabs to spaces
  • 01 May 2017: there was a 0.96% swing away from spaces
    • OpenEMR saw a 7.02% swing away from spaces
    • OpenEMR removed 134629 indented lines using spaces
    • there was a 0.61% swing towards tabs
    • OpenEMR saw a 5.3% swing towards tabs
    • concrete5 added 59752 indented lines using tabs

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 - Most popular method new line 76.22%
preferred by 90.26% of projects
same line same line 23.78%
preferred by 6.67% of projects
undecided 3.08% of projects are undecided

Based on 51,599 classes in 195 projects

176 projects prefer new line

Historical
  • 01 Feb 2015: there was a 0.75% swing from same line to new line
    • RoboTask saw a 55.44% swing from same line to new line
    • PHPMailer saw a 12.5% swing from same line to new line
    • QuickAppsCMS saw a 100% swing from same line to new line
  • 01 Mar 2015: there was a 0.81% swing from new line to same line
    • Chamilo saw a 11.47% swing from new line to same line
    • Chamilo removed 1662 classes using new line
  • 01 Jun 2015: there was a 0.77% swing from same line to new line
  • 01 Sep 2015: there was a 1.55% swing from same line to new line
    • Pux saw a 12.5% swing from same line to new line
    • SugarCRM CE saw a 24.7% swing from same line to new line
    • Stash saw a 5.56% swing from same line to new line
    • SugarCRM CE added 2998 classes using new line
  • 01 Nov 2015: there was a 6.8% swing from same line to new line
    • TYPO3 CMS saw a 96.78% swing from same line to new line
  • 01 Feb 2016: there was a 1.08% swing from new line to same line
    • pimcore saw a 3.7% swing from new line to same line
    • pimcore added 575 classes using same line
  • 01 Mar 2016: there was a 2.94% swing from same line to new line
    • Anchor CMS saw a 98.31% swing from same line to new line
    • Faveo Help-desk saw a 94.32% swing from same line to new line
    • pimcore saw a 96.46% swing from same line to new line
    • OpenEMR removed 13 classes using same line and added 293 classes using new line
  • 01 Oct 2016: there was a 0.81% swing from new line to same line
    • OpenEMR saw a 13.23% swing from new line to same line
    • OpenEMR removed 2179 classes using new line
  • 01 Nov 2016: there was a 3.73% swing from new line to same line
  • 01 May 2017: there was a 1.68% swing from new line to same line
    • OpenEMR saw a 10.85% swing from new line to same line
    • concrete5 added 880 classes using same line
    • OpenEMR removed 340 classes using new line

File has doc comment

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

Current
Key Method Use
no no 23.72%
preferred by 18.46% of projects
yes - Most popular method yes 76.28%
preferred by 79.49% of projects
undecided 2.05% of projects are undecided

Based on 58,201 files in 195 projects

155 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.92% swing from no to yes
    • Chamilo saw a 12.53% swing from no to yes
    • ownCloud saw a 3.44% swing from no to yes
    • Chamilo removed 1018 files using no
  • 01 Apr 2015: there was a 0.77% swing from yes to no
  • 01 Jun 2015: there was a 0.6% swing from yes to no
  • 01 Jan 2016: there was a 0.6% swing from yes to no
  • 01 Oct 2016: there was a 1% swing from yes to no
    • OpenEMR saw a 11.1% swing from yes to no
    • OpenEMR removed 2413 files using yes
  • 01 Nov 2016: there was a 1.44% swing from no to yes
  • 01 Jan 2017: there was a 1.01% swing from yes to no
  • 01 May 2017: there was a 1.54% swing from yes to no
    • OpenEMR saw a 5.8% swing from yes to no
    • Fractal saw a 4.55% swing from yes to no
    • concrete5 added 1112 files using no
    • OpenEMR removed 580 files using yes

Space before operator

How many spaces precede comparison, arithmetic and assignment operators?

Current
Key Method Use
0 0 21.3%
preferred by 1.05% of projects
1 - Most popular method 1 77.35%
preferred by 93.72% of projects
newline newline 1.17%
preferred by 0% of projects
Other other 0.18%
undecided 5.24% of projects are undecided

Based on 443,320 operators in 191 projects

179 projects prefer 1

0 projects prefer newline

Historical

Adjacent assignments aligned

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

Current
Key Method Use
no - Most popular method no 81.29%
preferred by 61.98% of projects
yes yes 18.71%
preferred by 11.46% of projects
undecided 26.56% of projects are undecided

Based on 191,954 assignment blocks in 192 projects

119 projects prefer no

Historical
  • 01 Sep 2015: there was a 0.71% swing from no to yes
  • 01 Oct 2016: there was a 0.79% swing from yes to no
    • OpenEMR saw a 7.52% swing from yes to no
    • OpenEMR removed 1970 assignment blocks using yes

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.)?

Current
Key Method Use
no - Most popular method no 84.01%
preferred by 94.36% of projects
yes yes 15.99%
preferred by 2.56% of projects
undecided 3.08% of projects are undecided

Based on 58,202 files in 195 projects

184 projects prefer no

Historical
  • 01 Apr 2015: there was a 0.82% swing from no to yes
  • 01 Oct 2016: there was a 0.76% swing from no to yes
    • OpenEMR saw a 19.82% swing from no to yes
    • OpenEMR removed 2402 files using no
  • 01 Nov 2016: there was a 1.15% swing from yes to no
  • 01 May 2017: there was a 0.66% swing from no to yes

One class per file

Is each class defined in a file by itself?

Current
Key Method Use
no no 15.46%
preferred by 1.03% of projects
yes - Most popular method yes 84.54%
preferred by 96.41% of projects
undecided 2.56% of projects are undecided

Based on 51,599 classes in 195 projects

188 projects prefer yes

Historical
  • 01 Sep 2015: there was a 5.27% swing from yes to no
  • 01 Dec 2015: there was a 2.4% swing from no to yes
  • 01 Feb 2016: there was a 0.94% swing from yes to no
    • pimcore saw a 53.17% swing from yes to no
    • pimcore added 571 classes using no
  • 01 Oct 2016: there was a 0.73% swing from yes to no
    • OpenEMR saw a 5.22% swing from yes to no
    • OpenEMR removed 2179 classes using yes
  • 01 Nov 2016: there was a 1.23% swing from no to yes
  • 01 Apr 2017: there was a 0.99% swing from no to yes
    • pimcore saw a 50.98% swing from no to yes
    • pimcore removed 570 classes using no

CamelCase method name

Are class method names defined using CamelCase?

Current
Key Method Use
no no 12.56%
preferred by 2.05% of projects
yes - Most popular method yes 87.44%
preferred by 95.9% of projects
undecided 2.05% of projects are undecided

Based on 310,710 methods in 195 projects

187 projects prefer yes

Historical
  • 01 Mar 2015: there was a 0.86% swing from no to yes
    • Chamilo removed 3964 methods using no
  • 01 Sep 2015: there was a 1.19% swing from no to yes
    • Pux saw a 4.74% swing from no to yes
    • SugarCRM CE saw a 16.54% swing from no to yes
    • SugarCRM CE added 23435 methods using yes
  • 01 Nov 2016: there was a 0.65% swing from no to yes

PHP constant case

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

Current
Key Method Use
lower - Most popular method lower 87.83%
preferred by 87.11% of projects
mixed mixed 0.07%
preferred by 0% of projects
upper upper 12.1%
preferred by 11.86% of projects
undecided 1.03% of projects are undecided

Based on 322,763 PHP constants in 194 projects

169 projects prefer lower

2 projects are undecided

Historical
  • 01 Sep 2015: there was a 1.47% swing from lower to upper
  • 01 Nov 2015: there was a 3.28% swing from upper to lower
  • 01 Dec 2015: there was a 2.01% swing from upper to lower
  • 01 Jan 2016: there was a 0.57% swing from upper to lower
    • Chamilo saw a 15.06% swing from upper to lower
    • Chamilo removed 4293 PHP constants using upper
  • 01 Apr 2016: there was a 1.06% swing from lower to upper
    • AWS SDK for PHP saw a 18.96% swing from lower to upper
    • AWS SDK for PHP removed 941 PHP constants using lower and added 3305 PHP constants using upper
  • 01 Nov 2016: there was a 3.88% swing from lower to upper
  • 01 Dec 2016: there was a 0.59% swing from lower to upper

Private method prefixed with underscore

Are private methods prefixed with an underscore?

Current
Key Method Use
no - Most popular method no 88.44%
preferred by 93.89% of projects
yes yes 11.56%
preferred by 3.82% of projects
undecided 2.29% of projects are undecided

Based on 10,443 private methods in 131 projects

123 projects prefer no

3 projects are undecided

Historical
  • 01 Apr 2015: there was a 2.07% swing from yes to no
  • 01 May 2015: there was a 0.58% swing from yes to no
    • Chamilo saw a 7.5% swing from yes to no
    • Chamilo removed 33 private methods using yes
  • 01 Nov 2016: there was a 0.88% swing from yes to no
  • 01 May 2017: there was a 2.95% swing from yes to no
    • OpenEMR saw a 63.29% swing from yes to no
    • PHP_CodeSniffer saw a 100% swing from yes to no
    • OpenEMR removed 315 private methods using yes and added 2 private methods using no

Inline comment style

What comment style is used for non docblock comments?

Current
Key Method Use
# ... # ... 2.48%
preferred by 0.53% of projects
/* ... */ /* ... */ 8.11%
preferred by 0% of projects
// ... - Most popular method // ... 89.41%
preferred by 82.35% of projects
undecided 17.11% of projects are undecided

Based on 404,397 inline comments in 187 projects

1 project prefers # ...

0 projects prefer /* ... */

154 projects prefer // ...

Historical

Number of newlines at EOF

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

Current
Key Method Use
0 0 6.79%
preferred by 1.03% of projects
1 - Most popular method 1 91.12%
preferred by 95.38% of projects
2 2 1.61%
preferred by 0% of projects
Other other 0.48%
undecided 3.59% of projects are undecided

Based on 55,483 files in 195 projects

2 projects prefer 0

186 projects prefer 1

Historical

Spaces after control structure open parenthesis

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

Current
Key Method Use
0 - Most popular method 0 91.79%
preferred by 97.94% of projects
1 1 8.03%
preferred by 1.55% of projects
Other other 0.18%
undecided 0.52% of projects are undecided

Based on 523,603 control structures in 194 projects

190 projects prefer 0

3 projects prefer 1

1 project is undecided

Historical

Constant name case

What case are user-defined constants defined in?

Current
Key Method Use
lower lower 0.88%
preferred by 1.27% of projects
mixed mixed 6.79%
preferred by 0.63% of projects
upper - Most popular method upper 92.33%
preferred by 98.1% of projects

Based on 23,624 constants in 158 projects

2 projects prefer lower

1 project prefers mixed

155 projects prefer upper

Historical
  • 01 Mar 2015: there was a 3.21% swing away from upper
    • Chamilo removed 16303 constants using upper
    • there was a 2.86% swing towards mixed

Line length

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

Current
Key Method Use
80 or less - Most popular method 80 or less 92.4%
preferred by 99.49% of projects
81-120 81-120 6.16%
preferred by 0% of projects
121-150 121-150 0.82%
preferred by 0% of projects
151 or more 151 or more 0.61%
preferred by 0% of projects
undecided 0.51% of projects are undecided

Based on 9,660,667 lines in 195 projects

194 projects prefer 80 or less

1 project is undecided

Historical

Spaces before control structure close parenthesis

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

Current
Key Method Use
0 - Most popular method 0 92.54%
preferred by 98.45% of projects
1 1 7.44%
preferred by 1.55% of projects
Other other 0.01%

Based on 523,603 control structures in 194 projects

191 projects prefer 0

3 projects prefer 1

Historical

PHP closing tag at EOF

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

Current
Key Method Use
no - Most popular method no 93.47%
preferred by 97.95% of projects
yes yes 6.53%
preferred by 0.51% of projects
undecided 1.54% of projects are undecided

Based on 58,202 files in 195 projects

191 projects prefer no