New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

phplint

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phplint - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

cache.js

39

index.js

@@ -5,31 +5,9 @@ 'use strict';

var q = require('q');
var fs = require('fs');
var glob = require('glob');
var shell = require('shelljs/global');
var async = require('async');
var cacheSwap = require('cache-swap');
var crypto = require('crypto');
var cache = require('./cache');
var SWAP_CATEGORY = 'linted';
var swap = new cacheSwap({
tmpDir: require('os').tmpDir(),
cacheDirName: 'node-phplint'
});
var checkCached = function(filePath, cb) {
fs.readFile(filePath, function(err, contents) {
if (err) return cb(err);
var sha1 = crypto.createHash('sha1'),
fileHash = sha1.update(contents.toString()).digest('hex');
swap.hasCached(SWAP_CATEGORY, fileHash, function(isCached, cachedPath) {
cb(null, isCached, fileHash);
});
});
};
var linter = function (file, cb) {
checkCached(file, function(err, isCached, hash) {
cache.has(file, function(err, isCached, hash) {
if (err) return cb(err);

@@ -44,6 +22,3 @@

swap.addCached(SWAP_CATEGORY, hash, '', function (err) {
if (err) return cb(err);
cb();
});
cache.put(hash, cb);
});

@@ -79,7 +54,11 @@ });

module.exports = function (patterns) {
module.exports = function (patterns, options) {
var deferred = q.defer();
var result = processPatterns(patterns);
async.eachLimit(result, 10, linter, function (err) {
options = options || {};
var limit = options.limit ? options.limit : 10;
async.eachLimit(result, limit, linter, function (err) {
if (err) return deferred.reject(new Error(err.trim()));

@@ -86,0 +65,0 @@

{
"name": "phplint",
"version": "0.0.8",
"version": "0.0.9",
"description": "wrapper for php -l",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -44,4 +44,18 @@ # phplint

## Options
### limit
Sets the process spawn limit, defaults to 10.
```js
var phplint = require('phplint');
phplint('src/*.php', {
limit: 2
});
```
## License
[MIT](http://opensource.org/licenses/MIT) © [Wayne Ashley Berry](https://twitter.com/waynethebrain)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc