joomla/coding-standards

[META] Finalizing PHPCS 2.x support

mbabker opened this issue · 112 comments

Extracted from #109 (comment)

  • In the ruleset.xml there are some pear rules with adjusted messages that we either need to accept messages reporting spaces or will need to create custom copies to properly report the number of tabs.

  • Fix ControlStructuresBrackets sniff issues with the unitTests.

  • Testing against the CMS needs a custom ruleset as a custom standard to mute some errors. The readme has some explanations for adjustments. An example xml file should be included. I also can provide an xml example (code in previous comment way back) and another xml example for projects that have php5.4+ requirements like the Joomla-stats repo (xml code in previous comment just above)

  • Review what our custom sniffs are based on for changes in PHPCS 2.7.x that need to be adopted into our custom sniffs.

  • review for consistency with the old ruleset warnings/errors from phpcs 1.5.x (after the automatic fixers and manual fixes the 1.5.x ruleset should not throw any warnings/errors due to the code style phpcs 2.7.x version being applied. (I've been occasionally running against the CMS admin components for this check, I've only completed PR's for 3 or 4 components)

  • Merge coding standards manual to phpcs-2 branch

  • consider/implement [Proposal] Code standards change to implement psr-2 multiline class params for more readability joomla/joomla-cms#13438

@mbabker where do you think the example xml files for selectively applying rules should live in the repo?

Added in ExampleRulesets via #152

  • Add composer instructions

Just notice this new issue with InstantiateNewClasses fixer as shown in the InstantiateNewClassUnitTest
If we instantiate a New Class as $k = new self(); we end up with $k = new ;
See https://travis-ci.org/photodude/coding-standards/jobs/200657756

InstantiateNewClass issue has been fixed, Thanks @wilsonge

we also have a bunch of Missing @package tag in file comment (Joomla.Commenting.FileComment.MissingPackageTag) issues now being reported as of phpcs 2.7.1+
fixed in #150

As best I can tell the ControlStructuresBrackets sniff issues are related to the section that deals with bracket indenting. https://github.com/joomla/coding-standards/blob/phpcs-2/Joomla/Sniffs/ControlStructures/ControlStructuresBracketsSniff.php#L148-L192

~~Likely in the str_repeat() with tabs~~~

ControlStructuresBrackets sniff issues have been fixed, Thanks @wilsonge

@wilsonge Are you still up for helping to work on these issues so we can move forward with the Alpha release?

This is the Branch I'm working with to try and create a PR to solve these issues.
https://github.com/photodude/coding-standards/tree/patch-2

@rdeutz If your interested, this is the current list of Items to address with the PHPCS2 branch for a public alpha release of the updated standard with autofixers.

@nibra, @810, @vess if you are interested in continuing to follow the path to a public alpha release for the PHPCS2 branch, or contributing to fixing any of the issues in the PHPCS2 version of the standards prior to the alpha release this is issue to follow.

I very much am!

I've done fixes for the InstantiateNewClasses and the ControlStructuresBrackets for the patch-5 (i made them against patch-2 like you asked - but locally been testing against patch-5 given that was where your unit test was running against that you linked to) branch and then the package tag warning looks correct to me

  • fix cs errors in code style custom sniffs
    fixed in #150

added a number of fixes see

  • #152 for Testing against the CMS needs a custom ruleset
  • #151 fix for a newly found bug with how docblock tags are reported
  • #150 fix for code style issues

Still need to

  • address the messages for PEAR.Functions.FunctionCallSignature.Indent and PEAR.Functions.FunctionDeclaration.Indent
    we need to decide on one of the following

    • Accept messages reporting spaces
    • Accept messages reporting spaces and Add a note about autofixer will convert spaces to tabs
    • Create custom copies of these sniffs to properly adjust and report the number of tabs found/expected. (this has a high maintenance cost in the long run)
  • Add composer instructions

  • consider/implement [Proposal] Code standards change to implement psr-2 multiline class params for more readability

after that, I think the other review items can happen with the public alpha

@mbabker @wilsonge Once we merge PRs 150-153 we just need to add composer instructions and we are set for the Alpha release. All other items are changes to the existing ruleset or are review items that can be handled with the alpha release.

I've merged #150, #151 and #152. I want to have a quick look over #153 later today to convince myself that it is the best solution :)

I've added some composer install information (based on the framework composer instructions)

With the merge of #153 we can check off the first item about dealing with the adjusted messages.
That leaves the review items and the proposed change to adopt the PSR-2 multiline class params.

How do we want to proceed with those items and making the official Alpha release?

Added a task on merging the manual to the right branch too since that's no longer in a self-contained branch (more of a reminder than anything since the dev site will read the manual from the master branch).

I think there are also some changes to the IDE section in the Master branch that will need to be merged into the into phpcs-2 as well.

So with merging #153 where does that leave us here?

The blog post needs to be finalized, @wilsonge have you reviewed the draft of that?

Dev Blog post

  • Finalize the Dev blog post about the public alpha release
  • Publish the Dev blog post about the public alpha release
    • Scheduled for publication on 2017/03/01

Create the release file(s)

  • Create release file(s) and packagist item(s)

Travis

  • add .travis.yml stub to master/1.x
  • add repo to travis ci for testing

As for other tasks, all of the following I feel can be addressed during the public alpha

Review

  • Review what our custom sniffs are based on for changes in PHPCS 2.7.x that need to be adopted into our custom sniffs.
  • Review for consistency with the old ruleset warnings/errors from phpcs 1.5.x after the automatic fixers and manual fixes have been applied

Updates

  • Merge coding standards manual to phpcs-2 branch
  • Merge changed IDE items to phpcs-2 branch (probably needs another review and update too)

Changes

Blog post looked good to me :)

@mbabker Are we good now to release the public alpha?

Custom Sniffs Review

  • Classes/InstantiateNewClassesSniff.php
    • Based on (this seems to be a fully custom sniff)
    • Reason for Custom sniff
      • Instanciating new class without parameters does not require brackets.
    • reviewed on 2017/02/19
  • Commenting/ClassCommentSniff.php
    • Based on PEAR.Commenting.ClassComment Sniff
    • Reason for Custom sniff
      • Tags are in a different order and have different requierments,
    • reviewed on 2017/02/19
  • Commenting/FileCommentSniff.php
    • Based on PEAR.Commenting.FileComment Sniff
    • Reason for Custom sniff
      • Tags are in a different order, don't ignore some things, difference in some tag processing
    • reviewed on 2017/02/19
      • see update PR #160
  • Commenting/FunctionCommentSniff.php
    • Based on (extends) PEAR.Commenting.FunctionComment Sniff
    • also based on Squiz.Commenting.FunctionComment Sniff
    • Reason for Custom sniff
      • Extended ruleset for parsing and verifying the doc comments for functions
      • we have a difference in our spaces to force alignment with @return
    • reviewed on 2017/02/19
  • Commenting/SingleCommentSniff.php
    • Based on PEAR.Commenting.InlineComment Sniff
    • Reason for Custom sniff
      • differences in SingleComment coding standards
    • reviewed on 2017/02/19
  • ControlStructures/ControlSignatureSniff.php
    • Based on Squiz.ControlStructures.ControlSignature sniff
    • Reason for Custom sniff
      • differences in control structure coding standards
    • reviewed on 2017/02/19
  • ControlStructures/ControlStructuresBracketsSniff.php
    • Based on PEAR.Classes.ClassDeclaration Sniff
    • Reason for Custom sniff
      • Checks if the declaration of control structures is correct Curly brackets must be on a line by their own
    • reviewed on 2017/02/14
  • ControlStructures/WhiteSpaceBeforeSniff.php
    • Based on (this seems to be a fully custom sniff)
    • Reason for Custom sniff
      • Checks that there is an empty line before a control structure or return statement
    • reviewed on 2017/02/19
  • Functions/StatementNotFunctionSniff.php
    • Based on PEAR.Files.IncludingFile Sniff
    • Reason for Custom sniff
      • add tokens so sniff covers all php statements
    • reviewed on 2017/02/19
  • NamingConventions/ValidFunctionNameSniff.php
    • Based on PEAR.NamingConventions.ValidFunctionName
    • Reason for Custom sniff
      • Extends PEAR.NamingConventions.ValidFunctionName.processTokenWithinScope to remove the requirement for leading underscores on private method names.
    • reviewed on 2017/02/19
      • PR for update #158
  • NamingConventions/ValidVariableNameSniff.php
    • Based on (extends) Squiz.NamingConventions.ValidVariableName Sniff
    • Reason for Custom sniff
      • changes to processMemberVar function in the sniff to ignore the Private member variable "%s" must contain a leading underscore requierment
    • reviewed on 2017/02/19
  • Operators/ValidLogicalOperatorsSniff.php
    • Based on Squiz.ValidLogicalOperators Sniff
    • Reason for Custom sniff
      • Exceptions for things like or jexit(), or JSession, or define, or sendResponse, or sendJsonResponse
    • reviewed on 2017/02/19
  • WhiteSpace/MemberVarSpacingSniff.php
    • Based on (extends) Squiz.WhiteSpace.MemberVarSpacing Sniff
    • Reason for Custom sniff
      • There needs to be 1 blank line before the var, not counting comments.
    • reviewed on 2017/02/19
      • PR for update #157

I have completed a review of our custom stiffs against the PHPCS core sniffs they are based on, (as best I could tell) Details of the review are posted above, and PR's have been opened for the related changes.

@mbabker what is the plan on releasing the public alpha?

I'm working with my marketing liaison on getting the blog post scheduled for publishing (hopefully this coming week) then we'll sort out a timeline.

Blog is scheduled for tomorrow.

Any thoughts on merging PR #159

  • merged

@mbabker with the blog post scheduled for tomorrow what is the plan on tagging the alpha release?

I'd say the next week or two.

I attempted to sync the master changes over to the phpcs-2 branch, but I definitely did something wrong in git and broke the branch I was making the attempt on. I'm starting to think the two branches have diverged too much and we'll just have to cherry pick the commits we want to bring over. Then again, maybe someone who is better skilled at git could make the rebase/merge sync from master to phpcs-2 without breaking everything like I did.

I think I can help with this :) You can't rebase. But I think merging gives not-so-bad conflicts at a very quick glance? Is there a time we can skype and I can help you with this?

