GithubHelp home page GithubHelp logo

wayneashleyberry / phplint Goto Github PK

View Code? Open in Web Editor NEW
63.0 63.0 14.0 279 KB

Lightning fast concurrent PHP linter for Node.js, Grunt & Gulp! ⚡️

License: MIT License

JavaScript 99.28% PHP 0.72%
grunt gulp linter node php

phplint's Issues

HHVM support

Hi there,
I replaced the phpCmd with hhvm and the script fails when "spawing" the process because of the -v switch.

I tried passing hhvm --php so the -v option would be supported but without success.

I think that, instead of passing -v, we should use the --version switch or make it configurable somehow.

Thank you,

config json to set options

Other linters (like tslint) have the option to create a .json to define what the code checker should check for (eol, whitespaces, class constructors, etc.). I cannot see this here. Is that possible, or planned?

How to suppress "No syntax errors detected" messages?

When I run my gulp commands that include the phpLint job, when all my PHP is correct, I get the following output, one per file:

No syntax errors detected in src/server/sessionEnd.php

Is there a way to suppress this? Ideally, I would like to see output only when there is a syntax error.

The code I am using:

gulp.task('lint:php', lintPHP);

function lintPHP(callback) {
  return phplint(['src/**/*.php'],
                 {limit: 10, stdout: true, stderr: true},
                 function(err, stdout, stderr) {
    if(err) {
      process.exit(1);
    } else {
      callback();
    }
  });
}

You can see that this is basically a cut/paste from the gulp example on the README along with some of the options as seen in the Grunt example. I have also removed the callback(err) call since it was just printing a useless stack-trace (below). I was trying to play around with the options and calls but couldn't get quite what I was looking for.

# This is the second part of the output if I include the callback(err) call 
# before the process.exit(1) as in the original example

[10:16:18] 'lint:php' errored after 474 ms
[10:16:18] Error: Command failed: /bin/sh -c php -l src/server/leaderboardRequest.php

    at ChildProcess.exithandler (child_process.js:751:12)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Socket.<anonymous> (child_process.js:1183:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:485:12)

Using phplint with gulp.src and pipe

Is it possible to use phplint with gulp.src and pipe?

For example, I would like to do something along the lines of:

gulp.task('php', php);

function php(callback) {
  return gulp.src(['src/**/*.php'])
      .pipe(phpStuff1)
      .pipe(phpStuff2)
      .pipe(phplint({limit: 10}))
      .pipe(phpStuff3)
      .pipe(gulp.dest('dist'));
};

Showing the line number of the error?

Adding -d display_errors=1 to the command line argument usually does it but I don't find a way to do it using this wrapper.

Any tips how to do it? Thanks.

Cannot exclude files using grunt

I'm in a situation where I need to explicitly exclude some files that fail verification because I won't fix these anytime soon. I expected that I would be able to do something like:

['files/**/*', 'files/my_file_to_exclude.php']

But with grunt this definition doesn't work. It seems that, contrary to the CLI and gulp, you don't leverage globby before you call iterate.

os.tmpDir deprecated warning

More of a note to myself to fix this:

DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

Its common in a lot of older programs will try and PR this soon.

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.