? Pending

User tests: Successful: Unsuccessful:

avatar HLeithner
HLeithner
27 Apr 2022

Preparation Pull Request for Motion PROD2021/004: Update the code style to PSR12 as early as possible but latest for 5.0
This pull requests prepares the cms repository for that automated transformation PR #37686.

Motion:

Summary of Changes

  • Replace FinderHelperRoute import with namespaced version
  • Remove {} in switch statements
  • Removed a require statement which is unused since 2010
  • Remove another unnecessary require not used anymore
  • Deprecate JCOMPAT_UNICODE_PROPERTIES and moved the functionality into the function
  • Add phpcs exception for SideEffects in BufferStreamHandler which will be removed in 5.0 (planned for 4.0)

Testing Instructions

  • Most of the changes are CS changes and can be done by code review.
  • For FinderHelperRoute a simple test with smart search would be enough
  • JCOMPAT_UNICODE_PROPERTIES can't be tested without an "broken" pcre library so code review would be enough

Documentation Changes Required

  • Deprecation of JCOMPAT_UNICODE_PROPERTIES
avatar HLeithner HLeithner - open - 27 Apr 2022
avatar HLeithner HLeithner - change - 27 Apr 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Apr 2022
Category Administration com_finder com_users Libraries Front End Plugins
avatar brianteeman
brianteeman - comment - 27 Apr 2022

could you please include the text of Motion PROD2021/004. so that this pr contains an explanation of the chaanges

avatar HLeithner HLeithner - change - 27 Apr 2022
Labels Added: ?
avatar HLeithner HLeithner - change - 27 Apr 2022
The description was changed
avatar HLeithner HLeithner - edited - 27 Apr 2022
avatar HLeithner
HLeithner - comment - 27 Apr 2022

The motion is really reduced to "Switch from custom codestyle to PSR-12" I added the motion description to the description.

avatar joomla-cms-bot joomla-cms-bot - change - 27 Apr 2022
Category Administration com_finder com_users Libraries Front End Plugins Administration com_config com_finder com_users Libraries Front End Plugins
avatar joomla-cms-bot joomla-cms-bot - change - 29 Apr 2022
Category Administration com_finder com_users Libraries Front End Plugins com_config Administration com_config com_finder com_users Repository Libraries Front End Plugins
avatar HLeithner
HLeithner - comment - 29 Apr 2022

@brianteeman I hopefully added all your fixes into the last commit. I added by hand to not make the pr too complex. All thanks go to you

avatar HLeithner
HLeithner - comment - 29 Apr 2022

so with this pr you can recreate the 37686 pr yourself

avatar brianteeman
brianteeman - comment - 29 Apr 2022

This PR is all about having consistent code style. It would be good if you could also be consistent with how you write psr12.

Sometimes you write PSR-12 and other times PSR12

avatar HLeithner
HLeithner - comment - 29 Apr 2022

This PR is all about having consistent code style. It would be good if you could also be consistent with how you write psr12.

Sometimes you write PSR-12 and other times PSR12

I will use psr12 for files/folders and in code und PSR-12 in Text, will do a second update with cleaning this up

avatar brianteeman
brianteeman - comment - 29 Apr 2022

Can you confirm the syntax for specifiying a folder

I have tried relative and absolute but both give the same error


C:\htdocs\joomla-cms>php build\psr12\psr12_converter.php --task=CS modules/
Joomla! PSR12 Converter
=======================

Tasks will be executed: CS
Files and Folders:
modules/

PHP Notice:  Undefined variable: dir in C:\htdocs\joomla-cms\build\psr12\psr12_converter.php on line 177
PHP Notice:  Trying to get property 'path' of non-object in C:\htdocs\joomla-cms\build\psr12\psr12_converter.php on line 177
PHP Notice:  Undefined variable: entry in C:\htdocs\joomla-cms\build\psr12\psr12_converter.php on line 177
Check /
<?xml version="1.0" encoding="UTF-8"?>
<phpcs version="3.6.2">
</phpcs>

avatar brianteeman
brianteeman - comment - 29 Apr 2022

And if I dont pass a path it is only checking the last folder #37686 (comment)

avatar brianteeman
brianteeman - comment - 29 Apr 2022

maybe its a windows thing but $entry is always empty

avatar HLeithner
HLeithner - comment - 29 Apr 2022

maybe its a windows thing but $entry is always empty

no that's not the problem, it's an error from refactoring.

And if I dont pass a path it is only checking the last folder #37686 (comment)

which doesn't makes a sense because I convert the complete cms with the same script also on windows...

avatar brianteeman
brianteeman - comment - 29 Apr 2022

i give up - still doesnt work

avatar HLeithner
HLeithner - comment - 29 Apr 2022

i give up - still doesnt work

you mean more then one folder?

avatar brianteeman
brianteeman - comment - 29 Apr 2022

found the problem i think

when looking at the list of files and folder from task=cs it doesnt traverse the path fully so doesnt find files.

edited output below to show what I mean


C:\htdocs\joomla-cms>php build\psr12\psr12_converter.php --task=CS                
Joomla! PSR-12 Converter
=======================