@wilsonge that would be great. We got about a 6 hour time difference to figure out for scheduling (and I've never skyped) I have some additional availability this week I'm sure we can work something out. Do you have my email (or twitter) for direct messaging?

  • Merge coding standards manual to phpcs-2 branch

With PR #168 and PR #167 are we good to finalize the change over?

Are we good to go with a tagged alpha release now?

a while ago I created this https://github.com/joomla-projects/docker-joomla-cms-phpcs for the 1.x code styles, I think it should be easy to tweak it to use the 2.x code styles. So we could let them run side by side and compare

Go for it :)

@rdeutz I recommend using the example sub-ruleset for the CMS that is included with the 2.x version in the master branch.
https://github.com/joomla/coding-standards/tree/master/Joomla/ExampleRulesets/Joomla-CMS/ruleset.xml

This sub-ruleset will exclude the portions of the CMS that are not tested.
more details are in the readme https://github.com/joomla/coding-standards#selectively-applying-rules

Are we good to go with a tagged alpha release now? The review items can happen during the Alpha release.

@mbabker please check off "Merge coding standards manual", that has been completed.

The last item listed for review is the review for consistency with the old ruleset, this is something that I feel can, and should, be done during the alpha release phase and completed with the beta release phase.

Is there anything holding back tagging an alpha release?

