wayneashleyberry / phplint Goto Github PK
View Code? Open in Web Editor NEWLightning fast concurrent PHP linter for Node.js, Grunt & Gulp! ⚡️
License: MIT License
Lightning fast concurrent PHP linter for Node.js, Grunt & Gulp! ⚡️
License: MIT License
I want phplint warnning me when that happen,what should I do?
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,
Bump
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?
It works with gulp
but grunt will simply ignore the phpCmd
option.
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)
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'));
};
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.
It might be night to only display something when there was an error.
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
.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.