grunt-clang-format
Advanced tools
Comparing version 0.4.0 to 1.0.0
@@ -13,56 +13,9 @@ /* | ||
var source = [ 'Gruntfile.js', 'tasks/*.js', 'test/*_test.js' ]; | ||
// Project configuration. | ||
grunt.initConfig({ | ||
jshint: { | ||
all: [ | ||
'Gruntfile.js', | ||
'tasks/*.js', | ||
'<%= nodeunit.tests %>' | ||
], | ||
options: { | ||
jshintrc: '.jshintrc' | ||
} | ||
}, | ||
jscs: { | ||
options: { | ||
config: '.jscsrc', | ||
reporter: 'inline' | ||
}, | ||
src: [ | ||
'Gruntfile.js', | ||
'tasks/*.js', | ||
'<%= nodeunit.tests %>' | ||
] | ||
}, | ||
// Before generating any new files, remove any previously-created files. | ||
clean: { | ||
tests: ['tmp'] | ||
}, | ||
// Configuration to be run (and then tested). | ||
clangFormat: { | ||
defaultOptions: { | ||
options: { | ||
}, | ||
files: { | ||
'tmp/default_options': ['test/fixtures/testing', 'test/fixtures/123'] | ||
} | ||
}, | ||
customOptions: { | ||
options: { | ||
separator: ': ', | ||
punctuation: ' !!!' | ||
}, | ||
files: { | ||
'tmp/custom_options': ['test/fixtures/testing', 'test/fixtures/123'] | ||
} | ||
} | ||
}, | ||
// Unit tests. | ||
nodeunit: { | ||
tests: ['test/*_test.js'] | ||
appcJs: { | ||
src: source | ||
} | ||
}); | ||
@@ -74,14 +27,6 @@ | ||
// These plugins provide necessary tasks. | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-jscs'); | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-nodeunit'); | ||
// Whenever the "test" task is run, first clean the "tmp" dir, then run this | ||
// plugin's task(s), then test the result. | ||
grunt.registerTask('test', ['clean', 'clangFormat']); | ||
grunt.loadNpmTasks('grunt-appc-js'); | ||
// By default, lint and run all tests. | ||
grunt.registerTask('default', ['jshint', 'jscs', 'test']); | ||
grunt.registerTask('default', [ 'appcJs' ]); | ||
}; |
{ | ||
"name": "grunt-clang-format", | ||
"description": "Format your objective-c code using the clang-format tool", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/ingo/grunt-clang-format", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/appcelerator/grunt-clang-format", | ||
"author": { | ||
@@ -12,6 +12,6 @@ "name": "Ingo Muschenetz", | ||
"type": "git", | ||
"url": "git://github.com/ingo/grunt-clang-format.git" | ||
"url": "git://github.com/appcelerator/grunt-clang-format.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ingo/grunt-clang-format/issues" | ||
"url": "https://github.com/appcelerator/grunt-clang-format/issues" | ||
}, | ||
@@ -21,7 +21,7 @@ "licenses": [ | ||
"type": "MIT", | ||
"url": "https://github.com/ingo/grunt-clang-format/blob/master/LICENSE-MIT" | ||
"url": "https://github.com/appcelerator/grunt-clang-format/blob/master/LICENSE-MIT" | ||
} | ||
], | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 4.0.0" | ||
}, | ||
@@ -32,14 +32,12 @@ "scripts": { | ||
"dependencies": { | ||
"packpath": "^0.1.0" | ||
"async": "^2.5.0", | ||
"clang-format": "1.0.53" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-jscs": "^3.0.1", | ||
"jscs-jsdoc": "^2.0.0", | ||
"grunt-contrib-clean": "^1.1.0", | ||
"grunt-contrib-nodeunit": "^1.0.0", | ||
"grunt": "~1.0.1" | ||
"grunt": "^1.0.1", | ||
"grunt-appc-js": "^2.0.1", | ||
"grunt-cli": "^1.2.0" | ||
}, | ||
"peerDependencies": { | ||
"grunt": "~1.0.1" | ||
"grunt": "*" | ||
}, | ||
@@ -46,0 +44,0 @@ "keywords": [ |
@@ -11,5 +11,5 @@ /* | ||
var exec = require('child_process').exec, | ||
format = require('util').format, | ||
packpath = require('packpath'); | ||
const async = require('async'), | ||
clangFormat = require('clang-format'), | ||
EXEC_LIMIT = 10; | ||
@@ -22,17 +22,9 @@ module.exports = function (grunt) { | ||
grunt.registerMultiTask('clangFormat', 'Format your objective-c code using the clang-format tool', function () { | ||
var done = this.async(), | ||
src = []; | ||
var done = this.async(); | ||
// Merge task-specific and/or target-specific options with these defaults. | ||
var options = this.options({ | ||
punctuation: '.', | ||
separator: ', ' | ||
}); | ||
// Iterate over all specified file groups. | ||
this.files.forEach(function (f) { | ||
// Concat specified files. | ||
var src = f.src.filter(function (filepath) { | ||
src = src.concat(f.src.filter(function (filepath) { | ||
// Warn on and remove invalid source files (if nonull was set). | ||
@@ -45,25 +37,19 @@ if (!grunt.file.exists(filepath)) { | ||
} | ||
}).map(function (filepath, i, arr) { | ||
var cmd = format('%s/bin/clang-format -i %s', packpath.self(), filepath); | ||
grunt.log.debug(cmd); | ||
exec(cmd, function (err, stdout, stderr) { | ||
if (err) { grunt.fail.fatal(err); } | ||
// Print a success message. | ||
grunt.log.ok('Formatted "' + filepath + '"'); | ||
if (i === arr.length + 1) { | ||
done(); | ||
} | ||
}); | ||
}); | ||
})); | ||
}); | ||
// Format the files in parallel, but limit number of simultaneous execs or we'll fail | ||
async.mapLimit(src, EXEC_LIMIT, function (filepath, cb) { | ||
grunt.log.debug(filepath); | ||
clangFormat.spawnClangFormat([ '-i', filepath ], function (exit) { | ||
if (exit) { | ||
grunt.fail.fatal('Failed to format "' + filepath + '"'); | ||
cb(exit); | ||
} | ||
// Print a success message. | ||
grunt.log.ok('Formatted "' + filepath + '"'); | ||
cb(); | ||
}, [ 'ignore', 'pipe', process.stderr ]); | ||
}, done); | ||
}); | ||
}; |
'use strict'; | ||
var grunt = require('grunt'); | ||
/* | ||
@@ -26,6 +24,6 @@ ======== A Handy Little Nodeunit Reference ======== | ||
exports.clangFormat = { | ||
/** | ||
* Set up tests | ||
* @param {Function} done - done function | ||
*/ | ||
/** | ||
* Set up tests | ||
* @param {Function} done - done function | ||
*/ | ||
setUp: function (done) { | ||
@@ -32,0 +30,0 @@ // setup here if necessary |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3
15
0
0
6676
3
97
+ Addedasync@^2.5.0
+ Addedclang-format@1.0.53
+ Addedansi-styles@4.3.0(transitive)
+ Addedarray-each@1.0.1(transitive)
+ Addedarray-slice@1.1.0(transitive)
+ Addedasync@2.6.43.2.6(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedclang-format@1.0.53(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddateformat@4.6.3(transitive)
+ Addeddetect-file@1.0.0(transitive)
+ Addedexpand-tilde@2.0.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfindup-sync@4.0.05.0.0(transitive)
+ Addedfined@1.2.0(transitive)
+ Addedflagged-respawn@1.0.1(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfor-own@1.0.0(transitive)
+ Addedgetobject@1.0.2(transitive)
+ Addedglob@7.1.7(transitive)
+ Addedglobal-modules@1.0.0(transitive)
+ Addedglobal-prefix@1.0.2(transitive)
+ Addedgrunt@1.6.1(transitive)
+ Addedgrunt-cli@1.4.3(transitive)
+ Addedgrunt-known-options@2.0.0(transitive)
+ Addedgrunt-legacy-log@3.0.0(transitive)
+ Addedgrunt-legacy-log-utils@2.1.0(transitive)
+ Addedgrunt-legacy-util@2.0.1(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedhomedir-polyfill@1.0.3(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedini@1.3.8(transitive)
+ Addedinterpret@1.1.0(transitive)
+ Addedis-absolute@1.0.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedis-relative@1.0.0(transitive)
+ Addedis-unc-path@1.0.0(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedisobject@3.0.1(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedliftup@3.0.1(transitive)
+ Addedmake-iterator@1.0.1(transitive)
+ Addedmap-cache@0.2.2(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addednopt@4.0.3(transitive)
+ Addedobject.defaults@1.1.0(transitive)
+ Addedobject.map@1.0.1(transitive)
+ Addedobject.pick@1.3.0(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedosenv@0.1.5(transitive)
+ Addedparse-filepath@1.0.2(transitive)
+ Addedparse-passwd@1.0.0(transitive)
+ Addedpath-root@0.1.1(transitive)
+ Addedpath-root-regex@0.1.2(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedrechoir@0.7.1(transitive)
+ Addedresolve-dir@1.0.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedunc-path-regex@0.1.2(transitive)
+ Addedv8flags@3.2.0(transitive)
+ Addedwhich@2.0.2(transitive)
- Removedpackpath@^0.1.0
- Removedansi-styles@3.2.1(transitive)
- Removedarray-find-index@1.0.2(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedcamelcase-keys@2.1.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcoffeescript@1.10.0(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcurrently-unhandled@0.4.1(transitive)
- Removeddateformat@1.0.12(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfindup-sync@0.3.0(transitive)
- Removedget-stdin@4.0.1(transitive)
- Removedgetobject@0.1.0(transitive)
- Removedglob@5.0.157.0.6(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedgrunt@1.0.4(transitive)
- Removedgrunt-cli@1.2.0(transitive)
- Removedgrunt-known-options@1.1.1(transitive)
- Removedgrunt-legacy-log@2.0.0(transitive)
- Removedgrunt-legacy-log-utils@2.0.1(transitive)
- Removedgrunt-legacy-util@1.1.1(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedindent-string@2.1.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedjs-yaml@3.13.1(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedloud-rejection@1.6.0(transitive)
- Removedmap-obj@1.0.1(transitive)
- Removedmeow@3.7.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpackpath@0.1.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedredent@1.0.0(transitive)
- Removedrepeating@2.0.1(transitive)
- Removedresolve@1.1.7(transitive)
- Removedrimraf@2.6.3(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedstrip-indent@1.0.1(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtrim-newlines@1.0.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)