[Phpmyadmin-devel] New PHPCS rule

Hi, What would you think about using the "nesting level" sniff please? This sniff permits to detect when there are too much nested levels like: if (...) { if (...) { if (...) { if (...) { if (...) { .... } } } } } This kind of syntax often means that a refactoring is needed or a rewrite. I can add it myself if you agree. Thanks, Hugues.

Le 2013-12-15 14:36, Hugues Peccatte a écrit :
Hi,
What would you think about using the "nesting level" sniff please? This sniff permits to detect when there are too much nested levels like: if (...) { if (...) { if (...) { if (...) { if (...) { .... } } } } }
This kind of syntax often means that a refactoring is needed or a rewrite.
I can add it myself if you agree.
Good idea but how many levels is considered "too many"? Can you give an example of nesting levels you found? -- Marc Delisle http://infomarc.info | http://phpmyadmin.net

2013/12/16 Marc Delisle <marc@infomarc.info>
Le 2013-12-15 14:36, Hugues Peccatte a écrit :
Hi,
What would you think about using the "nesting level" sniff please? This sniff permits to detect when there are too much nested levels like: if (...) { if (...) { if (...) { if (...) { if (...) { .... } } } } }
This kind of syntax often means that a refactoring is needed or a rewrite.
I can add it myself if you agree.
Good idea but how many levels is considered "too many"? Can you give an example of nesting levels you found?
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi, To add this new rule won't add to many PHPCS errors. I already test this rule and there are currently not so much this errors in the sources. (I don't have an exact count. I would say around 20-30.) See: http://www.squizlabs.com/php-codesniffer/php_codesniffer-ruleset.xml-support... See: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.... The rule could be: <rule ref="Generic.Metrics.NestingLevel"> <properties> <property name="nestingLevel" value="2" /> <property name="absoluteNestingLevel" value="5" /> </properties> </rule> We don't need to define both properties. "nestingLevel" is the number of nested level which throw a warning. (default = 5) "absoluteNestingLevel" is the maximum of allowed nested levels. (default = 10) I think that the default values don't need to be overridden, so the rule would be: <rule ref="Generic.Metrics.NestingLevel" /> Hugues.

Le 2013-12-16 13:12, Hugues Peccatte a écrit :
2013/12/16 Marc Delisle <marc@infomarc.info <mailto:marc@infomarc.info>>
Le 2013-12-15 14:36, Hugues Peccatte a écrit : > Hi, > > What would you think about using the "nesting level" sniff please? > This sniff permits to detect when there are too much nested levels like: > if (...) { > if (...) { > if (...) { > if (...) { > if (...) { > .... > } > } > } > } > } > > This kind of syntax often means that a refactoring is needed or a rewrite. > > I can add it myself if you agree. >
Good idea but how many levels is considered "too many"? Can you give an example of nesting levels you found?
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net <mailto:Phpmyadmin-devel@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi,
To add this new rule won't add to many PHPCS errors. I already test this rule and there are currently not so much this errors in the sources. (I don't have an exact count. I would say around 20-30.)
See: http://www.squizlabs.com/php-codesniffer/php_codesniffer-ruleset.xml-support... See: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset....
The rule could be: <rule ref="Generic.Metrics.NestingLevel"> <properties> <property name="nestingLevel" value="2" /> <property name="absoluteNestingLevel" value="5" /> </properties> </rule>
We don't need to define both properties. "nestingLevel" is the number of nested level which throw a warning. (default = 5) "absoluteNestingLevel" is the maximum of allowed nested levels. (default = 10)
I think that the default values don't need to be overridden, so the rule would be: <rule ref="Generic.Metrics.NestingLevel" />
Hugues.
Yes, let's try that. -- Marc Delisle http://infomarc.info | http://phpmyadmin.net

