Using Flitch for coding standard validation

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Flitch for coding standard validation

Ben Scholzen 'DASPRiD'
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

weierophinney
Administrator
-- Ben Scholzen 'DASPRiD' <[hidden email]> wrote
(on Monday, 12 November 2012, 05:00 PM +0100):

> Good day everyone,
>
> I eventually managed to improve the internals of Flitch even further,
> and added the complete PSR-1 standard so far. Currently I'm working on
> implementing the remaining PSR-2 standard and I wanted to bring up this
> topic as early as possible.
>
> I'd like to see Flitch to be used in the ZF2 build process. I'm
> currently not completely happy with putting it into Travis, as we'll
> only get a textual representation of the violations if some error
> occurs. Thus I'd like to hear your opinions or suggestions about this topic.

What does it offer over php-cs-fixer at this point?

The reason I ask is:

 * php-cs-fixer indicates the filename and type of violation
 * for maintainers (i.e., those merging and pushing), it will also
   correct the violations for us.

From your own descriptions, it doesn't sound like Flitch gives us either
of those things yet -- so my question is: why? how will it benefit us
*now*?

(I'm certainly open to change -- but I need to see a concrete benefit
befor we change the tools we use.)

> Let me step back now and explain Flitch for a second, and what it offers
> us over our current approach (using php-cs-fixer as validator). Flitch
> is a coding standard validator written from the ground up as a
> replacement for PHPCS (more about this in the README.md file). It
> supports proper violation reporting in CLI environments as well as
> checkstyle-compatible reportings, which can be utilized by CI systems
> like Jenkins to display metrics. If you like to know more, check out the
> repository on GitHub <https://github.com/DASPRiD/Flitch>.
>
> Again, I'd like to hear your thoughts and opinions about it and if
> possible, play a bit around with Flitch, test it with your code or
> anything else. I'm also taking contributions to finish Flitch even quicker.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

Ben Scholzen 'DASPRiD'
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

Artur Bodera
In reply to this post by Ben Scholzen 'DASPRiD'
On Mon, Nov 12, 2012 at 5:00 PM, Ben Scholzen 'DASPRiD' <[hidden email]> wrote:
Again, I'd like to hear your thoughts and opinions about it and if
possible, play a bit around with Flitch, test it with your code or
anything else. I'm also taking contributions to finish Flitch even quicker.

