Re: [Phpmyadmin-devel] Coding style checks

Hi Willian,
You don't need to run phpcs yourself, we have a continuous integration server that runs it every 10 minutes provided that there are new commits on master. Just select "checkstyle warnings" in the left menu on this page:http://ci.phpmyadmin.net/job/phpMyAdmin-continuous/
Bye, Rouslan
Hi Rouslan, But how should i test my changes in localhost before a pull request ? Are there any way? Thank you very much.

Le 2012-05-01 13:11, Willian Gustavo Veiga a écrit :
Hi Willian,
You don't need to run phpcs yourself, we have a continuous integration server that runs it every 10 minutes provided that there are new commits on master. Just select "checkstyle warnings" in the left menu on this page:http://ci.phpmyadmin.net/job/phpMyAdmin-continuous/
Bye, Rouslan
Hi Rouslan, But how should i test my changes in localhost before a pull request ? Are there any way? Thank you very much.
Willian, I am not familiar with PHP_CodeSniffer but maybe this link [0] can help. See also, in phpMyAdmin source, the PMAStandard directory. [0] http://pear.php.net/manual/en/package.php.php-codesniffer.php -- Marc Delisle http://infomarc.info

Hi Dne Tue, 01 May 2012 14:11:55 -0300 Willian Gustavo Veiga <wiltave@gmail.com> napsal(a):
Hi Willian,
You don't need to run phpcs yourself, we have a continuous integration server that runs it every 10 minutes provided that there are new commits on master. Just select "checkstyle warnings" in the left menu on this page:http://ci.phpmyadmin.net/job/phpMyAdmin-continuous/
Bye, Rouslan
Hi Rouslan, But how should i test my changes in localhost before a pull request ? Are there any way?
Sure there is :-). Once you install PHP CodeSniffer you can run it with our customized standard in phpMyAdmin's directory: phpcs --standard=PMAStandard file.php -- Michal Čihař | http://cihar.com | http://blog.cihar.com

On Wed, May 2, 2012 at 12:17 PM, Michal Čihař <michal@cihar.com> wrote:
Sure there is :-). Once you install PHP CodeSniffer you can run it with our customized standard in phpMyAdmin's directory:
phpcs --standard=PMAStandard file.php
If you also want to use the NetBeans plugin as Madhura suggested, once you have copied the PMAStandard folder inside your installation dir (.../CodeSniffer/Standards/), you simply go to Tools->Options-> ->PHP->Code Sniffer->Standard and select PMAStandard from the list. If you had NetBeans open while copying PMAStandard, then you have to restart the IDE in order for it to display the new option in the list. All the best, Alex

Le 2012-05-02 09:10, Alex Marin a écrit :
On Wed, May 2, 2012 at 12:17 PM, Michal Čihař <michal@cihar.com> wrote:
Sure there is :-). Once you install PHP CodeSniffer you can run it with our customized standard in phpMyAdmin's directory:
phpcs --standard=PMAStandard file.php
If you also want to use the NetBeans plugin as Madhura suggested, once you have copied the PMAStandard folder inside your installation dir (.../CodeSniffer/Standards/), you simply go to Tools->Options-> ->PHP->Code Sniffer->Standard and select PMAStandard from the list. If you had NetBeans open while copying PMAStandard, then you have to restart the IDE in order for it to display the new option in the list.
All the best, Alex
Can someone create a CodeSniffer page on http://wiki.phpmyadmin.net ? Don't forget to put this at the bottom: [[Category:Devel]] -- Marc Delisle http://infomarc.info

On Wed, May 2, 2012 at 4:22 PM, Marc Delisle <marc@infomarc.info> wrote:
Can someone create a CodeSniffer page on http://wiki.phpmyadmin.net ? Don't forget to put this at the bottom:
[[Category:Devel]]
I can do this tonight. -- Alex

