Skip to content

Commit 364e7d4

Browse files
committed
Other: Exclude dist/ from codeclimate checks
1 parent 2130bc9 commit 364e7d4

File tree

13 files changed

+40
-15
lines changed

13 files changed

+40
-15
lines changed

.codeclimate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
engines:
23
eslint:
34
enabled: true
@@ -13,6 +14,8 @@ ratings:
1314
- "lib/path/**.js"
1415
- "lib/pool/**.js"
1516
- "lib/utf8/**.js"
17+
- "**.md"
1618
exclude_paths:
19+
- "dist/**"
1720
- "**/tests/**"
1821
- "cli/wrappers/**"

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
bench/*
21
bin/*
32
cli/wrappers/*
43
coverage/*
@@ -12,5 +11,4 @@ lib/tape-adapter.js
1211
lib/tsd-jsdoc/*
1312
lib/*/tests/*
1413
sandbox/*
15-
scripts/*
1614
tests/*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ protobuf.load("awesome.proto", function(err, root) {
137137

138138
* `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.
139139
* `Message.verify` can be used to explicitly perform verification prior to encoding where necessary. Instead of throwing, it returns the error message, if any.
140-
* `Message.decode` throws if a buffer is invalid or missing required fields and doesn't require calling `Message.verify` afterwards.
140+
* `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.
141141

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

cli/pbjs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ exports.main = function main(args, callback) {
108108
" --no-beautify Does not beautify generated code.",
109109
" --no-comments Does not output any JSDoc comments.",
110110
"",
111-
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or) ") + "other | " + chalk.bold.green("pbjs") + " [options] -"
111+
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or) ") + "other | " + chalk.bold.green("pbjs") + " [options] -",
112+
""
112113
].join("\n"));
113114
return 1;
114115
}

cli/pbts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ exports.main = function(args, callback) {
5757
"",
5858
" -m, --main Whether building the main library without any imports.",
5959
"",
60-
"usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." + chalk.bold.gray(" (or) ") + "other | " + chalk.bold.green("pbts") + " [options] -"
60+
"usage: " + chalk.bold.green("pbts") + " [options] file1.js file2.js ..." + chalk.bold.gray(" (or) ") + "other | " + chalk.bold.green("pbts") + " [options] -",
61+
""
6162
].join("\n"));
6263
return 1;
6364
}

cli/targets/proto.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ function push(line) {
6868

6969
function escape(str) {
7070
return str.replace(/[\\"']/g, "\\$&")
71+
.replace(/\r/g, "\\r")
72+
.replace(/\n/g, "\\n")
7173
.replace(/\u0000/g, "\\0");
7274
}
7375

@@ -150,13 +152,17 @@ function buildEnum(enm) {
150152

151153
function buildRanges(keyword, ranges) {
152154
if (ranges && ranges.length) {
153-
push("");
155+
var parts = [];
154156
ranges.forEach(function(range) {
155-
if (range[0] === range[1])
156-
push(keyword + " " + range[0] + ";");
157+
if (typeof range === "string")
158+
parts.push("\"" + escape(range) + "\"");
159+
else if (range[0] === range[1])
160+
parts.push(range[0]);
157161
else
158-
push(keyword + " " + range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]) + ";");
162+
parts.push(range[0] + " to " + (range[1] === 0x1FFFFFFF ? "max" : range[1]));
159163
});
164+
push("");
165+
push(keyword + " " + parts.join(", "));
160166
}
161167
}
162168

@@ -178,7 +184,7 @@ function buildType(type) {
178184
}
179185

180186
function buildField(field, passExtend) {
181-
if (field.partOf || field.declaringField || !(field.extend === undefined || passExtend))
187+
if (field.partOf || field.declaringField || field.extend !== undefined && !passExtend)
182188
return;
183189
if (first) {
184190
first = false;

cli/targets/static.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var out = [];
1818
var indent = 0;
1919
var config = {};
2020

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

2323
function static_target(root, options, callback) {
2424
config = options;

scripts/bundle.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
"use strict";
12
module.exports = bundle;
2-
var fs = require("fs");
3+
4+
var fs = require("fs"),
5+
path = require("path");
36

47
var browserify = require("browserify");
58

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

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

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

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

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

@@ -35,6 +40,7 @@ var prelude = fs.readFileSync(require.resolve("../lib/prelude.js")).toString("ut
3540
* @param {string} options.target Target directory
3641
* @param {boolean} [options.compress=false] Whether to minify or not
3742
* @param {string[]} [options.exclude] Excluded source files
43+
* @returns {undefined}
3844
*/
3945
function bundle(options) {
4046
if (!options || !options.entry || !options.target)
@@ -93,6 +99,7 @@ function bundle(options) {
9399
* @param {string} sourceFile Source file
94100
* @param {string} destinationFile Destination file
95101
* @param {function(?Error)} callback Node-style callback
102+
* @returns {undefined}
96103
*/
97104
bundle.compress = function compress(sourceFile, destinationFile, callback) {
98105
var src = fs.createReadStream(sourceFile);

scripts/changelog.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
var path = require("path"),
24
fs = require("fs");
35

@@ -76,7 +78,7 @@ gitSemverTags(function(err, tags) {
7678
hash = match[1];
7779
}
7880
message.split(";").forEach(function(message) {
79-
if (/^(Merge pull request |Post\-merge)/.test(message))
81+
if (/^(Merge pull request |Post-merge)/.test(message))
8082
return;
8183
var match = /^(\w+):/i.exec(message = message.trim());
8284
var category;

scripts/gentests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var fs = require("fs"),
3131
} catch (err2) {
3232
process.stderr.write("ERROR: " + err2.message + "\n");
3333
}
34-
})
34+
});
3535
});
3636

3737
[

0 commit comments

Comments
 (0)