Tasks will be executed: CS
Files and Folders:
index.php
administrator/index.php
administrator/components/com_actionlogs
administrator/components/com_admin
administrator/components/com_ajax
administrator/components/com_associations
....
administrator/components/com_workflow
administrator/components/com_wrapper
administrator/includes/app.php
administrator/includes/defines.php
administrator/includes/framework.php
administrator/language/en-GB
administrator/language/overrides
administrator/modules/mod_custom
administrator/modules/mod_feed
administrator/modules/mod_frontend
administrator/modules/mod_latest
administrator/modules/mod_latestactions
avatar HLeithner
HLeithner - comment - 29 Apr 2022

It doens't need to find files, that's done by phpcs it self... what happens if you execute psr12_converter.php --task=cs modules,plugins ?

avatar brianteeman
brianteeman - comment - 29 Apr 2022

C:\htdocs\joomla-cms>php build\psr12\psr12_converter.php --task=CS modules,plugins  
Joomla! PSR-12 Converter
=======================

Tasks will be executed: CS
Files and Folders:
modules
plugins

Check modules
<?xml version="1.0" encoding="UTF-8"?>
<phpcs version="3.6.2">
</phpcs>
Check plugins
<?xml version="1.0" encoding="UTF-8"?>
<phpcs version="3.6.2">
</phpcs>
avatar HLeithner
HLeithner - comment - 29 Apr 2022

That looks good and without you only get one entry?! that's really strange.

avatar brianteeman
brianteeman - comment - 29 Apr 2022

ok so maybe I am misunderstanding what CS will do. I am expecting that running CS will generate a report in build/t,mp/psr but there is nothing there. and running CBF returns No fixable errors were found

avatar HLeithner
HLeithner - comment - 30 Apr 2022

ok so maybe I am misunderstanding what CS will do. I am expecting that running CS will generate a report in build/t,mp/psr but there is nothing there. and running CBF returns No fixable errors were found

the report only exists if it finds errors, so usually after the first CS run you should have a file called build/tmp/psr12/result.html this should also exists (but outdated) after running task CMS

avatar HLeithner HLeithner - change - 30 Apr 2022
The description was changed
avatar HLeithner HLeithner - edited - 30 Apr 2022
avatar brianteeman
brianteeman - comment - 30 Apr 2022

ok so maybe I am misunderstanding what CS will do. I am expecting that running CS will generate a report in build/t,mp/psr but there is nothing there. and running CBF returns No fixable errors were found

the report only exists if it finds errors, so usually after the first CS run you should have a file called build/tmp/psr12/result.html this should also exists (but outdated) after running task CMS

and there is nothing as I already stated so something is wrong with the code (tested on another server with the same results)

avatar brianteeman
brianteeman - comment - 1 May 2022
<!--
    If no files or directories are specified on the command line
    your custom standard can specify what files should be checked
    instead.

    Note that file and directory paths specified in a ruleset are
    relative to the ruleset's location, and that specifying any file or
    directory path on the command line will ignore all file tags.
 -->
 <file>./path/to/directory</file>
 <file>./path/to/file.php</file>

 <!--
    You can hard-code ignore patterns directly into your
    custom standard so you don't have to specify the
    patterns on the command line.
    
    The following two tags are equivalent to the command line argument:
    --ignore=*/tests/*,*/data/*
 -->
 <exclude-pattern>*/tests/*</exclude-pattern>
 <exclude-pattern>*/data/*</exclude-pattern>

avatar HLeithner
HLeithner - comment - 2 May 2022

@brianteeman can you try <exclude-pattern type="relative">cache/*</exclude-pattern> instead?

avatar brianteeman
brianteeman - comment - 2 May 2022

that appears to work as well

avatar brianteeman
brianteeman - comment - 3 May 2022

Retested and appears to be working as intended

avatar joomla-cms-bot joomla-cms-bot - change - 17 May 2022
Category Administration com_finder com_users Libraries Front End Plugins com_config Repository Administration com_config com_finder com_users Repository Layout Libraries Front End Plugins
avatar HLeithner
HLeithner - comment - 18 May 2022

So latest additions are the layouts,templates and tmpl folder. This is the final call on this PR. It is planned to be merged before the next alpha.

avatar HLeithner
HLeithner - comment - 27 Jun 2022

@brianteeman I added the PR converter script, it's not really testable for you but maybe you can check my english?

avatar brianteeman
brianteeman - comment - 27 Jun 2022

@brianteeman I added the PR converter script, it's not really testable for you but maybe you can check my english?

first pass done

avatar HLeithner
HLeithner - comment - 27 Jun 2022

I updated all Text changes btw. I also changed the "dir=auto" in the phpcs template from your comment in the commit.

thanks

avatar HLeithner
HLeithner - comment - 27 Jun 2022

thanks updated.
I plan to do the PSR-12 conversation today starting at 16:00 UTC as long as nothing comes in between.

avatar HLeithner HLeithner - close - 27 Jun 2022
avatar HLeithner HLeithner - merge - 27 Jun 2022
avatar HLeithner HLeithner - change - 27 Jun 2022
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-06-27 18:06:38
Closed_By HLeithner

Add a Comment

Login with GitHub to post a comment