Open xsawyerx opened 8 years ago
How about:
return send_error(); # superfluous return
Added!
I have started this module, with two policies, ProhibitDeprecatedKeywords, and ProhibitUnrecommendedKeywords. It's available via CPAN now: Perl::Critic::Dancer2. I'll be adding more later, and your recommendations/suggestions/pull requests are absolutely welcome!
I've added a policy, "ReturnNotNeeded", which handles superfluous returns.
I also have additional ideas:
send_as JSON
instead of return to_json
and similar constructs@GeekRuthie This is a great service to all Dancer2 users. Great job!
I have a few notes which might (or might not) help:
params
, I suggest adding a link to the appropriate document or this article on it. Changing it might require changing an assumption in the app itself. For example, an app that expected the same input parameter from either the query or the body should check both parameter sources or change the expectations (i.e., only accept it from one parameter source).:syntax
, :script
, and :tests
?:nopragmas
is often in bad form because you're making sure strict
and warnings
are not imported. If you were to write it, I'd recommend giving an example of how to do it without the import flag: package App; { use Dancer2; } ...
- this will restrict strict
and warnings
to a small scope that ends immediately after, so it doesn't affect the rest of the code.Regarding your ideas:
to_json -> send_as
idea is interesting. Either I'm not big on it or I think it's brilliant, and I'm not sure which. :)Dancer2::Test
is deprecated. I think both Plack::Test
and Test::WWW::Mechanize::PSGI
are good. I would recommend either.Anyway, really cool work! :)
I had worked in the past on a Perl::Lint policy. It's available here.
I want to use this ticket to collect what this should include (possibly multiple policies) so it could be coordinated, documented, and written:
param
andparams
. (params('query')
can be identified to recommendquery_parameters
instead.)dance
. (Suggestto_app
instead.)return send_error(...);
orreturn redirect(...);
.