Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
gulp-phpcs
Advanced tools
Gulp plugin for running PHP Code Sniffer.
Choose correct version of gulp-phpcs. One should use gulp-phpcs@1.x
for PHPCS 2.x and gulp-phpcs@2.x
with PHPCS 3.x.
Install the plugin with the following command:
npm install gulp-phpcs --save-dev
var gulp = require('gulp');
var phpcs = require('gulp-phpcs');
gulp.task('default', function () {
return gulp.src(['src/**/*.php', '!src/vendor/**/*.*'])
// Validate files using PHP Code Sniffer
.pipe(phpcs({
bin: 'src/vendor/bin/phpcs',
standard: 'PSR2',
warningSeverity: 0
}))
// Log all problems that was found
.pipe(phpcs.reporter('log'));
});
Type: String
Default: 'phpcs'
PHP Code Sniffer executable.
Type: Integer
The minimum severity required to display an error or warning.
This option is equivalent to Code Sniffer --severity=<severity>
option.
Type: Integer
The minimum severity required to display an error or warning.
This option is equivalent to Code Sniffer --warning-severity=<severity>
option.
Type: Integer
The minimum severity required to display an error or warning.
This option is equivalent to Code Sniffer --error-severity=<severity>
option.
Type: String
The name or path of the coding standard to use. One can use this option to specify custom phpcs.xml
file.
This option is equivalent to Code Sniffer --standard="<standard>"
option.
Type: String
The encoding of the files being checked.
This option is equivalent to Code Sniffer --encoding="<encoding>"
option.
Type: String
The report type to generate.
This option is equivalent to Code Sniffer --report="<report>"
option.
Type: Boolean
Display sniff codes in the report.
This option is equivalent to Code Sniffer -s
option.
Type: Array
Filter for executed Sniffs
This option is equivalent to Code Sniffer --sniffs
option.
Type: Array
Exclude some sniffs from ruleset.
This option is equivalent to Code Sniffer --exclude
option.
Type: Array
Ignore a list of paths
This option is equivalent to Code Sniffer --ignore
option.
Type: String
Set an explicit current working directory from which the phpcs
command should run.
Type: Boolean
Pass colorized output of Code Sniffer to reporters.
This option is equivalent to Code Sniffer --colors
option.
Warning: This options is only compatible with 2.x branch of Code Sniffer.
Loads one of the reporters that shipped with the plugin (see below).
Type: String
The name of the reporter that should be loaded.
Type: Object
Options for the reporter if needed.
The plugin only pass files through PHP Code Sniffer. To process the results of the check one should use a reporter. Reporters are plugins too, so one can pipe a files stream to them. Several repotrers can be used on a stream, just like any other plugins.
These reporters are shipped with the plugin:
Fail reporter - fails if a problem was found. Use
phpcs.reporter('fail', {failOnFirst: true})
to load it. failOnFirst
option
is used to choose when the reporter should fail on the first errored file or at
the end of the file stream. This option can be omitted (true
is used by
default).
Log reporter - outputs all problems to the console. Use
phpcs.reporter('log')
to load it.
File reporter - outputs all problems to a file. Use
phpcs.reporter('file', { path: "path/to/report.txt" })
to load it.
MIT © Dmitriy Simushev
3.1.0
fancy-log
and plugin-error
dependencies from devDependency to dependency section.FAQs
PHP Code Sniffer plugin for Gulp
We found that gulp-phpcs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.