Welcome Guest, Not a member yet? Register   Sign In
How to set CodeIgniter 4 coding standard in a phpcs.xml file ?
#1

Hello,

I'm working on IonAuth for CI4 : https://github.com/bvrignaud/CodeIgniter...uth/tree/4

I'm trying to set travis jobs.

I have problems with the CodeIgniter coding standard implementation (https://github.com/bcit-ci/CodeIgniter4-Standard).

If I run on command line :
Code:
$ vendor/bin/phpcs --standard=vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 .
It's OK.

But if I set a phpcs.xml.dist with :
Code:
<rule ref="vendor/codeigniter4/codeigniter4-standard/CodeIgniter4/" />
And run it with :
Code:
$ vendor/bin/phpcs

I have this error : PHP Fatal error:  Class 'CodeIgniter4\Sniffs\PHP\ForbiddenFunctionsSniff' not found in /home/benoit/MesProjets/Lab/ci4/src/CodeIgniter-Ion-Auth/vendor/codeigniter4/codeigniter4-standard/CodeIgniter4/Sniffs/PHP/DiscouragedFunctionsSniff.php on line 24

Any ideas ?

Thanks
Reply
#2

I haven't had a chance to look at the standard for about a year since writing it, I see things are moving along with CodeIgniter 4 now so I expect things to start heating up soon, my day jobs been ridiculously busy this past year so I've not chased for updates.

Meanwhile I did do an example travis build way back, so this might be helpful. https://github.com/louisl/CodeIgniter4/b...travis.yml

I expect the standard probably needs to change a bit since writing, but I've not had instructions as of yet.
Reply
#3

We have added a git commit pre-hook, so if you are using the latest develop branch, you should end up with phpcs automatically applied as part of each commit.
Reply
#4

(11-11-2018, 02:25 PM)ciadmin Wrote: We have added a git commit pre-hook, so if you are using the latest develop branch, you should end up with phpcs automatically applied as part of each commit.

Hi Jim, Nice one, I need to catch up asap I think!. I'm still about if you need me, Just busy as hell. Sad
Reply
#5

@louisl I think the sniffer rules will need revisiting - they are causing some small degree of havoc and questionable reformatting when used with phpcbf. We are going with the flow for now, and will probably look to do some improvements once we get to the beta.

I think we are all busy, each for different reasons Undecided
Reply
#6

I found a solution with this phpcs.xml :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<rulset name="My Project">
    <config name="installed_paths" value="vendor/codeigniter4/codeigniter4-standard/CodeIgniter4"/>
    <description></description>

    <file>application</file>
    <file>tests/app</file>

    <rule ref="vendor/codeigniter4/codeigniter4-standard/CodeIgniter4/ruleset.xml"/>
</rulset>
Reply
#7

would be nice if you could make a PR for this
have same problem and the pre-hook doesnt work on windows
Reply




Theme © iAndrew 2016 - Forum software by © MyBB