I've created a wiki entry for CodeSniffer and it probably needs needs some review, so you can take a look and edit at [0]. [0] http://wiki.phpmyadmin.net/pma/CodeSniffer All the best, Alex

Dne Thu, 3 May 2012 04:12:51 +0300 Alex Marin <alex.ukf@gmail.com> napsal(a):
I've created a wiki entry for CodeSniffer and it probably needs needs some review, so you can take a look and edit at [0].
Just a small comment: you don't have to copy PMAStandard anywhere with phpcs if it is available in current directory - so running phpcs --standard=PMAStandard in phpMyAdmins checkout will work -- Michal Čihař | http://cihar.com | http://blog.cihar.com

On Thu, May 3, 2012 at 9:23 AM, Michal Čihař <michal@cihar.com> wrote:
Just a small comment:
you don't have to copy PMAStandard anywhere with phpcs if it is available in current directory - so running phpcs --standard=PMAStandard in phpMyAdmins checkout will work
Well I've initially tried it this way, but I get a stack trace: $ git co master $ git pull upstream master $ ls -al | grep PMA drwxrwxr-x 3 alex alex 4096 May 3 09:32 PMAStandard $ phpcs --standard=PMAStandard libraries/import/* PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Class PMAStandard_Sniffs_Commenting_FileCommentSniff not found' in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php:23 Stack trace: #0 /usr/share/php/PHP/CodeSniffer.php(652): include_once() #1 /usr/share/php/PHP/CodeSniffer.php(438): PHP_CodeSniffer->setTokenListeners('PMAStandard', Array) #2 /usr/share/php/PHP/CodeSniffer/CLI.php(551): PHP_CodeSniffer->process(Array, 'PMAStandard', Array, false) #3 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process() #4 {main} thrown in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php on line 23 alex@ukf-laptop:~/Documents/work/pma_github$ So my solution was to move that folder under Standards :) Am I the only one getting this error? -- Alex