Off the top of my head, I don't think so. I keep meaning to get folks together to start up a subteam in automated testing to take full lead on this and let you all manage the repo and release schedule for the tooling, hopefully with a little of the slowdown between 3.7 and starting up on 3.8 I can find time for that.

Would it be possible to get the alpha release tagged so public testing can go forward and let the subteam fall into place as the team is put together?

https://github.com/joomla/coding-standards/releases/tag/2.0.0-alpha

We can throw more resources into this over the next couple of weeks.

Thank you

I have done a baseline test of the alpha release with the CMS using the example ruleset for the CMS.
As expected I got no new errors reported.

Using the full ruleset I got the expected errors for things like failure to use camelCased naming.

you can see the configuration I used for .travis.yml and composer.json in my cms fork patch 9 https://github.com/photodude/joomla-cms/tree/patch-9

note: the composer.json file for the standard fails to correctly install the standard. Some minor adjustment will be needed to fix the path.

810 commented

What is the plan for fixing the codestyles issues.

separate pr's for Joomla 3.7?
For 3.8 or 4.0.

First thing PHPCBF?

For the CMS It's going to take several phases. (nothing is officially set)

The current (first) phase that I have been working towards is taking certain excluded folders and bringing them up to standard with the automatic fixers via PHPCBF (the admin components are one area, see the example ruleset for the CMS for exclusion folders. All but 3rd party vendor folders should have this applied to; as the 3rdparty/vendor folders should never be modified)
This is done in small PR's to simplify code reviews, testing, and merging. I've done this one component at a time. See joomla/joomla-cms#11989 for an example of the most recent one I did.

Phase two is dealing with any errors/warnings in the excluded folders that do not have automatic fixes requiring manual changes.

Phase three is dealing with excluded sniffs for things like camelCased naming which changing cause depreciations and BC breaks. Some may not be able to be changed due to relations with database column naming which would be very major BC breaks (well in a major version like 4.0 or 5.0 we might get away with those major BC breaks).

Each phase will require that it's done with many small PR's to avoid causing problems with open PR's and to keep the code reviews, testing, and merging as simple as possible.

(these are my thoughts on a plan, nothing is officially in place)

@mbabker @wilsonge can we tag an alpha.2 release since #180 was merged.
After tagging a new release, we should probably plan for an alpha release dev blog post similar to the pre-release announcement that was made back in March.

bump to consider tagging an alpha.2 release since #180 was merged. /cc @mbabker @wilsonge

I'm going to let @mbabker deal with the actual tagging of things. I'm just the monkey doing patches to the codesniffer repo :P

Alpha 2 tagged.

In case you're interested: Took the master here and started updating it for phpcs 3.0.x -- first cut at it is at
https://github.com/pkware/coding-standards in the phpcs3 branch. It runs, but haven't addressed the unit tests for it yet because I haven't decided if I want to take on updating it from phpunit 4 to phpunit 6 while I'm at it. Ordinarily I wouldn't have hesitated; seems rather silly to be fixed on a version of phpunit that is no longer supported (after all, we're always hounding people to upgrade their Joomla installations). But that's where the phpcs project itself is set as well, so it's less of a no-brainer.

@Paladin Definitely interested. We will need to move to PHPCS 3 at some point. The transition to PHPCS 3 is along with the transition for project support for < PHP 5.6

As for PHP Unit, I think version 6 is fine for a PHPCS 3.x branch. The only reason we stuck with PHPUnit 4.x was due to needing to support PHP 5.3 in the PHPCS2.x branch.

@mbabker What do you think about getting a PHPCS 3.x development branch started? My original thought was starting on 3.x after the stable release of the PHPCS2.x version. But thanks to @Paladin's work I think we can have that in the background,

3.x-dev branch opened.

As far as the PHPUnit stuff goes, there's no reason we have to lock onto only one PHPUnit version. In the Framework repos almost every package has a "^4.8.35|^5.4.3|~6.0" which allows us to consistently use the namespaced PHPUnit class names (required as of 6.0) and run a version appropriate for each PHP version branch.

I like the idea of moving tp phpunit6, but as I mentioned, the squizlabs "mothership" composer file specifies phpunit 4.x, so without opening the box and digging I'm not sure what balrogs may be lurking down there. Part of my deferring an attempt to convert the tests is I could never get the unit tests to run at all, not even from the v2 branch. Probably missing something simple.

