Files
perl-criticism/perl-criticism.spec
2025-08-12 18:12:47 +02:00

90 lines
3.4 KiB
RPMSpec

#
# spec file for package perl-criticism
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name criticism
Name: perl-criticism
Version: 1.20.0
Release: 0
# 1.02 -> normalize -> 1.20.0
%define cpan_version 1.02
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Perl pragma to enforce coding standards and best-practices
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/T/TH/THALJEF/%{cpan_name}/%{cpan_name}-%{cpan_version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(IO::String)
BuildRequires: perl(Module::Build)
BuildRequires: perl(Perl::Critic) >= 1.089
Requires: perl(Perl::Critic) >= 1.089
Provides: perl(criticism) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
This pragma enforces coding standards and promotes best-practices by
running your file through Perl::Critic before every execution. In a
production system, this usually isn't feasible because it adds a lot of
overhead at start-up. If you have a separate development environment, you
can effectively bypass the 'criticism' pragma by not installing
Perl::Critic in the production environment. If Perl::Critic can't be
loaded, then 'criticism' just fails silently.
Alternatively, the 'perlcritic' command-line (which is distributed with
Perl::Critic) can be used to analyze your files on-demand and has some
additional configuration features. And Test::Perl::Critic provides a nice
interface for analyzing files during the build process.
If you'd like to try Perl::Critic without installing anything, there is a
web-service available at http://perlcritic.com. The web-service does not
yet support all the configuration features that are available in the native
Perl::Critic API, but it should give you a good idea of what it does. You
can also invoke the perlcritic web-service from the command line by doing
an HTTP-post, such as one of these:
$> POST http://perlcritic.com/perl/critic.pl < MyModule.pm
$> lwp-request -m POST http://perlcritic.com/perl/critic.pl < MyModule.pm
$> wget -q -O - --post-file=MyModule.pm http://perlcritic.com/perl/critic.pl
Please note that the perlcritic web-service is still alpha code. The URL
and interface to the service are subject to change.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644
%build
perl Build.PL --installdirs=vendor
./Build build --flags=%{?_smp_mflags}
%check
./Build test
%install
./Build install --destdir=%{buildroot} --create_packlist=0
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%license LICENSE
%changelog