Git Product home page Git Product logo

p5-app-critique's Introduction

App::Critique

An incremental refactoring tool for Perl powered by Perl::Critic.

CPAN version

Acknowledgement

This module was originally developed for Booking.com. With approval from Booking.com, this module was generalized and published on CPAN, for which the authors would like to express their gratitude.

Copyright

This software is copyright (c) 2016-2017 by Stevan Little.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

p5-app-critique's People

Contributors

book avatar stevan avatar stuartskelton avatar thule0 avatar xsawyerx avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

p5-app-critique's Issues

critique doesn't recover from perlcritic crash

If perl critic crashes, critique doesn't recover.

To reproduce, create a perl script that chokes perlcritic (e.g. use an unquoted non-ASCII key name in a hash):

#!/usr/bin/perl
use utf8;
my $foo = { fó => 3 };

perlcritic will choke:

$ perlcritic x.pl
Problem while critiquing "x.pl": Can't parse code: Fatal error... regex failed to match in 'ó => 3 };
' when expected at /usr/share/perl5/PPI/Token/Word.pm line 217.

And when critique comes across such an error, it doesn't recover:

Running Perl::Critic against ([path hidden])
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Can't parse code: Fatal error... regex failed to match in 'ú}->{mappings}}), 2;
' when expected at /usr/share/perl5/PPI/Token/Word.pm line 217.

i18n the output

The output should be able to be internationalized, which should be relatively straightforward using something like Locale::Maketext.

Add support for `~/.critique/config.json`

This would populate the values in %App::Critique::CONFIG, which are currently being populated in the bin/critique script.

Additionally we need to add support for the %SKIP values in App::Critique::Command::collect to this config (see comment on #9 for more info)

add in a --local option to init

This would put the .critique directory into the current working directory, this would allow you to keep project local critique session files.

NOTE:
To avoid different users overwriting each others session files, the repo-name portion of the .critique path should be replaced by $USER or the git users email.

Add option for `git add -p`

Some editors do automatic text formatting (especially as it relates to whitespace), or one may patch up some related code while fixing a perlcritic issue.

In such cases, the ability to run git add -p could be invaluable in separating the perlcritic-related fixes from other changes.

Commit Message:

    Variable declared in conditional statement - critique(Variables::ProhibitConditionalDeclarations)

Choose (y)es to use this message, or (n)o for more options [Y/n]: n
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
What would you like to edit? (f)ile, (c)ommit message: 

Perhaps this prompt could add a (p)atch option to select which changes are included in the commit.

Add re-check/scan option to post-edit prompt

When using a graphical editor (atom in my case) which automatically drops to the background, critique re-scans the target file before an edit has been made:

Would you like to fix this violation? [Y/n]: 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
No edits found, would like to (e)dit again, or (s)kip this file?: 

My present work-around is to select 'e', which re-launches the editor before re-scanning the file. I suggest adding a (r)e-scan option, to skip the editor launch before re-checking for changes.

Fix startup time issue on large repos

On a large repos it can take a little while sometimes to start up and load the session file, this can be short circuited by just checking for the file and only then loading the session.

Storable error via Parallel::ForkManager

The storable module was unable to store the child's data structure to the temp file "/tmp/q70Nc_J3ax/Parallel-ForkManager-28018-28040.txt":
Can't create /tmp/q70Nc_J3ax/Parallel-ForkManager-28018-28040.txt: No such file or directory at /usr/.../Parallel/ForkManager.pm line 73.

critique dies when a file is removed

When I updated my git checkout, some files and directories were removed. Now critique dies when it comes to them, and I find no option to skip:

=============================================================================================================================================================================================================================================
Running Perl::Critic against (apps/oozie/workflows/ranking-nbl-v2/export.pl)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Can't parse code: Did not pass a PPI::Tokenizer object to PPI::Lexer::lex_tokenizer

Move to Path::Tiny

Path::Class and File::Spec are great, but Path::Tiny seems more sensible and I need to just make the switch in my brain.

Default when editing a commit message

What would you like to edit? (f)ile, (c)ommit message: c
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please write a commit message: : 

It might be nice to show the original commit message as the default. Or better, perhaps, open the commit message in an editor, with the default in place (i.e. git commit -e -F)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.