| 1 | package Code::TidyAll::Plugin::PHPCodeSniffer; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Moo; | ||
| 7 | |||
| 8 | extends 'Code::TidyAll::Plugin'; | ||
| 9 | |||
| 10 | with 'Code::TidyAll::Role::RunsCommand'; | ||
| 11 | |||
| 12 | our $VERSION = '0.83'; | ||
| 13 | |||
| 14 | sub _build_cmd {'phpcs'} | ||
| 15 | |||
| 16 | sub validate_file { | ||
| 17 | my ( $self, $file ) = @_; | ||
| 18 | |||
| 19 | $self->_run_or_die($file); | ||
| 20 | |||
| 21 | return; | ||
| 22 | } | ||
| 23 | |||
| 24 | 1; | ||
| 25 | |||
| 26 | # ABSTRACT: Use phpcs with tidyall | ||
| 27 | |||
| 28 | __END__ | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =encoding UTF-8 | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | Code::TidyAll::Plugin::PHPCodeSniffer - Use phpcs with tidyall | ||
| 37 | |||
| 38 | =head1 VERSION | ||
| 39 | |||
| 40 | version 0.83 | ||
| 41 | |||
| 42 | =head1 SYNOPSIS | ||
| 43 | |||
| 44 | In configuration: | ||
| 45 | |||
| 46 | [PHPCodeSniffer] | ||
| 47 | select = htdocs/**/*.{php,js,css} | ||
| 48 | cmd = /usr/local/pear/bin/phpcs | ||
| 49 | argv = --severity 4 | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | Runs L<phpcs|http://pear.php.net/package/PHP_CodeSniffer> which analyzes PHP, | ||
| 54 | JavaScript and CSS files and detects violations of a defined set of coding | ||
| 55 | standards. | ||
| 56 | |||
| 57 | =head1 INSTALLATION | ||
| 58 | |||
| 59 | Install L<PEAR|http://pear.php.net/>, then install C<phpcs> from PEAR: | ||
| 60 | |||
| 61 | pear install PHP_CodeSniffer | ||
| 62 | |||
| 63 | =head1 CONFIGURATION | ||
| 64 | |||
| 65 | This plugin accepts the following configuration options: | ||
| 66 | |||
| 67 | =head2 argv | ||
| 68 | |||
| 69 | Arguments to pass to C<phpcs>. | ||
| 70 | |||
| 71 | =head2 cmd | ||
| 72 | |||
| 73 | The path for the C<phpcs> command. By default this is just C<phpcs>, meaning | ||
| 74 | that the user's C<PATH> will be searched for the command. | ||
| 75 | |||
| 76 | =head1 SUPPORT | ||
| 77 | |||
| 78 | Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. | ||
| 79 | |||
| 80 | =head1 SOURCE | ||
| 81 | |||
| 82 | The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. | ||
| 83 | |||
| 84 | =head1 AUTHORS | ||
| 85 | |||
| 86 | =over 4 | ||
| 87 | |||
| 88 | =item * | ||
| 89 | |||
| 90 | Jonathan Swartz <swartz@pobox.com> | ||
| 91 | |||
| 92 | =item * | ||
| 93 | |||
| 94 | Dave Rolsky <autarch@urth.org> | ||
| 95 | |||
| 96 | =back | ||
| 97 | |||
| 98 | =head1 COPYRIGHT AND LICENSE | ||
| 99 | |||
| 100 | This software is copyright (c) 2011 - 2022 by Jonathan Swartz. | ||
| 101 | |||
| 102 | This is free software; you can redistribute it and/or modify it under | ||
| 103 | the same terms as the Perl 5 programming language system itself. | ||
| 104 | |||
| 105 | The full text of the license can be found in the | ||
| 106 | F<LICENSE> file included with this distribution. | ||
| 107 | |||
| 108 | =cut |