We have received the following grant application. Please leave feedback in the comments field by March 22nd, 2014.
Perl::Lint - Yet Another Static Analyzer for Perl5
Taiki Kawakami (@moznion)
This project aims to create a fast and flexible static analyzer for Perl5 that has compatibility with Perl::Critic, with the goal to be light and fast enough to allow near real-time check of Perl source code while you code (e.g. hook it in your editor)
Why do I fork Perl::Critic?
Currently Perl::Critic uses PPI to analyze perl source code, which is relatively slow. The processing time can be greatly shortened by about 30 times the current value by replacing PPI with
Compiler::Parser, which are new tools created by Masaaki Goshima who authored
Using these modules are the main ingredients to the speed up, but in my previous attempts introduce these changes to Perl::Critic, it has proven difficult to do this without changing the current codebase significantly thereby causing significant trouble for the current user base. It would especially affect the already-existing plugins for Perl::Critic.
Rather than breaking existing functionality, I propose to build a new tool that is feature-wise compatible to Perl::Critic, but with much faster processing speed.
Benefits to the Perl Community
While Perl::Critic is an extremely useful tool, we have seen many colleagues avoiding its use because of its slowness. Improving the execution speed of Perl::Critic would lower the barrier to use in your day-to-day hacking activities, thus also leading to a better quality code, and improved development efficiency. With a fast enough Perl::Critic, one might even be able to embedded in an editor for seamless and continuous checking as you write.
Compiler::Lexer and Compiler::Parser are tokenizer and parser for Perl5 written in C++, which offers unparalleled speed compare to pure-perl competitors used in PPI. They are used in projects such as PerlMotion which transpiles Perl5 code to Objective-C.
A real life example replacing PPI with Compiler::Lexer can be found in Perl::MinimumVersion and Perl::MinimumVersion::Fast . The former is implemented using PPI, and the latter uses Compiler::Lexer. A simple benchmark shows that Perl::MinimumVersion::Fast is about 33 times faster than Perl::MinimumVersion (https://metacpan.org/pod/Perl::MinimumVersion::Fast#BENCHMARK). Applying this to Perl::Critic, one can expect at least an order of magnitude faster processing.
Therefore goal of this project is to create this much faster replacement while still keeping compatibility with Perl::Critic.
Analyze functions of Perl::Critic (half to one day)
Extract items that Perl::Critic currently checks
Implement tokenizer (two or three weeks)
Parse source code written in perl and divide to tokens by Compiler::Lexer and Compiler::Parser.
Implement code analyzer (two or three weeks)
Analyze and evaluate tokens by checking with inspection rules
Implement a system to define inspection rules (one or half week)
Implement a system to define inspection rules on this phase, as well as a basic set of rules that are frequently used (mostly ported from original Perl::Critic rules)
Period: within two months When can I start: May 2014
Pass all of tests for Perl::Critic, benchmark against Perl::Critic, and release the module to CPAN.
I am a software engineer and graduate student (majoring in high-performance computing and software engineering) in Japan. I'm experienced in systems development for about five years, and I have worked with perl for about 2 years. I have contributed to a few open source projects (mostly involving perl) and have released a few CPAN modules. Please refer to the following web sites for details:
I am also a member of Compiler::Lexer development team, so I know the inner implementation of these modules which are crucial for this project. I believe I can apply those skills to this project.
While the original proposal was written by Taiki Kawakami, Daisuke Maki was responsible for editing this proposal's English.