Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#823 closed enhancement (fixed)

[PATCH] Add PHP linting tool for CodeSniffer

Reported by: chirila.s.alexandru@… Owned by:
Priority: major Milestone: 0.7
Component: Recipe commands Version: dev
Keywords: Cc: tony@…
Operating System:

Description

This patch adds support for parsing the output of CodeSniffer and to include it in the report. (similar to the python:pylint tool)

Example recipe:

<build xmlns:php="http://bitten.edgewall.org/tools/php"
       xmlns:svn="http://bitten.edgewall.org/tools/svn"
       xmlns:sh="http://bitten.edgewall.org/tools/sh">
  <step id="checkout">
    <svn:checkout url="svn://localhost/" path="${path}" revision="${revision}" username="harry" password="test" />
  </step>
  <step id="lint" onerror='ignore'>
    <sh:exec file="phpcs" args='--report=full --report-width=150 .' output="phpcs.out" />
    <php:phpcs file="phpcs.out" />
  </step>

</build>

Attachments (2)

bitten_phpcs.patch (2.8 KB) - added by chirila.s.alexandru@… 11 years ago.
bitten_phpcs2.patch (10.2 KB) - added by Alexandru Chirila <chirila.s.alexandru@…> 11 years ago.

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by chirila.s.alexandru@…

comment:1 Changed 11 years ago by Tony Meyer <tony@…>

  • Cc tony@… added

comment:2 Changed 11 years ago by osimons

Unit tests documenting format and successful reading would do wonders for chances of getting this committed. I'm not familiar with PHP or this tool, so tests are essential for understanding what it does and how.

Also, don't forget to include documentation for the new tool in doc\commands.txt.

Changed 11 years ago by Alexandru Chirila <chirila.s.alexandru@…>

comment:3 Changed 11 years ago by Alexandru Chirila <chirila.s.alexandru@…>

Attached a new patch, that also contains tests and documentation for this feature.

~/bitten-trunk$ python bitten/build/tests/phptools.py
..........
----------------------------------------------------------------------
Ran 10 tests in 0.036s

OK

Please note that this tool only has two types of messages WARNING and ERROR. Let me know if I can help with anything else.

comment:4 Changed 11 years ago by osimons

  • Milestone set to 0.7
  • Resolution set to fixed
  • Status changed from new to closed

Thanks again! Committed in [1023].

As I don't use PHP I can only hope others will find this superb patch useful ;-)

comment:5 Changed 11 years ago by osimons

Windows fix committed in [1025].

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.