2013/12/16 Marc Delisle <marc@infomarc.info>
Le 2013-12-16 13:12, Hugues Peccatte a écrit :
2013/12/16 Marc Delisle <marc@infomarc.info <mailto:marc@infomarc.info>>
Le 2013-12-15 14:36, Hugues Peccatte a écrit : > Hi, > > What would you think about using the "nesting level" sniff please? > This sniff permits to detect when there are too much nested levels like: > if (...) { > if (...) { > if (...) { > if (...) { > if (...) { > .... > } > } > } > } > } > > This kind of syntax often means that a refactoring is needed or a rewrite. > > I can add it myself if you agree. >
Good idea but how many levels is considered "too many"? Can you give an example of nesting levels you found?
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most
IT
organizations don't have a clear picture of how application
performance
affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net <mailto:Phpmyadmin-devel@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi,
To add this new rule won't add to many PHPCS errors. I already test this rule and there are currently not so much this errors in the sources. (I don't have an exact count. I would say around 20-30.)
See:
http://www.squizlabs.com/php-codesniffer/php_codesniffer-ruleset.xml-support...
See: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset....
The rule could be: <rule ref="Generic.Metrics.NestingLevel"> <properties> <property name="nestingLevel" value="2" /> <property name="absoluteNestingLevel" value="5" /> </properties> </rule>
We don't need to define both properties. "nestingLevel" is the number of nested level which throw a warning. (default = 5) "absoluteNestingLevel" is the maximum of allowed nested levels. (default = 10)
I think that the default values don't need to be overridden, so the rule would be: <rule ref="Generic.Metrics.NestingLevel" />
Hugues.
Yes, let's try that.
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi, I just committed the add of the new rule. Jenkins should find new errors now. [ ... wait for Jenkins result ... ] My estimate was almost good. There are 27 new errors because of the nested levels. I think that many of them could be fixed. I'll look at this. Hugues.

2013/12/17 Hugues Peccatte <hugues.peccatte@gmail.com>
2013/12/16 Marc Delisle <marc@infomarc.info>
Le 2013-12-16 13:12, Hugues Peccatte a écrit :
2013/12/16 Marc Delisle <marc@infomarc.info <mailto:marc@infomarc.info
Le 2013-12-15 14:36, Hugues Peccatte a écrit : > Hi, > > What would you think about using the "nesting level" sniff please? > This sniff permits to detect when there are too much nested levels like: > if (...) { > if (...) { > if (...) { > if (...) { > if (...) { > .... > } > } > } > } > } > > This kind of syntax often means that a refactoring is needed or a rewrite. > > I can add it myself if you agree. >
Good idea but how many levels is considered "too many"? Can you give an example of nesting levels you found?
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business.
Most IT
organizations don't have a clear picture of how application
performance
affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net <mailto:Phpmyadmin-devel@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi,
To add this new rule won't add to many PHPCS errors. I already test this rule and there are currently not so much this errors in the sources. (I don't have an exact count. I would say around 20-30.)
See:
http://www.squizlabs.com/php-codesniffer/php_codesniffer-ruleset.xml-support...
See: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset....
The rule could be: <rule ref="Generic.Metrics.NestingLevel"> <properties> <property name="nestingLevel" value="2" /> <property name="absoluteNestingLevel" value="5" /> </properties> </rule>
We don't need to define both properties. "nestingLevel" is the number of nested level which throw a warning. (default = 5) "absoluteNestingLevel" is the maximum of allowed nested levels. (default = 10)
I think that the default values don't need to be overridden, so the rule would be: <rule ref="Generic.Metrics.NestingLevel" />
Hugues.
Yes, let's try that.
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi,
I just committed the add of the new rule. Jenkins should find new errors now. [ ... wait for Jenkins result ... ] My estimate was almost good. There are 27 new errors because of the nested levels. I think that many of them could be fixed.
I'll look at this.
Hugues.
Hi, I've just found this page: https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples<https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#For-loop-with-test-function-call> You can find here a huge list of sniffs and their descriptions. I think that some of those sniffs could be useful for the phpMyAdmin source code. Let think about: - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... And there are more sniffs that I like: - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... (Yes, I'm a little bit annoying with code style...) TYPO3 seems to be another standard. I believe that I selected 1 or 2 of their sniffs. Maybe we could imagine to use it, but I never used it, for now at least... Please, let me know what you think about those sniffs, if some seems useful or useless. I'll try to use it locally and give you more information about number of errors/warnings thrown by those sniffs. Thanks, Hugues.

