Giter Site home page Giter Site logo

gulp-phplint's Introduction

gulp-phplint

PHPLint plugin for Gulp

Installation

Install phplint service (globally)

npm i -g phplint
yarn global add phplint

Install gulp-phplint as a development dependency to your project (for each project)

npm i -S gulp-phplint
yarn add gulp-phplint -D

Usage

After you have installed the plugin, reference it in to your gulpfile.js:

var phplint = require('gulp-phplint');

Option 1

Default format. Equivalent to using phplint in command line (no options).

var gulp    = require('gulp');
var phplint = require('gulp-phplint');

gulp.task('phplint', function() {
  gulp.src('')
    .pipe(phplint());
});

Option 2

Default format using the error reporter.

gulp.task('phplint', function() {
  return gulp.src(['./src/AppBundle/**/*.php'])
    .pipe(phplint('', { /*opts*/ }))
    .pipe(phplint.reporter('error'));
});

Option 3

Custom src files and custom reporter.

gulp.task('phplint:custom', function () {
  return gulp.src(['./src/AppBundle/**/*.php'])
    .pipe(phplint('', { /*opts*/ }))
    .pipe(phplint.reporter(function(file){
      var report = file.phplintReport || {};
      if (report.error) {
        console.error(report.message+' on line '+report.line+' of '+report.filename);
      }
    }));
});

API

phplint(path, options)

path

Type: String

Path to php binary. If not supplied, the default php path will be used.

options.debug

Type: Boolean Default: false

Enable debug mode (enables --debug switch as well).

options.clear

Type: Boolean Default: false

Clear console before executing command.

options.dryRun

Type: Boolean Default: false

Simulates script execution. Doesn't actually execute tests, just echoes command that would be executed.

options.notify

Type: Boolean Default: true

Conditionally display notification (both console and growl where applicable).

options.statusLine

Type: Boolean Default: true

Displays status lines as follows:

  • green for passing files
  • red for failing files
  • yellow for an execution which has debug property enabled (will also display red and green statuses)

skipPassedFiles

Type: Boolean Default: false

Suppress reporting files which don't have syntax errors (files that passed linting).

Credits

gulp-phplint written by Mike Erickson

E-Mail: [email protected]

Twitter: @codedungeon

Website: codedungeon.org

Inspired By: jamarzka/gulp-phplint

gulp-phplint's People

Contributors

benmcp avatar dargmuesli avatar joeycozza avatar kmck avatar loremipson avatar mfour-merickson avatar mikeerickson avatar plivius avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

gulp-phplint's Issues

Update Dependencies

Hey, installing gulp-phplint currently gives the following errors warnings:

warning gulp-phplint > gulp-messenger > gulp > vinyl-fs > [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
warning gulp-phplint > gulp-messenger > gulp > vinyl-fs > glob-stream > [email protected]: Please update to minimatch 3.0.2 orhigher to avoid a RegExp DoS issue
warning gulp-phplint > gulp-messenger > gulp > vinyl-fs > glob-stream > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp-phplint > gulp-notify > [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning gulp-phplint > gulp-messenger > gulp > [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning gulp-phplint > gulp-messenger > [email protected]: This package is deprecated. Use Array.isArray.
warning gulp-phplint > gulp-messenger > gulp > vinyl-fs > glob-watcher > gaze > globule > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp-phplint > gulp-messenger > gulp > vinyl-fs > glob-watcher > gaze > globule > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp-phplint > gulp-messenger > gulp > vinyl-fs > glob-watcher > gaze > globule > glob > [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js

Seems like the dependencies need some updates!

Custom reporters can't catch stdout errors

Hi there! Thanks for making this plugin. I was playing around with it and noticed that stdout errors (eg. parse error) don't make it through to custom reporters.

In particular, this regex should probably fall back to stdout when stderr is empty (the built-in line-by-line logging is already doing this) as well as be loosened to allow an arbitrary amount of whitespace instead of exactly two spaces. after the colon.

Not sure how actively you're developing this, but I can make a PR if you want.

Replace deprecated dependency gulp-util

Replace deprecated dependency gulp-util

gulp-util has been deprecated recently. Continuing to use this dependency may prevent the use of your library with the latest release of Gulp 4 so it is important to replace gulp-util.

The README.md lists alternatives for all the components so a simple replacement should be enough.

Your package is popular but still relying on gulp-util, it would be good to publish a fixed version to npm as soon as possible.

See:

Create Enhanced Reporter

Create an enhanced reporter which includes better colorization and clarification when in a long gulp output stream.

โ–ˆ
[07:49:57] Plumber found unhandled error:
 Error: Command failed: /bin/sh -c ./bin/phpunit --colors=always -c src/Ambry/QueryToolBundle/phpunit-dev.xml ./src/Ambry/QueryToolBundle/Tests/Tickets/T1000
PHP Parse error:  syntax error, unexpected '}' in /var/www/query_tool/src/Ambry/QueryToolBundle/Tests/Tickets/T1000/TicketTest.php on line 59
PHP Stack trace:
PHP   1. {main}() /var/www/query_tool/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /var/www/query_tool/vendor/phpunit/phpunit/phpunit:36
PHP   3. PHPUnit_TextUI_Command->run() /var/www/query_tool/vendor/phpunit/phpunit/src/TextUI/Command.php:105
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() /var/www/query_tool/vendor/phpunit/phpunit/src/TextUI/Command.php:127
PHP   5. PHPUnit_Framework_TestSuite->addTestFiles() /var/www/query_tool/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:63
PHP   6. PHPUnit_Framework_TestSuite->addTestFile() /var/www/query_tool/vendor/phpunit/phpunit/src/Framework/TestSuite.php:405
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() /var/www/query_tool/vendor/phpunit/phpunit/src/Framework/TestSuite.php:333
PHP   8. PHPUnit_Util_Fileloader::load() /var/www/query_tool/vendor/phpunit/phpunit/src/Util/Fileloader.php:42

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.