2017 © Pedro Peláez
 

library phplint

A configurable linter tool for PHP.

image

tengattack/phplint

A configurable linter tool for PHP.

  • Tuesday, June 19, 2018
  • by tengattack
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PHPLint

A configurable linter tool for PHP., (*1)

Introduction

Dependencies

Installation

$ composer global require tengattack/phplint
$ # htmllint is used by rule `html` (it has to be latest)
$ npm i -g htmllint/htmllint-cli
$ # stylelint is used by rule `html`
$ npm i -g stylelint
$ # scss-lint is used by rule `html` (deprecated)
$ gem install scss_lint

Run

$ export PATH=$PATH:~/.composer/vendor/bin
$ phplint /path/to/phpfile

Configuration

If no configuration file is specified, it will first read the file .phplint.yml on current working directory as configuration, and if still not exists it will use the default configuration., (*2)

You can configure it as you want base on this file: .phplint.yml., (*3)

Example

A php file test.php with following content:, (*4)

<?php

$a =false;
$b = $a ?? 1;
if($b) {

}
$ phplint test.php

Output:, (*5)

test.php:
+-----+----------+---------------------------------+-----------------+
| loc | severity | message                         | ruleId          |
+-----+----------+---------------------------------+-----------------+
| 3:5 | error    | Infix operators must be spaced. | space-infix-ops |
| 5:1 | error    | A space is required after 'if'. | keyword-spacing |
| 5:8 | error    | Empty block statement.          | no-empty        |
+-----+----------+---------------------------------+-----------------+

Testing

vendor/bin/phpunit

# single rule test
vendor/bin/phpunit tests/rules/curly.php

License

MIT, (*6)

The Versions

19/06 2018

dev-master

9999999-dev https://github.com/tengattack/phplint

A configurable linter tool for PHP.

  Sources   Download

MIT

The Requires

 

by Avatar tengattack

parser lint linter phplint