joomla / coding-standards

Joomla Coding Standards Definition
https://developer.joomla.org/coding-standards/basic-guidelines.html
GNU General Public License v2.0
128 stars 129 forks source link

[META] Finalizing PHPCS 2.x support #143

Open mbabker opened 7 years ago

mbabker commented 7 years ago

Extracted from https://github.com/joomla/coding-standards/pull/109#issuecomment-268876448

810 commented 7 years ago

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?

photodude commented 7 years ago

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 https://github.com/joomla/joomla-cms/pull/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)

photodude commented 7 years ago

@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.

photodude commented 7 years ago

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

wilsonge commented 7 years ago

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

mbabker commented 7 years ago

It's all you for at least the next week.

On Sat, Jun 10, 2017 at 3:21 PM George Wilson notifications@github.com wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joomla/coding-standards/issues/143#issuecomment-307588060, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWfobSJfY7G7vpVyjQWmx13D6sRESvuks5sCvq5gaJpZM4LdeyI .

--

  • Michael Please pardon any errors, this message was sent from my iPhone.
mbabker commented 7 years ago

Alpha 2 tagged.

Paladin commented 7 years ago

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.

photodude commented 7 years ago

@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.

photodude commented 7 years ago

@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,

mbabker commented 7 years ago

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.

Paladin commented 7 years ago

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.

photodude commented 7 years ago

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.

Paladin commented 7 years ago

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.

photodude commented 6 years ago

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

wilsonge commented 6 years ago

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

photodude commented 6 years ago

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.

mbabker commented 6 years ago

I already have been.

photodude commented 6 years ago

Awesome, what's the next step?

mbabker commented 6 years ago

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.

wilsonge commented 6 years ago

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

photodude commented 6 years ago

@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)

photodude commented 6 years ago

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?

mbabker commented 6 years ago

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.

Paladin commented 6 years ago

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

photodude commented 6 years ago

@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.

wilsonge commented 6 years ago

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

photodude commented 6 years ago

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

photodude commented 6 years ago

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?

wilsonge commented 6 years ago

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

https://github.com/joomla/coding-standards/issues/143#issuecomment-346089963

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

photodude commented 6 years ago

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

photodude commented 6 years ago

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

photodude commented 6 years ago

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.

photodude commented 6 years ago

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

photodude commented 6 years ago

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
----------------------------------------------------------------------
photodude commented 6 years ago

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

photodude commented 6 years ago

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>
Paladin commented 6 years ago

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.

photodude commented 6 years ago

@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.

photodude commented 6 years ago

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\
  3. copy list of rules that are autofixer capable for commit history
  4. run PHPCBF
    php phpcbf -ps --no-patch --standard=Joomla-CMS --extensions=php path\to\joomla-cms\Area\To\Check\And\Fix\
  5. commit to github
  6. create PR as shown in example
  7. Rinse and Repeat.
  8. remove PHPCS exclusion related to path\to\joomla-cms\Area\To\Check\And\Fix\
mbabker commented 6 years ago

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

photodude commented 6 years ago

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.

mbabker commented 6 years ago

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

photodude commented 6 years ago

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)

photodude commented 6 years ago

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.

wilsonge commented 6 years ago

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

Paladin commented 6 years ago

@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.

photodude commented 6 years ago

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

photodude commented 6 years ago

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

wilsonge commented 6 years ago

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