There's not a whole lot to upgrading to phpcs v3; mainly it's namespacing things. I simply built off the existing names to build a namespace for it, e.g., "Joomla_Sniffs_Classes_InstantiateNewClassesSniff" became "InstantiateNewClassesSniff" in the namespace "Joomla\Sniffs\Classes." I cut a PR for the new dev branch this morning.

Question: How do you feel about some simple refactoring in some of these sniffs? (Smaller method size, trying to hide the complexity a little more, etc. Mess Detector really doesn't like some of the sniffs, even though they're written to be very similar to the original Squizlabs code they're derived from.) I would have done it already in my branch, but I dislike refactoring w/o tests to back me up and I wasn't sure if you wanted to maintain the parallelism to Sqizlabs' code.

I have always tried to maintain parallelism with PHPCS. In the long run it helps in maintaining the sniffs and the unit tests. Ideally we should only have a ruleset.xml to define our standard, but since we have code standard definitions that go beyond PHPCS we have custom sniffs to cover those specifications. (Occasionally we try to get stuff accepted into PHPCS). One of the biggest changes from our 1.x to 2.x was to remove the bulk of the duplication of PHPCS rules as custom sniffs and use the PHPCS rules where it is possible. It's all in an effort to make the code standard easier to maintain easier to comply with and more accurate to our code style manual. I guess that's enough rambling on about one of the design goals for moving to PHPCS 2.x. The point was that maintaining parallelism with PHPCS is an advantage since our custom sniffs are typically just minor deviations from existing PHPCS sniffs.

Understood, I'll leave them alone. It's just that every time I look at 100+ line methods I want to get out the ol' Veg-O-Matic.

@mbabker @wilsonge Any thoughts on moving towards a beta release for V2 with a plan for a stable release?

So far in testing the 2.x fixers on the CMS admin components vs the 1.x standard, I'm not seeing any issues. (it would be helpful if more people were testing/using the new fixers...)

I think it's time to get the CMS running this in full.

Since we are still technically alpha/beta on this; why don't we get the framework (or at least some of the framework) transitioned to this as a "proof of concept" and release a stable version.
Then we can get the 3.x CMS on the 2.x version and release a beta/stable for the 3.x series and get 4.x CMS on that.

I already have been.

Awesome, what's the next step?

Keep going with the rollout, fixing bugs as they pop up, and if we're comfortable with the stability let's aim for a beta during September (probably the week after the 3.8 release).

The Framework packages I've converted over were more for necessity than "wanting" to necessarily (they've always had failing PHPCS runs for things like required params after optional so I used the configurable ruleset to ignore that), that's all been good. The bug I opened the other day was based on code I'm currently working on (not yet public). Otherwise things seem fine.

@photodude Out of interest what's the result of running this on joomla/joomla-cms#17881 given it's miles out of line with the coding standards should be a good test for it?

