Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (42 sloc) 2.784 kb

parallint

Bash script which runs php lint ('php -l') on all *.php files in one or more directories recursively.

php-parallint spawns parallel processes to speed up execution of php lint across many files. This can be particularly useful for ci and projects with large numbers of php files, as the speed examples below illustrate.

The maximum number of parallel processes spawned, by default, maches the # of cpu cores on your system. This should be optimal in most cases, but can be overidden with -p option if required.

Usage

Usage: ./parallint.sh [-v] [-p processes] dir1 [dir2 ... dirN]

OPTIONS:
  -p Maximum parallel process count. Default: <# of cpu cores>
  -v Verbose output
  -h Displays this message

Speed Examples

Illustrates execution speeds for 1, 2 and 4 parallel processes, respectively. My processor is quad-core, so '-p 8' is not shown (for now).
Speed will obviously vary depending on the system hardware and the number of files being linted.

-p 1

$ time ./parallint.sh -p 1 ZendFramework-1.12.0rc2-minimal
Running php lint on dir: ZendFramework-1.12.0rc2-minimal
PHP is lint free!

real    2m9.324s
user    1m30.184s
sys     0m26.456s

-p 2

$ time ./parallint.sh -p 2 ZendFramework-1.12.0rc2-minimal
Running php lint on dir: ZendFramework-1.12.0rc2-minimal
PHP is lint free!

real    1m22.240s
user    1m31.998s
sys     0m31.091s

-p 4

$ time ./parallint.sh -p 4 ZendFramework-1.12.0rc2-minimal
Running php lint on dir: ZendFramework-1.12.0rc2-minimal
PHP is lint free!

real    0m49.860s
user    1m32.961s
sys     0m30.788s

License

MIT License

Copyright (c) 2012 Scott LeMay Paradis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Jump to Line
Something went wrong with that request. Please try again.