Will it also be auto-fixer, or just a scanner/validator ? (readme suggests it's only a validator)

Will the final version be complimentary to php-cs-fixer or a replacement ?

-- 
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

Ben Scholzen 'DASPRiD'
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

weierophinney
Administrator
-- Ben Scholzen 'DASPRiD' <[hidden email]> wrote
(on Tuesday, 13 November 2012, 01:10 PM +0100):
> On 13.11.2012 11:24, Artur Bodera wrote:
> > Will it also be auto-fixer, or just a scanner/validator ? (readme
> > suggests it's only a validator)
> >
> > Will the final version be complimentary to php-cs-fixer or a replacement ?
>
> It will only be a validator, nothing more. It will also contain ZF
> specific rules like abstract- and interface naming, alphabetic ordering
> of "use" statements and such.

I'll be honest: I have very little interest in a CS tool that cannot
also fix at least a good subset of errors. I realize php-cs-fixer cannot
fix all violations, and does not necessarily catch all ZF2-specific
violations, but it simplifies the work of myself and other contributors
immensely; there's far less I need to review manually.

Have you considered instead contributing to php-cs-fixer, so that it can
be extended with additional rules?

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

Ben Scholzen 'DASPRiD'
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

Tomáš Fejfar
BTW: Can't Flitch have fix functionality (I mean architecturally/ideologically can't)? At least for the most basic stuff?

Tomas Fejfar, w3w.cz

twitter: @tomasfejfar

email: [hidden email]
www: http://www.tomasfejfar.cz



On Tue, Nov 13, 2012 at 10:21 PM, Ben Scholzen 'DASPRiD' <[hidden email]> wrote:
On 13.11.2012 15:46, Matthew Weier O'Phinney wrote:
> -- Ben Scholzen 'DASPRiD' <[hidden email]> wrote
> (on Tuesday, 13 November 2012, 01:10 PM +0100):
>> On 13.11.2012 11:24, Artur Bodera wrote:
>>> Will it also be auto-fixer, or just a scanner/validator ? (readme
>>> suggests it's only a validator)
>>>
>>> Will the final version be complimentary to php-cs-fixer or a replacement ?
>>
>> It will only be a validator, nothing more. It will also contain ZF
>> specific rules like abstract- and interface naming, alphabetic ordering
>> of "use" statements and such.
>
> I'll be honest: I have very little interest in a CS tool that cannot
> also fix at least a good subset of errors. I realize php-cs-fixer cannot
> fix all violations, and does not necessarily catch all ZF2-specific
> violations, but it simplifies the work of myself and other contributors
> immensely; there's far less I need to review manually.
>
> Have you considered instead contributing to php-cs-fixer, so that it can
> be extended with additional rules?

php-cs-fixer does not have any kind of rules. Within ZF, we are actually
just abusing the fixer's "--dry-run" and look if there's any output by
it. This means that we will never be able to detect things which are not
fixable by php-cs-fixer.

Where exactly is the problem using Flitch for detection (within travis,
maybe also by users, it's actually up to them), and using php-cs-fixer
just for fixing (or doing it manually, whatever the developer prefers).

By the way, taking a deper look into php-cs-fixer, it tries to fix stuff
not even defined in PSR-2 (or lower).


--
Ben Scholzen 'DASPRiD'
Community Review Team Member | [hidden email]
Zend Framework               | http://www.dasprids.de

Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

Ben Scholzen 'DASPRiD'
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Using Flitch for coding standard validation

xoops
In reply to this post by Ben Scholzen 'DASPRiD'
To me a complete and reliable validator is more desired for team code review and commit hook.
That's why I prefer the Flitch.

On Wed, Nov 14, 2012 at 5:21 AM, Ben Scholzen 'DASPRiD' <[hidden email]> wrote:
On 13.11.2012 15:46, Matthew Weier O'Phinney wrote:
> -- Ben Scholzen 'DASPRiD' <[hidden email]> wrote
> (on Tuesday, 13 November 2012, 01:10 PM +0100):
>> On 13.11.2012 11:24, Artur Bodera wrote:
>>> Will it also be auto-fixer, or just a scanner/validator ? (readme
>>> suggests it's only a validator)
>>>
>>> Will the final version be complimentary to php-cs-fixer or a replacement ?
>>
>> It will only be a validator, nothing more. It will also contain ZF
>> specific rules like abstract- and interface naming, alphabetic ordering
>> of "use" statements and such.
>
> I'll be honest: I have very little interest in a CS tool that cannot
> also fix at least a good subset of errors. I realize php-cs-fixer cannot
> fix all violations, and does not necessarily catch all ZF2-specific
> violations, but it simplifies the work of myself and other contributors
> immensely; there's far less I need to review manually.
>
> Have you considered instead contributing to php-cs-fixer, so that it can
> be extended with additional rules?

php-cs-fixer does not have any kind of rules. Within ZF, we are actually
just abusing the fixer's "--dry-run" and look if there's any output by
it. This means that we will never be able to detect things which are not
fixable by php-cs-fixer.

Where exactly is the problem using Flitch for detection (within travis,
maybe also by users, it's actually up to them), and using php-cs-fixer
just for fixing (or doing it manually, whatever the developer prefers).

By the way, taking a deper look into php-cs-fixer, it tries to fix stuff
not even defined in PSR-2 (or lower).


--
Ben Scholzen 'DASPRiD'
Community Review Team Member | [hidden email]
Zend Framework               | http://www.dasprids.de



--

Taiwen Jiang (aka D.J.)

Build Xoops Engine
web and mobile application platform

CTO for EEFOCUS.com
Leading social platform for electronics professionals