@wilsonge I think that should be a good candidate for showing how the automatic fixers are useful for getting into compliance with the code standard. (unfortunately, I'm likely going to be unable to work on anything like this until mid December with my current project demands)

I'm still about a month out before I can really jump back into this.

@mbabker, @wilsonge, I suggest that we go ahead and release a beta for the 2.x code style and and alpha of the 3.x style. Reuse the last announcement on the code style release but change "alpha" to beta.

Plan for Joomla 3.9 on 2.x along with projects that still use php 5.3
Anything newer like Joomla 4 should plan for the 3.x style.

Any thoughts?

Let me finish converting the Framework onto 2.x and see where things are at. I think aside from lambda tabbing being reported wrong we're in good overall shape from my uses.

I haven't touched the 3 branch for a while, it's probably missing most of the last-minute fixes/changes @photodude might have made for the 2 branch; hopefully with what's there the rest will be easy to slip in. And I'm not sure what code style changes are coming with J4, if any (have not had the time to open that particular continens vermis yet).

@Paladin I've tried to keep up with the changes between the two branches. 3.x did get a custom sniff removal since PHPCS 3.1.x has added our requested change for member var line spacing options. That option is now in the 3.x ruleset.xml.

Aside from the fact we're using PHP 7 typehints/return typehints we haven't changed anything of any substance in J4.

The only real difference between the branches is one runs on PHPCS 2.9.x supporting PHP 5.3+ and the other runs on PHPCS 3.1.x supporting PHP 5.4+. Both apply the same core code style.

PHPCS 2.9.x is in a support only phase with serious bug and security fixes only (I'm not sure when it will no longer get support).
PHPCS 2.9.x is the only version supporting PHP 5.3. As such some Joomla projects still need this version.

Newer Projects like Joomla 4 have minimum PHP 7 and such PHPCS 3.x is a better choice for those as there is full support a new features (a chance to get better code style coverage).

Ok, I've got about 20 days of time off to get projects done around the house, spend time with family, review math for Thermodynamic cycles, and do something here for moving towards a release. (I know it's a lot of stuff and not a lot of time)
Any thoughts on a game plan for polishing things up and getting a stable release out?

review math for Thermodynamic cycles

Found this helpful for my physics masters https://www.youtube.com/watch?v=VnbiVw_1FNs although it does gloss over maxwell's equations slightly :P

Any thoughts on a game plan for polishing things up and getting a stable release out?

Have we gone through 3.x of the CMS yet? I've been merging the PR's as they've come in but I've slightly lost track of the bigger picture of how much we've covered. I don't think @mbabker has been through the framework 2.0 packages yet (although would be good if he could confirm and then I can pick that up).

#143 (comment)

Have we also fixed the lambda functions tabbing issue Michael mentioned here.

But I think once we've done those two things then we can start to get this going - the 2.x branch into Joomla 3.9 and the 3.x branch into J4

Have we gone through 3.x of the CMS yet?

It's been a while since I ran the code style checks against the full cms. The normal areas that are currently checked by the 1.x ruleset were still clean in that check. The PR's I've been submitting have been trying to clean up the Administrator area. But with all of the exclusions, There is still a lot of PR's to submit. We can continue to use the existing exclusions and clean up as necessary.

As for Lambda tabbing, that might be a PHPCS issue.

Thanks for the Thermo link I'll check that out.
This review plan through OCW, https://youtu.be/rvZZYeouz_I
Everything is going to be focused on Otto, Diesel, Brayton, and Rankine Cycles

As a proof of concept, I have "tricked" travis into running the 2.x code style checks against the CMS https://travis-ci.org/photodude/joomla-cms/builds/317437796

Lot's of errors, but a lot of that is related to required exceptions in the 1.x ruleset which were not in place for this test. Some of the items have open PRs to address auto-fixable items.

Need to tweak some things as I'm having issues getting the Joomla-CMS example ruleset to install and run. With the Joomla-CMS example ruleset we will be able to implement the proper exceptions

I've been able to get the example CMS ruleset to run now. The test passed.
https://travis-ci.org/photodude/joomla-cms/builds/317468656

One odd thing is the progress did not show while the test was running. I assume that's an issue with PHPCS running in default quiet mode even though the rulesets specify showing progress.

Something is wrong with the tests on Travis; when I run locally against the cms I get errors.

With a partial improved exclusion list, I get the following running against the CMS. Working through the rest of the current excludes in the CMS 1.5.x ruleset, and still trying to figure out why travis is having strange issues running with the CMS specific modifications to the ruleset.

----------------------------------------------------------------------
A TOTAL OF 9553 ERRORS AND 968 WARNINGS WERE FOUND IN 1147 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 7262 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

With almost all of the current exclusions in the CMS I get the following on local testing

----------------------------------------------------------------------
A TOTAL OF 8236 ERRORS AND 247 WARNINGS WERE FOUND IN 998 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 6965 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

There are a few more exclusions to add where old custom sniffs were replaced with core sniffs

I've got a preliminary exclusions list now. I'm working through this list to eliminate the overly broad exclusions on some of the sniffs where I exclude all tests, components, plugins, etc so we can get to just excluding the folder or single file that has problems.

Note, this has a lot more exclusions than the 1.5.x ruleset as the 1.5.x list didn't do as good of a job catching and enforcing our code style as the 2.x ruleset does.

<?xml version="1.0"?>
<ruleset name="Joomla-CMS">
	<arg name="report" value="full"/>
	<arg name="tab-width" value="4"/>
	<arg name="encoding" value="utf-8"/>
	<arg value="sp"/>

	<!-- Exclude folders not containing production code -->
	<exclude-pattern type="relative">^build/*</exclude-pattern>
	<exclude-pattern type="relative">docs/*</exclude-pattern>
	<exclude-pattern type="relative">cache/*</exclude-pattern>
	<exclude-pattern type="relative">tmp/*</exclude-pattern>
	<exclude-pattern type="relative">logs/*</exclude-pattern>

	<!-- Exclude 3rd party libraries and Framework code. -->
	<exclude-pattern type="relative">libraries/compat/password/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/fof/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/idna_convert/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/php-encryption/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/phputf8/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/simplepie/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/phpass/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/vendor/*</exclude-pattern>
	<exclude-pattern type="relative">libraries/joomla/*</exclude-pattern>
	<exclude-pattern type="relative">plugins/editors/*</exclude-pattern>
	<exclude-pattern type="relative">plugins/editors-xtd/*</exclude-pattern>
	<exclude-pattern type="relative">plugins/captcha/recaptcha/recaptcha.php</exclude-pattern>
	<exclude-pattern type="relative">plugins/captcha/recaptcha/recaptchalib.php</exclude-pattern>
	<exclude-pattern>*/vendor/*</exclude-pattern>
	<exclude-pattern>*/fof/*</exclude-pattern>

	<!-- Exclude the restore_finalisation until we can deal with nested class definitions -->
	<exclude-pattern type="relative">administrator/components/com_joomlaupdate/restore_finalisation.php</exclude-pattern>
	<exclude-pattern type="relative">administrator/components/com_joomlaupdate/restore.php</exclude-pattern>
	<exclude-pattern type="relative">configuration.php</exclude-pattern>
	<exclude-pattern type="relative">installation/template/index.php</exclude-pattern>
	
	<!-- Exclude some test related files that don't actually include PHP code -->
	<exclude-pattern type="relative">tests/unit/suites/libraries/joomla/model/stubs/barbaz.php</exclude-pattern>
	<exclude-pattern type="relative">tests/unit/suites/libraries/joomla/view/layouts1/fringe/division.php</exclude-pattern>
	<exclude-pattern type="relative">tests/unit/suites/libraries/joomla/view/layouts1/olivia.php</exclude-pattern>
	<exclude-pattern type="relative">tests/unit/suites/libraries/joomla/view/layouts1/peter.php</exclude-pattern>
	<exclude-pattern type="relative">tests/unit/suites/libraries/joomla/view/layouts2/fauxlivia.php</exclude-pattern>
	<exclude-pattern type="relative">tests/unit/suites/libraries/joomla/view/layouts2/olivia.php</exclude-pattern>
	<exclude-pattern type="relative">tests/unit/suites/libraries/legacy/controller/stubs/component1/controller.json.php</exclude-pattern>
	<exclude-pattern type="relative">tests/unit/suites/libraries/legacy/controller/stubs/component2/controller.php</exclude-pattern>
	
	<!-- Exclude the RoboFile.php -->
	<exclude-pattern type="relative">RoboFile.php</exclude-pattern>
	
	<!-- Include some additional sniffs from the Generic standard -->
	<rule ref="Generic.Arrays.DisallowShortArraySyntax">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">tests/codeception/*</exclude-pattern>
	</rule>
	<rule ref="Generic.ControlStructures.InlineControlStructure">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
	</rule>
	<rule ref="Generic.Files.EndFileNewline">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Generic.Files.LineLength">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
		<exclude-pattern type="relative">plugins/system/*</exclude-pattern>
		<exclude-pattern type="relative">plugins/search/*</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/cms/*</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/database/driver/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Access/Access.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Application/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Categories/Categories.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Renderer/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Client/FtpClient.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Component/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Document/Document.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Environment/Browser.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Factory.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Form/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Helper/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/HTML/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Http/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Installer/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Language/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Log/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/MVC/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Pathway/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Router/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Table/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Document/Renderer/Feed/AtomRenderer.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Document/Renderer/Html/HeadRenderer.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/legacy/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/cms/html/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_users/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_redirect/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_postinstall/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_newsfeeds/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_modules/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_menus/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_media/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_languages/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_installer/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_finder/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_fields/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_content/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_contact/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_categories/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_banners/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_associations/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_admin/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/modules/mod_latest/helper.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/modules/mod_logged/helper.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_finder/helpers/html/filter.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/featured/view.feed.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/category/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/category/view.feed.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/article/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/models/article.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/views/contact/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_tags/controller.php</exclude-pattern>
		<exclude-pattern type="relative">installation/model/database.php</exclude-pattern>
		<exclude-pattern type="relative">installation/form/field/sample.php</exclude-pattern>
		<exclude-pattern type="relative">modules/mod_articles_category/mod_articles_category.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Updater/Adapter/ExtensionAdapter.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Table/Table.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/loader.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/legacy/error/error.php</exclude-pattern>
		<exclude-pattern type="relative">plugins/user/profile/profile.php</exclude-pattern>
		<exclude-pattern type="relative">plugins/content/pagebreak/pagebreak.php</exclude-pattern>
		<exclude-pattern type="relative">plugins/authentication/cookie/cookie.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/plugins/content/emailcloak/PlgContentEmailcloakTest.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/core/case/cache.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/core/case/database/sqlsrv.php</exclude-pattern>
	</rule>
	<rule ref="Generic.Formatting.DisallowMultipleStatements">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Generic.Strings.UnnecessaryStringConcat">
		<!-- There is not auto fixer here. These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Helper/ContentHistoryHelper.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Helper/TagsHelper.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Table/Nested.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_modules/models/module.php</exclude-pattern>
		<exclude-pattern type="relative">modules/mod_tags_popular/helper.php</exclude-pattern>
		<exclude-pattern type="relative">plugins/search/content/content.php</exclude-pattern>
		<exclude-pattern type="relative">plugins/system/debug/debug.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/models/articles.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/modules/mod_menus/models/menus.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_joomlaupdate/models/default.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_menus/models/menus.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_menus/models/items.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_associations/models/associations.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/legacy/application/JApplicationTest.php</exclude-pattern>
	</rule>
	<rule ref="Generic.WhiteSpace.ScopeIndent">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	
	<!-- Include some additional sniffs from the PEAR standard -->
	<rule ref="PEAR.ControlStructures.MultiLineCondition">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="PEAR.Formatting.MultiLineAssignment">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">plugins/system/languagefilter/languagefilter.php</exclude-pattern>
	</rule>
	<rule ref="PEAR.Functions.FunctionCallSignature">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="PEAR.Functions.FunctionDeclaration">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="PEAR.Functions.ValidDefaultValue">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">administrator/components/com_contact/helpers/html/contact.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_content/helpers/html/contentadministrator.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/cms/component/router/stubs/ComContentRouter.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/cms/pagination/JPaginationObjectTest.php</exclude-pattern>
		<exclude-pattern type="relative">modules/mod_articles_category/helper.php</exclude-pattern>
	</rule>
	<rule ref="PEAR.NamingConventions.ValidClassName">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">installation/controller/install/database_backup.php</exclude-pattern>
		<exclude-pattern type="relative">installation/controller/install/database_remove.php</exclude-pattern>
	</rule>
	
	<!-- Include some additional sniffs from the Squiz standard -->
	<rule ref="Squiz.Commenting.BlockComment">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">plugins/editors/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Squiz.Commenting.VariableComment">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">tests/unit/core/mock/menu.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/stubs/bogusload.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/stubs/config.wrongclass.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/database/driver/mysql/JDatabaseExporterMysqlTest.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/cms/application/stubs/JApplicationCmsInspector.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/cms/component/router/stubs/ComContentRouter.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/cms/html/testfiles/inspector.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/cms/html/TestHelpers/JHtmlSelect-helper-dataset.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/cms/installer/JInstallerAdapterTest.php</exclude-pattern>
		<exclude-pattern type="relative">tests/unit/suites/libraries/legacy/view/JViewLegacyTest.php</exclude-pattern>
		<exclude-pattern type="relative">plugins/content/loadmodule/loadmodule.php</exclude-pattern>
		<exclude-pattern type="relative">plugins/system/debug/debug.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_users/views/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_tags/views/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_newsfeeds/helpers/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_redirect/helpers/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_redirect/views/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_search/views/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Form/Field/MediaField.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Menu/Node.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/MVC/View/CategoryView.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_plugins/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_installer/models/database.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_content/helpers/content.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_contenthistory/views/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_templates/views/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_messages/views/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_installer/views/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_languages/views/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_messages/models/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_fields/models/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_fields/libraries/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_fields/helpers/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_fields/controllers/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_categories/helpers/*</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_associations/helpers/associations.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/com_menus/helpers/menus.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_config/view/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/views/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_modules/views/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/models/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/models/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_tags/helpers/route.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_newsfeeds/models/category.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_newsfeeds/models/categories.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_finder/views/search/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/form/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/featured/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/article/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/views/archive/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/views/contact/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/views/catagory/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/models/featured.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/models/contact.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/models/catagory.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/models/catagories.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/router.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/router.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_newsfeeds/router.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/models/catagory.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/models/catagories.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/User/User.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Updater/UpdateAdapter.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Updater/Update.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/cms/less/formatter/joomla.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/modules/mod_menu/menu.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/modules/mod_quickicon/helper.php</exclude-pattern>
	</rule>
	<rule ref="Squiz.Strings.ConcatenationSpacing">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Squiz.WhiteSpace.ControlStructureSpacing">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Squiz.WhiteSpace.OperatorSpacing">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Squiz.WhiteSpace.ScopeClosingBrace">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	
	<!-- Include some additional sniffs from the Zend standard -->
	<rule ref="Zend.Files.ClosingTag">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	
	<!-- CMS specific sniff exclusions from the Joomla standard -->
	<rule ref="Joomla.Commenting.FileComment">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">tests/*</exclude-pattern>
	</rule>
	<rule ref="Joomla.Commenting.FunctionComment">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
		<exclude-pattern type="relative">modules/*</exclude-pattern>
		<exclude-pattern type="relative">plugins/*</exclude-pattern>
		<exclude-pattern type="relative">*/tests/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/legacy/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/cms/html/*</exclude-pattern>
		<exclude-pattern type="relative">installation/model/*</exclude-pattern>
		<exclude-pattern type="relative">installation/application/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Application/CMSApplication.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Application/DaemonApplication.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Application/WebApplication.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Captcha/Captcha.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Client/FtpClient.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Utility/BufferStreamHandler.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/User/User.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Updater/UpdateAdapter.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Toolbar/ToolbarButton.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Toolbar/Toolbar.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Toolbar/Button/SeparatorButton.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/loader.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/legacy/error/error.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Component/Router/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Document/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Editor/Editor.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Environment/Browser.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Filter/Wrapper/OutputFilterWrapper.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Form/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Helper/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Input/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Installer/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Language/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Log/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Menu/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/MVC/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Plugin/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Router/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Session/Session.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/String/PunycodeHelper.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Table/*</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/HTML/HTMLHelper.php</exclude-pattern>
		<exclude-pattern type="relative">libraries/src/Layout/FileLayout.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_wrapper/views/wrapper/view.html.php</exclude-pattern>
		<exclude-pattern type="relative">administrator/components/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_banners/router.php</exclude-pattern>
		<exclude-pattern type="relative">components/com_config/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_contact/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_content/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_finder/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_newsfeeds*</exclude-pattern>
		<exclude-pattern type="relative">components/com_search/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_tags/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_users/*</exclude-pattern>
		<exclude-pattern type="relative">components/com_wrapper/router.php</exclude-pattern>
	</rule>
	<rule ref="Joomla.Commenting.SingleComment">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Joomla.Commenting.ClassComment">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">tests/*</exclude-pattern>
	</rule>
	<rule ref="Joomla.ControlStructures.ControlSignature">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Joomla.ControlStructures.ControlStructuresBrackets">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Joomla.ControlStructures.WhiteSpaceBefore">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Joomla.Operators.ValidLogicalOperators">
		<!-- These exceptions are temporary. Remove these exceptions as code style violations are fixed -->
		<exclude-pattern type="relative">*/tmpl/*</exclude-pattern>
		<exclude-pattern type="relative">templates/*</exclude-pattern>
		<exclude-pattern type="relative">layouts/*</exclude-pattern>
	</rule>
	<rule ref="Joomla">
		<!-- These exceptions are permanent as long as there are B/C naming exceptions  -->
		<exclude name="Joomla.NamingConventions.ValidFunctionName.FunctionNoCapital"/>
		<exclude name="Joomla.NamingConventions.ValidFunctionName.MethodUnderscore"/>
		<exclude name="Joomla.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
		<exclude name="Joomla.NamingConventions.ValidFunctionName.FunctionNameInvalid"/>
		<exclude name="Joomla.NamingConventions.ValidVariableName.ClassVarHasUnderscore"/>
		<exclude name="Joomla.NamingConventions.ValidVariableName.MemberNotCamelCaps"/>
		<exclude name="Joomla.NamingConventions.ValidVariableName.NotCamelCaps"/>
		<exclude name="Joomla.NamingConventions.ValidVariableName.StringNotCamelCaps"/>
		<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
	</rule>
</ruleset>

OK, I think I'm missing something essential to understand this list of exclusions:

Are this many files really being enshrined as exempt from the project's code style? Aside from the third party libraries, for which I can readily grasp reasons for excluding, seeing this many of the project's own files excluded brings up my eyebrows and and questions about either the purpose or the correctness of the code style itself.

@Paladin This just shows how far off the 3.x CMS Repo is from being in compliance. Often it's a single section or a single file that is the issue (I've tried to pinpoint some of those with exclusions for those single files and folders).
The Exclusions here are to mute the errors while we transition from the 1.5.x ruleset to the 2.x ruleset.
The 1.5.x CMS ruleset has a large but smaller set of exclusions than what's shown here.

This exclusion list should be much easier to reduce as some of these exceptions are now connected to rules with autofixers. Here is an example PR I've done showing how I prefer to apply the autofixers. Rather than just fixing everything and causing issues across the repo, I focus the PR's on just on small area like a single component, a single module, a single plugin, etc.

The harder area to deal with are things that cannot be autofixed and have to be addressed manually, such as line length or adding member var docblocks.

Personally I think it would be great if we could get a group to coordinate PR's like the example shown to burn through all of the autofixers. Then we could just remove those exclusions.
(note: the mixed PHP / HTML files will continue to be exceptions with some rules)

PHPCS command line example process

  1. check out staging as new branch
  2. run PHPCS to check for errors
php phpcs --standard=Joomla-CMS --extensions=php path\to\joomla-cms\Area\To\Check\And\Fix\
  1. copy list of rules that are autofixer capable for commit history
  2. run PHPCBF
php phpcbf -ps --no-patch --standard=Joomla-CMS --extensions=php path\to\joomla-cms\Area\To\Check\And\Fix\
  1. commit to github
  2. create PR as shown in example
  3. Rinse and Repeat.
  4. remove PHPCS exclusion related to path\to\joomla-cms\Area\To\Check\And\Fix\

Sooner or later I think there are some rules we need to review more closely too versus just continuing to accept the status quo unchallenged.

https://github.com/joomla/framework.joomla.org/blob/e8207b69a32d9334a13b08188ce46a04b100601d/src/Helper/GitHubHelper.php#L100
https://github.com/joomla/jissues/blob/aa3997c0f7814abc3075c49d63f5c1788dd6aaf5/src/JTracker/View/Renderer/TrackerExtension.php#L377-L379

The 150 character hard limit causes either a forced concatenation of text or you to change the project to allow longer lines to work around being forced to concatenate text in unique ways (and I don't know about others, but sometimes I really dislike being forced to fit my line length to an arbitrary limit just to appease an automated sniffer when there is no gain to be had by doing so).

Agreed. There is also the issue that the current code style is heavily influenced by PEAR standards and would likely benefit by adopting more PSR2 standard styling.

I will note that at first glance this item looks like it could be fixed with more SQL chaining but maybe the API lacks INSERT INTO and VALUES methods to make that happen.

The second example is definitely something I agree with. It's one of those trade offs in the code style.

side note: this code below the second example could be a one-liner.

I will note that at first glance this item looks like it could be fixed with more SQL chaining but maybe the API lacks INSERT INTO and VALUES methods to make that happen.

Actually it's because our API doesn't natively support MySQL's ON DUPLICATE KEY UPDATE statement so the entirety of the query needs to be written as a raw query versus using the builder. Which I'd say is expected behavior unless we can build into the builder API agnostic support for that (as in the other drivers support a similar structure too).

I've opened a PR with the updates to the CMS exclusion example. I was able to clean up cases where things were too broad, although I think some of these exclusions are still too broad. (a few cases of plugins/* which could be a bit more specific)

It might be a few days before I can work more on this, I did get 13 more PR's opened with the CMS to address some of the things that can be fixed with the Autofixers. Once those are merged we can shrink the CMS exclusions list a little bit.

You're not working over christmas :O outrageous :) I'll go through your PR's now :)

@mbabker Ah, yes. I wondered about the necessity for that line of code when you pointed to it; thanks for the extra information. Yet one more example of how MySQL's name is misleading; it has only a coincidental relationship with SQL, which has defined the MERGE statement for that purpose since before Joomla existed.

There is probably not a good way to translate a standard query into the non-standard version in the MySQL driver without being very inefficient in mySQL's non-standard version of it.

I've added another 6 PR's. I'll see when I can get back to this before I'm off my break

PR #218 fixes the control structure brackets indent issue within closures and has a test to verify that it fixes the issue.
Now that #218 is merged, I think we should be good to go with a stable release.

As for moving to PHPCS 2.x on the CMS 3.x and PHP3.x on CMS 4.x branches. There are some 6 PR's for CMS 3.x open for cleaning up things https://github.com/joomla/joomla-cms/pulls/photodude

Merged 3 of them just now. In the libraries folder I was interested by the new lines after code coverage ignore comments. Maybe I'm just being a bit overreactive - but seems like new lines might be actively non-desirable there??