2017 © Pedro Peláez
 

library php-lint-bash

A short bash script to recursively lint PHP files with a nice output. Based on njoannidi/phpLintBash

image

javiervivanco/php-lint-bash

A short bash script to recursively lint PHP files with a nice output. Based on njoannidi/phpLintBash

  • Friday, August 19, 2016
  • by javiervivanco
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7 Installations
  • Shell
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 1 Versions
  • 17 % Grown

The README.md

phpLintBash

A quick bash script to recursively lint PHP files in a given directory. Nice to use as part of a testing stragegy for CI, or after doing an epic merge., (*1)

Returns:

  • Number of Files linted
  • Number of Files passed
  • Number of Files failed
    • Offending errors
    • Output on STDERR if any files fail linting
  • Pass / Fail "Sanity check"
  • Proper Exit codes

Usage

$ phpLint, (*2)

  • Will recursively lint all PHP files in default directory specified in script

$ phpLint [directory], (*3)

Lint all files recursively of specified directory, (*4)

$ phpLint -e [exclude directory] -e [exclude directory] [directory], (*5)

Lint all files recursively of specified directory without exclude directory, (*6)

Overview:

  • Will return a pass / fail
  • Will only pass if all files pass
  • Any errors will be output in addition to the file they were found in

Scope:

  • This is a syntax checker. It will not run methods and check for correct returns
  • It is not a static analysis tool. Code quality / specs are not enforced or searched for

Caveats and Best Practice:

  • The nature of PHP's lint operation is to abort linting of a file once an error has been found, so...
  • If a file has multiple errors you will only be notified of the first error
  • Run until you're error-free
  • Although linting of the current file may have stopped due to a syntax error, linting of any remaining files in the queue will continue.

Scripting / Deployment Usage:

  • This will return proper exit codes so it can be used for scripting deployments, etc.
  • Pass
    • Exit 0 (clean)
    • Output on stdin
  • Fail
    • Exit 1
    • Output on stderr

Requires:

  • PHP
  • Bash

Based on njoannidi/phpLintBash, (*7)

The Versions

19/08 2016

dev-master

9999999-dev

A short bash script to recursively lint PHP files with a nice output. Based on njoannidi/phpLintBash

  Sources   Download

The Requires

  • php *

 

lint recursive ci syntax error linting error checking