App::C...S::Lint(3pm)

πŸ“¦
version 0.05 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble

✨ App::CPANTS::Lint β€” the NAME section, but make it cute ✨

okay so bestie, this is App::CPANTS::Lint, and it's basically the front-end to Module::CPANTS::Analyse. that's the whole vibe. πŸ’…

It's a User Contributed Perl Documentation page, so you know it's real. 🫢


🌸 SYNOPSIS 🌸

here's how you actually use it, no cap:

use App::CPANTS::Lint;

my $app = App::CPANTS::Lint->new(verbose => 1);
$app->lint('path/to/Foo-Dist-1.42.tgz') or print $app->report;

# if you need raw data
$app->lint('path/to/Foo-Dist-1.42.tgz') or return $app->result;

# if you need to look at the details of analysis
$app->lint('path/to/Foo-Dist-1.42.tgz');
print Data::Dumper::Dumper($app->stash);

literally that's it. three whole modes of existence. ✨


πŸ’– DESCRIPTION πŸ’–

so App::CPANTS::Lint is the core of the cpants_lint.pl script β€” its whole job is checking the Kwalitee of a distribution. if you just wanna casually use it, go look at the script itself, it's giving convenience. but if you're the kind of girl who needs finer control, you can call this from other modules too. main character energy fr fr. πŸ‘‘


πŸŽ€ METHODS πŸŽ€

new

Takes an optional hash β€” and bestie, that hash gets passed into Module::CPANTS::Analyse internally β€” and creates a linter object for you. iconic. πŸ’…

The available options are, and I cannot stress this enough, all of them:

  • verbose β€” makes Module::CPANTS::Analyse verbose. False by default. (yes, the default is silence. mysterious. love that for us.)
  • core_only β€” if true, the lint method (scroll down, it's right there) returns true even if extra metrics fail, and experimental metrics too. lowkey useful if all you care about is Kwalitee rankings. False by default.
  • experimental β€” if true, failed experimental metrics also get reported (via the report method). False by default. ⚠️ heads up though: experimental metrics are not taken into account while calculating a score. so they're just there. existing. being extra. πŸ™ˆ
  • save β€” if true, the output_report method writes to a file instead of writing to STDOUT.
  • dump, yaml, json β€” if true, the report method returns a formatted dump of the stash (see below). three little format gremlins, pick your fighter. 🌈
  • search_path β€” if you'd like to use extra metrics modules, pass a reference to an array of their parent namespace(s) to search. and ngl, metrics modules under the Module::CPANTS::Kwalitee namespace are always used, no opt-out, that's just the law. πŸ‘‘

lint

Takes a path to a distribution tarball and analyses it. Returns true if the distribution has no significant issues β€” and note that experimental metrics are always ignored here, periodt. Otherwise? Returns false. πŸ’€

⚠️ real talk: the result doesn't always match what's shown at the CPANTS website, because there are metrics that are only available at the site for various reasons. some of them require a database connection, and some are just not portable enough. so don't come for me if the numbers disagree, it's giving "it's complicated". 😭

report

Returns a report string that contains the details of failed metrics (yes, even if the lint method returns true, it still tells you) plus a Kwalitee score. πŸŽ€

And if dump (or yaml, or json) was set when you created your App::CPANTS::Lint object, then report returns a formatted dump of the stash instead. plot twist. ✨

result

Returns a reference to a hash that contains the details of failed metrics and a Kwalitee score. ⚠️ the internal structure may change without notice, but it always has an ok field (which holds a return value of the lint method) at least. so grab that ok and don't get too attached to anything else, bestie. πŸ’œ

stash

Returns a reference to a hash that contains the details of analysis (stored in a stash in Module::CPANTS::Analyse). ⚠️ same warning, same energy: the internal structure may change without notice, but it always has a kwalitee field (which holds a reference to a hash containing the result of each metric) at least. one guaranteed field, zero promises about the rest. πŸ¦‹

score

Returns a Kwalitee score. that's it. that's the whole method. slay. ⭐

output_report

Writes a report to STDOUT (or to a file, if you told it to). simple. clean. we love her. πŸ’–

report_file

Returns a path to a report file. and the naming scheme? the file should have the same distribution name with a version, plus an extension appropriate to the output format. so like:

  • Foo-Bar-1.42.txt
  • Foo-Bar-1.42.yml

etc. consistent naming is self-care, iykyk. 🌸


πŸ‘€ SEE ALSO πŸ‘€

  • Module::CPANTS::Analyse
  • Test::Kwalitee

go read them, they're the supporting cast and they ate. πŸ”₯


✍️ AUTHOR ✍️

Kenichi Ishigaki, <ishigaki@cpan.org> β€” absolute legend, we stan. πŸ‘‘


This software is copyright (c) 2014 by Kenichi Ishigaki.

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


okay that's the whole page bestie, you're so ready. this lil doc came to you courtesy of perl v5.34.0, dated 2022-06-08, and the manual name it lives under is App::C...S::Lint(3pm) β€” now go lint something and make it iconic. πŸ’…βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from