Skip to content

Commit

Permalink
Other: Exclude dist/ from codeclimate checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Mar 7, 2017
1 parent 2130bc9 commit 364e7d4
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
engines:
eslint:
enabled: true
Expand All @@ -13,6 +14,8 @@ ratings:
- "lib/path/**.js"
- "lib/pool/**.js"
- "lib/utf8/**.js"
- "**.md"
exclude_paths:
- "dist/**"
- "**/tests/**"
- "cli/wrappers/**"
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bench/*
bin/*
cli/wrappers/*
coverage/*
Expand All @@ -12,5 +11,4 @@ lib/tape-adapter.js
lib/tsd-jsdoc/*
lib/*/tests/*
sandbox/*
scripts/*
tests/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protobuf.load("awesome.proto", function(err, root) {

* `Message.encode` does not implicitly verify a message but tries to encode whatever is specified, possibly resulting in a runtime error being thrown somewhere down the road.
* `Message.verify` can be used to explicitly perform verification prior to encoding where necessary. Instead of throwing, it returns the error message, if any.
* `Message.decode` throws if a buffer is invalid or missing required fields and doesn't require calling `Message.verify` afterwards.
* `Message.decode` throws if a buffer is invalid or missing required fields (a `protobuf.util.ProtocolError` with an `instance` property set to the so far decoded message in the latter case) and doesn't require calling `Message.verify` afterwards.

Additionally, promise syntax can be used by omitting the callback, if preferred:

Expand Down
3 changes: 2 additions & 1 deletion cli/pbjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ exports.main = function main(args, callback) {
" --no-beautify Does not beautify generated code.",
" --no-comments Does not output any JSDoc comments.",
"",
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or) ") + "other | " + chalk.bold.green("pbjs") + " [options] -"
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or) ") + "other | " + chalk.bold.green("pbjs") + " [options] -",
""
].join("\n"));
return 1;
}
Expand Down
3 changes: 2 additions & 1 deletion cli/pbts.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ exports.main = function(args, callback) {
"",
" -m, --main Whether building the main library without any imports.",
"",
"usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." + chalk.bold.gray(" (or) ") + "other | " + chalk.bold.green("pbts") + " [options] -"
"usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." + chalk.bold.gray(" (or) ") + "other | " + chalk.bold.green("pbts") + " [options] -",
""
].join("\n"));
return 1;
}
Expand Down
16 changes: 11 additions & 5 deletions cli/targets/proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ function push(line) {

function escape(str) {
return str.replace(/[\\"']/g, "\\$&")
.replace(/\r/g, "\\r")
.replace(/\n/g, "\\n")
.replace(/\u0000/g, "\\0");
}

Expand Down Expand Up @@ -150,13 +152,17 @@ function buildEnum(enm) {

function buildRanges(keyword, ranges) {
if (ranges && ranges.length) {
push("");
var parts = [];
ranges.forEach(function(range) {
if (range[0] === range[1])
push(keyword + " " + range[0] + ";");
if (typeof range === "string")
parts.push("\"" + escape(range) + "\"");
else if (range[0] === range[1])
parts.push(range[0]);
else
push(keyword + " " + range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]) + ";");
parts.push(range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]));
});
push("");
push(keyword + " " + parts.join(", "));
}
}

Expand All @@ -178,7 +184,7 @@ function buildType(type) {
}

function buildField(field, passExtend) {
if (field.partOf || field.declaringField || !(field.extend === undefined || passExtend))
if (field.partOf || field.declaringField || field.extend !== undefined && !passExtend)
return;
if (first) {
first = false;
Expand Down
2 changes: 1 addition & 1 deletion cli/targets/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var out = [];
var indent = 0;
var config = {};

static_target.description = "Static code without reflection";
static_target.description = "Static code without reflection (non-functional on its own)";

function static_target(root, options, callback) {
config = options;
Expand Down
11 changes: 9 additions & 2 deletions scripts/bundle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"use strict";
module.exports = bundle;
var fs = require("fs");

var fs = require("fs"),
path = require("path");

var browserify = require("browserify");

Expand All @@ -15,8 +18,9 @@ var source = require("vinyl-source-stream");

var zopfli = require("node-zopfli");

var pkg = require(__dirname + "/../package.json");
var pkg = require(path.join(__dirname, "..", "package.json"));

/*eslint-disable no-template-curly-in-string*/
var license = [
"/*!",
" * protobuf.js v${version} (c) 2016, Daniel Wirtz",
Expand All @@ -25,6 +29,7 @@ var license = [
" * see: https://github.com/dcodeIO/protobuf.js for details",
" */"
].join("\n") + "\n";
/*eslint-enable no-template-curly-in-string*/

var prelude = fs.readFileSync(require.resolve("../lib/prelude.js")).toString("utf8");

Expand All @@ -35,6 +40,7 @@ var prelude = fs.readFileSync(require.resolve("../lib/prelude.js")).toString("ut
* @param {string} options.target Target directory
* @param {boolean} [options.compress=false] Whether to minify or not
* @param {string[]} [options.exclude] Excluded source files
* @returns {undefined}
*/
function bundle(options) {
if (!options || !options.entry || !options.target)
Expand Down Expand Up @@ -93,6 +99,7 @@ function bundle(options) {
* @param {string} sourceFile Source file
* @param {string} destinationFile Destination file
* @param {function(?Error)} callback Node-style callback
* @returns {undefined}
*/
bundle.compress = function compress(sourceFile, destinationFile, callback) {
var src = fs.createReadStream(sourceFile);
Expand Down
4 changes: 3 additions & 1 deletion scripts/changelog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var path = require("path"),
fs = require("fs");

Expand Down Expand Up @@ -76,7 +78,7 @@ gitSemverTags(function(err, tags) {
hash = match[1];
}
message.split(";").forEach(function(message) {
if (/^(Merge pull request |Post\-merge)/.test(message))
if (/^(Merge pull request |Post-merge)/.test(message))
return;
var match = /^(\w+):/i.exec(message = message.trim());
var category;
Expand Down
2 changes: 1 addition & 1 deletion scripts/gentests.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var fs = require("fs"),
} catch (err2) {
process.stderr.write("ERROR: " + err2.message + "\n");
}
})
});
});

[
Expand Down
3 changes: 3 additions & 0 deletions scripts/pages.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*eslint-disable no-console*/
"use strict";

var ghpages = require("gh-pages"),
path = require("path");

Expand Down
2 changes: 2 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var path = require("path"),
fs = require("fs"),
pkg = require(path.join(__dirname, "..", "package.json"));
Expand Down
2 changes: 2 additions & 0 deletions scripts/prepublish.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var path = require("path"),
fs = require("fs");

Expand Down

0 comments on commit 364e7d4

Please sign in to comment.