New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for Perl::Tidy::Sweet #9

Closed
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@mvgrimes

mvgrimes commented May 31, 2016

Perl::Tidy::Sweet uses Perl::Tidy's prefilter and postfilter hooks to
support syntax added by a number of modules (p5-mop,
Method::Signatures::Simple, MooseX::Method::Signatures, MooseX::Declare,
etc). This includes method and func keywords, including the (possibly
multi-line) parameter lists.

This patch adds a --sweet/-s flag to both the install and pre-commit
commands. When specified, code is tied with Perl::Tidy::Sweet instead of
Perl::Tidy.

Perl::Tidy::Sweet is added as a prereq in the Makefile.PL, as
"recommends" doesn't seem to do anything (I'm not that familiar with
Module::Install).

A new test has been added that optionally runs all the tests with the
--sweet flag. This might be overkill. It would probably be sufficient to
just test the tidying of code with the method keyword.

This is my contribution to May's PRC. I just happen to be the author of
Perl::Tidy::Sweet.

Adds support for Perl::Tidy::Sweet
Perl::Tidy::Sweet uses Perl::Tidy's prefilter and postfilter hooks to
support syntax added by a number of modules (p5-mop,
Method::Signatures::Simple, MooseX::Method::Signatures, MooseX::Declare,
etc).  This includes method and func keywords, including the (possibly
multi-line) parameter lists.

This patch adds a --sweet/-s flag to both the install and pre-commit
commands. When specified, code is tied with Perl::Tidy::Sweet instead of
Perl::Tidy.

Perl::Tidy::Sweet is added as a prereq in the Makefile.PL, as
"recommends" doesn't seem to do anything (I'm not that familiar with
Module::Install).

A new test has been added that optionally runs all the tests with the
--sweet flag. This might be overkill. It would probably be sufficient to
just test the tidying of code with the method keyword.

This is my contribution to May's PRC. I just happen to be the author of
Perl::Tidy::Sweet.
@mlawren

This comment has been minimized.

Owner

mlawren commented Jul 17, 2018

Many thanks for the suggestion and the patch. I'm sorry I didn't respond - probably meant you didn't succeed with the PRC challenge for that month :-(

I have just implemented Sweetened support which you can see in action in the latest development release. It uses a slightly different mechanism than the one you proposed here. A --sweet flag would mean that Sweetened tidying would depend on each commiter installing githook-perltidy the correct way.

What I've done instead is require a .perltidyrc.sweetend file to be committed in place of the .perltidyrc file. That enforces the same behaviour across all committers. I'll let the CPAN testers do their thing for a while before I make a stable release. If you have any comments I'd be pleased to hear them.

@mlawren mlawren closed this Jul 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment