Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-clang-format

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-clang-format - npm Package Compare versions

Comparing version 0.4.0 to 1.0.0

.eslintignore

67

Gruntfile.js

@@ -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

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