Skip to content

Commit

Permalink
jscs now a part of testing (run npm install)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Jan 2, 2016
1 parent 8ce4e63 commit 96cfd00
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 24 deletions.
56 changes: 56 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowEmptyBlocks": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeBinaryOperators": [
","
],
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowYodaConditions": true,
"disallowKeywords": [ "with" ],
"disallowMultipleLineBreaks": true,
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireBlocksOnNewline": 1,
"requireCommaBeforeLineBreak": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,
"requireLineFeedAtFileEnd": true,
"requireCapitalizedConstructors": true,
"requireCurlyBraces": [
"do"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"case",
"return",
"try",
"catch",
"typeof"
],
"safeContextKeyword": ["self", "_handlerInstance"],
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"validateIndentation": 2
}
60 changes: 36 additions & 24 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
*
* Copyright (c) 2011-2016, Anders Evenrud <[email protected]>
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Expand Down Expand Up @@ -40,14 +40,27 @@

try {
require('time-grunt')(grunt);
} catch ( e ) { }
} catch (e) { }

grunt.file.defaultEncoding = 'utf-8';

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
//grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jscs');

var sourceFiles = [
'Gruntfile.js',
'src/*.js',
'src/client/javascript/*.js',
'src/client/javascript/**/*.js',
'src/packages/default/**/*.js',
'!src/packages/default/Broadway/**',
'!src/packages/default/**/locales.js',
'!src/packages/default/**/locale.js',
'!src/packages/default/Calculator/main.js'
];

grunt.initConfig({
jshint: {
Expand Down Expand Up @@ -81,22 +94,12 @@
node: true,
maxerr: 9999
},
all: [
'Gruntfile.js',
'src/*.js',
'src/client/javascript/*.js',
'src/client/javascript/**/*.js',
'src/packages/default/**/*.js',
'!src/packages/default/Broadway/**',
'!src/packages/default/**/locales.js',
'!src/packages/default/**/locale.js',
'!src/packages/default/Calculator/main.js'
]
all: sourceFiles
},
mochaTest: {
test: {
src: ['test/server/*.js']
},
}
},
watch: {
core: {
Expand Down Expand Up @@ -135,6 +138,15 @@
],
tasks: ['config', 'manifest']
}
},
jscs: {
src: sourceFiles,
options: {
config: '.jscsrc',
verbose: true,
fix: false,
requireCurlyBraces: ['if']
}
}
});

Expand All @@ -148,21 +160,21 @@
* Task: Build config
*/
grunt.registerTask('config', 'Build config files (or modify `set:path.to.key:value`, `get:path.to.key`, `preload:name:path:type`)', function(fn, key, value, arg) {
if ( fn ) {
if (fn) {
var result;
if ( fn === 'get' ) {
if (fn === 'get') {
grunt.log.writeln('Path: ' + key);

result = _build.getConfigPath(grunt, key);
grunt.log.writeln('Type: ' + typeof result);
console.log(result);
console.log();
} else if ( fn === 'set' ) {
} else if (fn === 'set') {
grunt.log.writeln('Path: ' + key);

result = _build.setConfigPath(grunt, key, value);
console.log(result);
} else if ( fn === 'preload' ) {
} else if (fn === 'preload') {
result = _build.addPreload(grunt, key, value, arg);
console.log(result);
} else {
Expand Down Expand Up @@ -295,7 +307,7 @@
grunt.registerTask('default', ['all']);
grunt.registerTask('dist', ['config', 'dist-index', 'core', 'themes', 'packages', 'manifest']);
grunt.registerTask('dist-dev', ['config', 'dist-dev-index', 'themes:fonts', 'themes:styles', 'manifest']);
grunt.registerTask('test', ['jshint', 'mochaTest'/*, 'mocha'*/]);
grunt.registerTask('test', ['jshint', 'jscs', 'mochaTest'/*, 'mocha'*/]);
};

})(require('node-fs-extra'), require('path'), require('./src/build.js'), require('grunt'), require('less'));
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"grunt-mocha-test": ">=0.12.7",
"grunt-contrib-watch": ">=0.6.1",
"grunt-contrib-jshint": ">=0.11.3",
"grunt-jscs": ">=2.5.0",
"time-grunt": ">=1.2.1",
"clean-css": ">=3.4.5",
"uglify-js": ">=2.4.24",
Expand Down

0 comments on commit 96cfd00

Please sign in to comment.