On Wed, Dec 18, 2013 at 3:09 AM, Hugues Peccatte <hugues.peccatte@gmail.com>wrote:
2013/12/17 Hugues Peccatte <hugues.peccatte@gmail.com>
2013/12/16 Marc Delisle <marc@infomarc.info>
Le 2013-12-16 13:12, Hugues Peccatte a écrit :
2013/12/16 Marc Delisle <marc@infomarc.info <mailto:marc@infomarc.info
Le 2013-12-15 14:36, Hugues Peccatte a écrit : > Hi, > > What would you think about using the "nesting level" sniff please? > This sniff permits to detect when there are too much nested levels like: > if (...) { > if (...) { > if (...) { > if (...) { > if (...) { > .... > } > } > } > } > } > > This kind of syntax often means that a refactoring is needed or a rewrite. > > I can add it myself if you agree. >
Good idea but how many levels is considered "too many"? Can you give an example of nesting levels you found?
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business.
Most IT
organizations don't have a clear picture of how application
performance
affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net <mailto:Phpmyadmin-devel@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi,
To add this new rule won't add to many PHPCS errors. I already test
this
rule and there are currently not so much this errors in the sources. (I don't have an exact count. I would say around 20-30.)
See: http://www.squizlabs.com/php-codesniffer/php_codesniffer-ruleset.xml-support... See: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset....
The rule could be: <rule ref="Generic.Metrics.NestingLevel"> <properties> <property name="nestingLevel" value="2" /> <property name="absoluteNestingLevel" value="5" /> </properties> </rule>
We don't need to define both properties. "nestingLevel" is the number of nested level which throw a warning. (default = 5) "absoluteNestingLevel" is the maximum of allowed nested levels. (default = 10)
I think that the default values don't need to be overridden, so the rule would be: <rule ref="Generic.Metrics.NestingLevel" />
Hugues.
Yes, let's try that.
-- Marc Delisle http://infomarc.info | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi,
I just committed the add of the new rule. Jenkins should find new errors now. [ ... wait for Jenkins result ... ] My estimate was almost good. There are 27 new errors because of the nested levels. I think that many of them could be fixed.
I'll look at this.
Hugues.
Hi,
I've just found this page: https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples<https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#For-loop-with-test-function-call> You can find here a huge list of sniffs and their descriptions. I think that some of those sniffs could be useful for the phpMyAdmin source code. Let think about: - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi...
And there are more sniffs that I like: - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... - https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi...
(Yes, I'm a little bit annoying with code style...)
TYPO3 seems to be another standard. I believe that I selected 1 or 2 of their sniffs. Maybe we could imagine to use it, but I never used it, for now at least...
Please, let me know what you think about those sniffs, if some seems useful or useless. I'll try to use it locally and give you more information about number of errors/warnings thrown by those sniffs.
Thanks, Hugues.
Hi, These sniffs are definitely useful. Even though not enforced by PHPCS, I believe we already comply to most of them except probably for [1] & [2]. PMAStandard already include [3] & [4], and [5] is covered by PEAR.ControlStructures.ControlSignature sniff. So I guess there is no need to include them again. However I am not too sure about [6]. Don't we sometimes have to have methods with unused parameters because we are implementing interfaces? [1] https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... [2] https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... [3] https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... [4] https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... [5] https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... [6] https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_wi... <https://forge.typo3.org/projects/team-php_codesniffer/wiki/TYPO3v4_Sniffs_with_code_examples#Method-scope> -- Thanks and Regards, Madhura Jayaratne

Hi Dne Sun, 15 Dec 2013 20:36:04 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
What would you think about using the "nesting level" sniff please? This sniff permits to detect when there are too much nested levels like: if (...) { if (...) { if (...) { if (...) { if (...) { .... } } } } }
This kind of syntax often means that a refactoring is needed or a rewrite.
Lot of things which need refactoring are already detected by phpmd (though it's only executed nightly as it takes quite a lot of time): http://ci.phpmyadmin.net/job/phpMyAdmin/891/pmdResult/ -- Michal Čihař | http://cihar.com | http://phpmyadmin.net

Hi Michal, 2013/12/19 Michal Čihař <michal@cihar.com>
Hi
Dne Sun, 15 Dec 2013 20:36:04 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
What would you think about using the "nesting level" sniff please? This sniff permits to detect when there are too much nested levels like: if (...) { if (...) { if (...) { if (...) { if (...) { .... } } } } }
This kind of syntax often means that a refactoring is needed or a rewrite.
Lot of things which need refactoring are already detected by phpmd (though it's only executed nightly as it takes quite a lot of time):
Ok, thanks, I'll look at this and see if new rules seem useful. I didn't think to look in PMD. In my job, all this work is done by PHPCS and I didn't know PMD could do the same... So... I'll look at PMD to see what I could "improve" in the source code. Thanks ! Hugues.
-- Michal Čihař | http://cihar.com | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel

Hi Dne Fri, 20 Dec 2013 07:37:19 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Ok, thanks, I'll look at this and see if new rules seem useful. I didn't think to look in PMD. In my job, all this work is done by PHPCS and I didn't know PMD could do the same...
So... I'll look at PMD to see what I could "improve" in the source code.
Honestly it would be better to have just one tool doing this as it would run faster, I just wanted to point out there is something else available as well. -- Michal Čihař | http://cihar.com | http://phpmyadmin.net

Hi, 2013/12/20 Michal Čihař <michal@cihar.com>
Hi
Dne Fri, 20 Dec 2013 07:37:19 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Ok, thanks, I'll look at this and see if new rules seem useful. I didn't think to look in PMD. In my job, all this work is done by PHPCS and I didn't know PMD could do the same...
So... I'll look at PMD to see what I could "improve" in the source code.
Honestly it would be better to have just one tool doing this as it would run faster, I just wanted to point out there is something else available as well.
Michal, could you please tell me where are defined the rules used by PMD please ? I didn't find it in the wiki or in the project. Maybe on Jenkins ? But it seems that's not accessible from the trace. Thanks, Hugues.
-- Michal Čihař | http://cihar.com | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel

Hi Dne Sat, 21 Dec 2013 22:25:09 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Hi,
2013/12/20 Michal Čihař <michal@cihar.com>
Hi
Dne Fri, 20 Dec 2013 07:37:19 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Ok, thanks, I'll look at this and see if new rules seem useful. I didn't think to look in PMD. In my job, all this work is done by PHPCS and I didn't know PMD could do the same...
So... I'll look at PMD to see what I could "improve" in the source code.
Honestly it would be better to have just one tool doing this as it would run faster, I just wanted to point out there is something else available as well.
Michal, could you please tell me where are defined the rules used by PMD please ?
They are part of phpmd, I don't think we change them anyhow. -- Michal Čihař | http://cihar.com | http://phpmyadmin.net

Hi, 2013/12/22 Michal Čihař <michal@cihar.com>
Hi
Dne Sat, 21 Dec 2013 22:25:09 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Hi,
2013/12/20 Michal Čihař <michal@cihar.com>
Hi
Dne Fri, 20 Dec 2013 07:37:19 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Ok, thanks, I'll look at this and see if new rules seem useful. I didn't think to look in PMD. In my job, all this work is done by PHPCS and I didn't know PMD could do the same...
So... I'll look at PMD to see what I could "improve" in the source code.
Honestly it would be better to have just one tool doing this as it would run faster, I just wanted to point out there is something else available as well.
Michal, could you please tell me where are defined the rules used by PMD please ?
They are part of phpmd, I don't think we change them anyhow.
I'm still thinking about PHPCS and PMD and I've some questions: - would you agree to only use PHPCS if possible ? I would like to see if it's possible to use all the PMD rules (or equivalent) in PHPCS. - how could you not have this error http://phpmd.org/rules/controversial.html#camelcasepropertyname on Jenkins ? On my IDE, I activated all PMD rules and I've the error in file /libraries/config/ConfigFile.class.php because of property $_defaultCfg (and others which have a leading underscore). Thanks for your answers. And Merry Christmas to everyone. Hugues.
-- Michal Čihař | http://cihar.com | http://phpmyadmin.net
------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel

Hi Dne Tue, 24 Dec 2013 17:20:42 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
I'm still thinking about PHPCS and PMD and I've some questions: - would you agree to only use PHPCS if possible ? I would like to see if it's possible to use all the PMD rules (or equivalent) in PHPCS.
For me it's perfectly fine, not sure if somebody else has other opinion.
- how could you not have this error http://phpmd.org/rules/controversial.html#camelcasepropertyname on Jenkins ? On my IDE, I activated all PMD rules and I've the error in file /libraries/config/ConfigFile.class.php because of property $_defaultCfg (and others which have a leading underscore).
Because we don't run controversial rule set (we only run codesize,design,naming,unusedcode). -- Michal Čihař | http://cihar.com | http://blog.cihar.com

Hi, 2014/1/3 Michal Čihař <michal@cihar.com>
Hi
Dne Tue, 24 Dec 2013 17:20:42 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
I'm still thinking about PHPCS and PMD and I've some questions: - would you agree to only use PHPCS if possible ? I would like to see if it's possible to use all the PMD rules (or equivalent) in PHPCS.
For me it's perfectly fine, not sure if somebody else has other opinion.
- how could you not have this error http://phpmd.org/rules/controversial.html#camelcasepropertyname on Jenkins ? On my IDE, I activated all PMD rules and I've the error in file /libraries/config/ConfigFile.class.php because of property $_defaultCfg (and others which have a leading underscore).
Because we don't run controversial rule set (we only run codesize,design,naming,unusedcode).
Thanks for your answer. Where do you (de)activate the rules please ? Directly in Jenkins ? Hugues.

Hi Dne Fri, 3 Jan 2014 10:53:33 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Thanks for your answer. Where do you (de)activate the rules please ? Directly in Jenkins ?
In build.xml we have ant rules which are executed in Jenkins. -- Michal Čihař | http://cihar.com | http://blog.cihar.com

Hi, 2014/1/3 Michal Čihař <michal@cihar.com>
Hi
Dne Fri, 3 Jan 2014 10:53:33 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
Thanks for your answer. Where do you (de)activate the rules please ? Directly in Jenkins ?
In build.xml we have ant rules which are executed in Jenkins.
Thank you so much, that's what I was looking for !
Hugues.

Hi, 2014/1/3 Michal Čihař <michal@cihar.com>
Hi
Dne Tue, 24 Dec 2013 17:20:42 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
I'm still thinking about PHPCS and PMD and I've some questions: - would you agree to only use PHPCS if possible ? I would like to see if it's possible to use all the PMD rules (or equivalent) in PHPCS.
For me it's perfectly fine, not sure if somebody else has other opinion.
It seems that all PMD rules are not implemented for PHPCS.
- how could you not have this error http://phpmd.org/rules/controversial.html#camelcasepropertyname on Jenkins ? On my IDE, I activated all PMD rules and I've the error in file /libraries/config/ConfigFile.class.php because of property $_defaultCfg (and others which have a leading underscore).
Because we don't run controversial rule set (we only run codesize,design,naming,unusedcode).
-- Michal Čihař | http://cihar.com | http://blog.cihar.com
I checked the duration of Jenkins jobs and saw (like said Michal) that the one ran during the night (with PMD) lasts around 9 minutes and the one ran after each commit lasts 1.5 minute. So implement all PMD rules for PHPCS will lead to have a longer continuous job. Not sure that's a good thing. I think that currently, we can't really improve this part… Hugues.

Hi Dne Sun, 5 Jan 2014 21:35:34 +0100 Hugues Peccatte <hugues.peccatte@gmail.com> napsal(a):
I checked the duration of Jenkins jobs and saw (like said Michal) that the one ran during the night (with PMD) lasts around 9 minutes and the one ran after each commit lasts 1.5 minute. So implement all PMD rules for PHPCS will lead to have a longer continuous job. Not sure that's a good thing.
I'm not really sure if this will be the case - the most of the time is IMHO parsing of the code, which would be done only once (though I have no knowledge of how both of these tools work). -- Michal Čihař | http://cihar.com | http://phpmyadmin.net
participants (4)
-
Hugues Peccatte
-
Madhura Jayaratne
-
Marc Delisle
-
Michal Čihař