Hi Dne Thu, 3 May 2012 09:41:04 +0300 Alex Marin <alex.ukf@gmail.com> napsal(a):
Well I've initially tried it this way, but I get a stack trace:
$ git co master $ git pull upstream master $ ls -al | grep PMA drwxrwxr-x 3 alex alex 4096 May 3 09:32 PMAStandard $ phpcs --standard=PMAStandard libraries/import/* PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Class PMAStandard_Sniffs_Commenting_FileCommentSniff not found' in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php:23 Stack trace: #0 /usr/share/php/PHP/CodeSniffer.php(652): include_once() #1 /usr/share/php/PHP/CodeSniffer.php(438): PHP_CodeSniffer->setTokenListeners('PMAStandard', Array) #2 /usr/share/php/PHP/CodeSniffer/CLI.php(551): PHP_CodeSniffer->process(Array, 'PMAStandard', Array, false) #3 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process() #4 {main} thrown in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php on line 23 alex@ukf-laptop:~/Documents/work/pma_github$
So my solution was to move that folder under Standards :) Am I the only one getting this error?
Well it works fine for me: $ phpcs --standard=PMAStandard libraries/import/xml.php FILE: /home/mcihar/private/phpmyadmin/phpmyadmin/libraries/import/xml.php -------------------------------------------------------------------------------- FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 158 | WARNING | Line exceeds 85 characters; contains 103 characters -------------------------------------------------------------------------------- Time: 0 seconds, Memory: 5.25Mb What phpcs version are you using? Mine is: $ phpcs --version PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (http://www.squiz.net) -- Michal Čihař | http://cihar.com | http://blog.cihar.com

On Thu, May 3, 2012 at 9:46 AM, Michal Čihař <michal@cihar.com> wrote:
What phpcs version are you using? Mine is:
$ phpcs --version PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (http://www.squiz.net)
The same one: $ phpcs --version PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (http://www.squiz.net)

Hi Dne Thu, 3 May 2012 10:03:41 +0300 Alex Marin <alex.ukf@gmail.com> napsal(a):
On Thu, May 3, 2012 at 9:46 AM, Michal Čihař <michal@cihar.com> wrote:
What phpcs version are you using? Mine is:
$ phpcs --version PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (http://www.squiz.net)
The same one: $ phpcs --version PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (http://www.squiz.net)
Hmm strange. Probably depends on order how it loads files, not sure how to influence this... -- Michal Čihař | http://cihar.com | http://blog.cihar.com

Le 2012-05-03 02:41, Alex Marin a écrit :
On Thu, May 3, 2012 at 9:23 AM, Michal Čihař <michal@cihar.com> wrote:
Just a small comment:
you don't have to copy PMAStandard anywhere with phpcs if it is available in current directory - so running phpcs --standard=PMAStandard in phpMyAdmins checkout will work
Well I've initially tried it this way, but I get a stack trace:
$ git co master $ git pull upstream master $ ls -al | grep PMA drwxrwxr-x 3 alex alex 4096 May 3 09:32 PMAStandard $ phpcs --standard=PMAStandard libraries/import/* PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Class PMAStandard_Sniffs_Commenting_FileCommentSniff not found' in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php:23 Stack trace: #0 /usr/share/php/PHP/CodeSniffer.php(652): include_once() #1 /usr/share/php/PHP/CodeSniffer.php(438): PHP_CodeSniffer->setTokenListeners('PMAStandard', Array) #2 /usr/share/php/PHP/CodeSniffer/CLI.php(551): PHP_CodeSniffer->process(Array, 'PMAStandard', Array, false) #3 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process() #4 {main} thrown in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php on line 23 alex@ukf-laptop:~/Documents/work/pma_github$
So my solution was to move that folder under Standards :) Am I the only one getting this error?
I get the same error; I am running PHP 5.4.0. -- Marc Delisle http://infomarc.info

Hi Dne Thu, 03 May 2012 07:16:37 -0400 Marc Delisle <marc@infomarc.info> napsal(a):
Le 2012-05-03 02:41, Alex Marin a écrit :
On Thu, May 3, 2012 at 9:23 AM, Michal Čihař <michal@cihar.com> wrote:
Just a small comment:
you don't have to copy PMAStandard anywhere with phpcs if it is available in current directory - so running phpcs --standard=PMAStandard in phpMyAdmins checkout will work
Well I've initially tried it this way, but I get a stack trace:
$ git co master $ git pull upstream master $ ls -al | grep PMA drwxrwxr-x 3 alex alex 4096 May 3 09:32 PMAStandard $ phpcs --standard=PMAStandard libraries/import/* PHP Fatal error: Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Class PMAStandard_Sniffs_Commenting_FileCommentSniff not found' in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php:23 Stack trace: #0 /usr/share/php/PHP/CodeSniffer.php(652): include_once() #1 /usr/share/php/PHP/CodeSniffer.php(438): PHP_CodeSniffer->setTokenListeners('PMAStandard', Array) #2 /usr/share/php/PHP/CodeSniffer/CLI.php(551): PHP_CodeSniffer->process(Array, 'PMAStandard', Array, false) #3 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process() #4 {main} thrown in /home/alex/Documents/work/pma_github/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php on line 23 alex@ukf-laptop:~/Documents/work/pma_github$
So my solution was to move that folder under Standards :) Am I the only one getting this error?
I get the same error; I am running PHP 5.4.0.
Okay, I have 5.4.1RC1, but I would wonder if it makes the difference. -- Michal Čihař | http://cihar.com | http://blog.cihar.com

Le 2012-05-02 21:12, Alex Marin a écrit :
I've created a wiki entry for CodeSniffer and it probably needs needs some review, so you can take a look and edit at [0].
[0] http://wiki.phpmyadmin.net/pma/CodeSniffer
All the best, Alex
Excellent wiki page! -- Marc Delisle http://infomarc.info
participants (4)
-
Alex Marin
-
Marc Delisle
-
Michal Čihař
-
Willian Gustavo Veiga