chore: Enforce ban-untagged-todo lint rule (#9135)

This commit is contained in:
Bartek Iwańczuk 2021-01-17 00:32:59 +01:00 committed by GitHub
parent fc45a19801
commit b26dcbc69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 77 additions and 58 deletions

9
.dlint.json Normal file
View File

@ -0,0 +1,9 @@
{
"rules": {
"tags": ["recommended"],
"include": [
"ban-untagged-todo"
],
"exclude": []
}
}

View File

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// Used for benchmarking Deno's networking.
// TODO Replace this with a real HTTP server once
// TODO(bartlomieju): Replace this with a real HTTP server once
// https://github.com/denoland/deno/issues/726 is completed.
// Note: this is a keep-alive server.
const addr = Deno.args[0] || "127.0.0.1:4500";

View File

@ -128,8 +128,8 @@ unitTest(async function bufferBasicOperations(): Promise<void> {
await empty(buf, testString.slice(0, 20), new Uint8Array(5));
await empty(buf, "", new Uint8Array(100));
// TODO buf.writeByte()
// TODO buf.readByte()
// TODO(bartlomieju): buf.writeByte()
// TODO(bartlomieju): buf.readByte()
}
});

View File

@ -96,7 +96,7 @@ unitTest(
unitTest(
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
async function chownSyncSucceed(): Promise<void> {
// TODO: when a file's owner is actually being changed,
// TODO(bartlomieju): when a file's owner is actually being changed,
// chown only succeeds if run under priviledged user (root)
// The test script has no such privilege, so need to find a better way to test this case
const { uid, gid } = await getUidAndGid();
@ -152,7 +152,7 @@ unitTest(
unitTest(
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
async function chownWithUrl(): Promise<void> {
// TODO: same as chownSyncSucceed
// TODO(bartlomieju): same as chownSyncSucceed
const { uid, gid } = await getUidAndGid();
const enc = new TextEncoder();

View File

@ -322,7 +322,7 @@ unitTest(
// deno-lint-ignore no-explicit-any
await file.write(null as any);
},
); // TODO: Check error kind when dispatch_minimal pipes errors properly
); // TODO(bartlomieju): Check error kind when dispatch_minimal pipes errors properly
file.close();
await Deno.remove(tempDir, { recursive: true });
},
@ -349,7 +349,7 @@ unitTest(
// deno-lint-ignore no-explicit-any
await file.read(null as any);
}, TypeError);
// TODO: Check error kind when dispatch_minimal pipes errors properly
// TODO(bartlomieju): Check error kind when dispatch_minimal pipes errors properly
file.close();
await Deno.remove(tempDir, { recursive: true });
@ -382,7 +382,7 @@ unitTest(
assert(fileInfo.size === 5);
f.close();
// TODO: test different modes
// TODO(bartlomieju): test different modes
await Deno.remove(tempDir, { recursive: true });
},
);
@ -425,7 +425,7 @@ unitTest(
assert(fileInfo.size === 5);
f.close();
// TODO: test different modes
// TODO(bartlomieju): test different modes
await Deno.remove(tempDir, { recursive: true });
},
);

View File

@ -16,7 +16,7 @@
const headersData = Symbol("headers data");
// TODO: headerGuard? Investigate if it is needed
// TODO(bartlomieju): headerGuard? Investigate if it is needed
// node-fetch did not implement this but it is in the spec
function normalizeParams(name, value) {
name = String(name).toLowerCase();

View File

@ -283,7 +283,7 @@
}
function getStream(blobBytes) {
// TODO: Align to spec https://fetch.spec.whatwg.org/#concept-construct-readablestream
// TODO(bartlomieju): Align to spec https://fetch.spec.whatwg.org/#concept-construct-readablestream
return new ReadableStream({
type: "bytes",
start: (controller) => {
@ -1240,7 +1240,7 @@
let body;
let clientRid = null;
let redirected = false;
let remRedirectCount = 20; // TODO: use a better way to handle
let remRedirectCount = 20; // TODO(bartlomieju): use a better way to handle
if (typeof input === "string" || input instanceof URL) {
url = typeof input === "string" ? input : input.href;

View File

@ -668,7 +668,7 @@
setRelatedTarget(eventImpl, null);
}
// TODO: invoke activation targets if HTML nodes will be implemented
// TODO(bartlomieju): invoke activation targets if HTML nodes will be implemented
// if (activationTarget !== null) {
// if (!eventImpl.defaultPrevented) {
// activationTarget._activationBehavior();

View File

@ -61,7 +61,7 @@
if (!chunk.done && chunk.value instanceof Uint8Array) {
chunks.push(chunk.value);
// TODO: (only) If roughly 50ms have passed since last progress
// TODO(bartlomieju): (only) If roughly 50ms have passed since last progress
{
const size = chunks.reduce((p, i) => p + i.byteLength, 0);
const ev = new ProgressEvent("progress", {

View File

@ -199,8 +199,8 @@ finishing test case.`;
exposeForTest("reportToConsole", reportToConsole);
// TODO: already implements AsyncGenerator<RunTestsMessage>, but add as "implements to class"
// TODO: implements PromiseLike<RunTestsEndResult>
// TODO(bartlomieju): already implements AsyncGenerator<RunTestsMessage>, but add as "implements to class"
// TODO(bartlomieju): implements PromiseLike<RunTestsEndResult>
class TestRunner {
#usedOnly = false;

View File

@ -278,7 +278,7 @@ delete Object.prototype.__proto__;
self: util.readOnly(globalThis),
onmessage: util.writable(onmessage),
onerror: util.writable(onerror),
// TODO: should be readonly?
// TODO(bartlomieju): should be readonly?
close: util.nonEnumerable(workerClose),
postMessage: util.writable(postMessage),
workerMessageRecvCallback: util.nonEnumerable(workerMessageRecvCallback),

View File

@ -667,7 +667,7 @@ function readDoubleQuotedScalar(
if (isEOL(ch)) {
skipSeparationSpace(state, false, nodeIndent);
// TODO: rework to inline fn with no type cast?
// TODO(bartlomieju): rework to inline fn with no type cast?
} else if (ch < 256 && simpleEscapeCheck[ch]) {
state.result += simpleEscapeMap[ch];
state.position++;

View File

@ -464,7 +464,7 @@ class Parser {
for (let i = 0; i < this.tomlLines.length; i++) {
const line = this.tomlLines[i];
// TODO (zekth) Handle unflat of array of tables
// TODO(zekth): Handle unflat of array of tables
if (this._isGroup(line)) {
// if the current group is an array we push the
// parsed objects in it.

View File

@ -151,7 +151,8 @@ class Printf {
}
} // switch c
break;
case State.POSITIONAL: // either a verb or * only verb for now, TODO
case State.POSITIONAL:
// TODO(bartlomieju): either a verb or * only verb for now
if (c === "*") {
const worp = this.flags.precision === -1
? WorP.WIDTH
@ -689,7 +690,7 @@ class Printf {
if (i !== 0 && this.flags.space) {
hex += sharp ? " 0x" : " ";
}
// TODO: for now only taking into account the
// TODO(bartlomieju): for now only taking into account the
// lower half of the codePoint, ie. as if a string
// is a list of 8bit values instead of UCS2 runes
const c = (val.charCodeAt(i) & 0xff).toString(16);

View File

@ -266,17 +266,18 @@ const tests: Array<[string, any, string]> = [
["%3c", "⌘".charCodeAt(0), " ⌘"],
["%-3c", "⌘".charCodeAt(0), "⌘ "],
// Runes that are not printable.
// {"%c", '\U00000e00', "\u0e00"}, // TODO check if \U escape exists in js
// {"%c", '\U00000e00', "\u0e00"},
// TODO(bartlomieju) check if \U escape exists in js
//["%c", '\U0010ffff'.codePointAt(0), "\U0010ffff"],
// Runes that are not valid.
["%c", -1, "<22>"],
// TODO surrogate half, doesn't make sense in itself, how
// TODO(bartomieju): surrogate half, doesn't make sense in itself, how
// to determine in JS?
// ["%c", 0xDC80, "<22>"],
["%c", 0x110000, "<22>"],
["%c", 0xfffffffff, "<22>"],
// TODO
// TODO(bartlomieju):
// escaped characters
// Runes that are not printable.
// Runes that are not valid.
@ -291,7 +292,8 @@ const tests: Array<[string, any, string]> = [
["%.0s", "日本語日本語", ""],
["%.5s", "日本語日本語", "日本語日本"],
["%.10s", "日本語日本語", "日本語日本語"],
// ["%08q", "abc", `000"abc"`], // TODO verb q
// ["%08q", "abc", `000"abc"`],
// TODO(bartlomieju): verb q
// ["%-8q", "abc", `"abc" `],
//["%.5q", "abcdefghijklmnopqrstuvwxyz", `"abcde"`],
["%.5x", "abcdefghijklmnopqrstuvwxyz", "6162636465"],
@ -301,7 +303,8 @@ const tests: Array<[string, any, string]> = [
// our %x takes lower byte of string "%.1x", "日本語", "e6"],,
["%.1x", "日本語", "e5"],
//["%10.1q", "日本語日本語", ` "日"`],
// ["%10v", null, " <nil>"], // TODO null, undefined ...
// ["%10v", null, " <nil>"],
// TODO(bartlomieju): null, undefined ...
// ["%-10v", null, "<nil> "],
// integers
@ -353,8 +356,10 @@ const tests: Array<[string, any, string]> = [
["%-#20.8x", 0x1234abc, "0x01234abc "],
["%-#20.8X", 0x1234abc, "0X01234ABC "],
["%-#20.8o", parseInt("01234", 8), "00001234 "],
// Test correct f.intbuf overflow checks. // TODO, lazy
// unicode format // TODO, decide whether unicode verb makes sense %U
// Test correct f.intbuf overflow checks.
// TODO(bartlomieju): lazy
// unicode format
// TODO(bartlomieju): decide whether unicode verb makes sense %U
// floats
["%+.3e", 0.0, "+0.000e+00"],
@ -490,10 +495,11 @@ const tests: Array<[string, any, string]> = [
["%g", 1.23456789e-3, "0.00123457"], // see above prec6 = precdef6 - (-3+1)
//["%g", 1.23456789e20, "1.23456789e+20"],
["%g", 1.23456789e20, "1.23457e+20"],
// arrays // TODO
// arrays
// TODO(bartlomieju):
// slice : go specific
// TODO decide how to handle deeper types, arrays, objects
// TODO(bartlomieju): decide how to handle deeper types, arrays, objects
// byte arrays and slices with %b,%c,%d,%o,%U and %v
// f.space should and f.plus should not have an effect with %v.
// f.space and f.plus should have an effect with %d.

View File

@ -327,7 +327,7 @@ testCopySync(
assert(destStatInfo.atime instanceof Date);
assert(destStatInfo.mtime instanceof Date);
// TODO: Activate test when https://github.com/denoland/deno/issues/2411
// TODO(bartlomieju): Activate test when https://github.com/denoland/deno/issues/2411
// is fixed
// assertEquals(destStatInfo.atime, srcStatInfo.atime);
// assertEquals(destStatInfo.mtime, srcStatInfo.mtime);

View File

@ -32,7 +32,6 @@ interface SplitPath {
winRoot?: string;
}
// TODO: Maybe make this public somewhere.
function split(path: string): SplitPath {
const s = SEP_PATTERN.source;
const segments = path

View File

@ -65,7 +65,7 @@ export function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader {
}
const line = await tp.readLine();
if (line === null) throw new Deno.errors.UnexpectedEof();
// TODO: handle chunk extension
// TODO(bartlomieju): handle chunk extension
const [chunkSizeString] = line.split(";");
const chunkSize = parseInt(chunkSizeString, 16);
if (Number.isNaN(chunkSize) || chunkSize < 0) {

View File

@ -178,7 +178,7 @@ export function setCookie(res: { headers?: Headers }, cookie: Cookie): void {
if (!res.headers) {
res.headers = new Headers();
}
// TODO (zekth) : Add proper parsing of Set-Cookie headers
// TODO(zekth) : Add proper parsing of Set-Cookie headers
// Parsing cookie headers to make consistent set-cookie header
// ref: https://tools.ietf.org/html/rfc6265#section-4.1.1
const v = toString(cookie);

View File

@ -2,8 +2,8 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// This program serves files in the current directory over HTTP.
// TODO Stream responses instead of reading them into memory.
// TODO Add tests like these:
// TODO(bartlomieju): Stream responses instead of reading them into memory.
// TODO(bartlomieju): Add tests like these:
// https://github.com/indexzero/http-server/blob/master/test/http-server-test.js
import { extname, posix } from "../path/mod.ts";
@ -141,7 +141,7 @@ export async function serveFile(
};
}
// TODO: simplify this after deno.stat and deno.readDir are fixed
// TODO(bartlomieju): simplify this after deno.stat and deno.readDir are fixed
async function serveDir(
req: ServerRequest,
dirPath: string,

View File

@ -201,7 +201,7 @@ Deno.test("serveDirectory", async function (): Promise<void> {
assert(page.includes("README.md"));
// `Deno.FileInfo` is not completely compatible with Windows yet
// TODO: `mode` should work correctly in the future.
// TODO(bartlomieju): `mode` should work correctly in the future.
// Correct this test case accordingly.
Deno.build.os !== "windows" &&
assert(/<td class="mode">(\s)*\([a-zA-Z-]{10}\)(\s)*<\/td>/.test(page));

View File

@ -55,7 +55,7 @@ const readMakers: ReadMaker[] = [
fn: (r): iotest.OneByteReader => new iotest.OneByteReader(r),
},
{ name: "half", fn: (r): iotest.HalfReader => new iotest.HalfReader(r) },
// TODO { name: "data+err", r => new iotest.DataErrReader(r) },
// TODO(bartlomieju): { name: "data+err", r => new iotest.DataErrReader(r) },
// { name: "timeout", fn: r => new iotest.TimeoutReader(r) },
];

View File

@ -236,7 +236,7 @@ Deno.test({
assert(file.tempfile != null);
assertEquals(file.size, size);
assertEquals(file.type, "application/octet-stream");
// TODO checksum of tmp & sampleFile
// TODO(bartlomieju): checksum of tmp & sampleFile
} finally {
await Deno.remove(multipartFile);
await Deno.remove(sampleFile);

View File

@ -4,7 +4,7 @@ import { notImplemented } from "../_utils.ts";
/** Revist once https://github.com/denoland/deno/issues/4017 lands */
//TODO - 'path' can also be a Buffer. Neither of these polyfills
// TODO(bartlomieju) 'path' can also be a Buffer. Neither of these polyfills
//is available yet. See https://github.com/denoland/deno/issues/3403
export function access(
_path: string | URL,
@ -14,8 +14,8 @@ export function access(
notImplemented("Not yet available");
}
//TODO - 'path' can also be a Buffer. Neither of these polyfills
//is available yet. See https://github.com/denoland/deno/issues/3403
// TODO(bartlomieju) 'path' can also be a Buffer. Neither of these polyfills
// is available yet. See https://github.com/denoland/deno/issues/3403
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function accessSync(path: string | URL, mode?: number): void {
notImplemented("Not yet available");

View File

@ -45,7 +45,7 @@ export function appendFile(
: undefined;
if (mode) {
//TODO rework once https://github.com/denoland/deno/issues/4017 completes
// TODO(bartlomieju) rework once https://github.com/denoland/deno/issues/4017 completes
notImplemented("Deno does not yet support setting mode on create");
}
Deno.open(pathOrRid as string, getOpenOptions(flag))
@ -100,7 +100,7 @@ export function appendFileSync(
: undefined;
if (mode) {
// TODO rework once https://github.com/denoland/deno/issues/4017 completes
// TODO(bartlomieju) rework once https://github.com/denoland/deno/issues/4017 completes
notImplemented("Deno does not yet support setting mode on create");
}

View File

@ -7,7 +7,7 @@ import timers from "./timers.ts";
// Definitions for this are quite delicate
// This ensures modifications to the global namespace don't break on TypeScript
// TODO
// TODO(bartlomieju):
// Deno lint marks globals defined by this module as undefined
// probably gonna change in the future

View File

@ -389,7 +389,7 @@ class Module {
const module = new Module(filename, parent);
if (isMain) {
// TODO: set process info
// TODO(bartlomieju): set process info
// process.mainModule = module;
module.id = ".";
}
@ -1052,7 +1052,7 @@ type RequireWrapper = (
) => void;
function wrapSafe(filename: string, content: string): RequireWrapper {
// TODO: fix this
// TODO(bartlomieju): fix this
const wrapper = Module.wrap(content);
// deno-lint-ignore no-explicit-any
const [f, err] = (Deno as any).core.evalContext(wrapper, filename);
@ -1135,7 +1135,7 @@ function makeRequireFunction(mod: Module): RequireFunction {
}
resolve.paths = paths;
// TODO: set main
// TODO(bartlomieju): set main
// require.main = process.mainModule;
// Enable support to add extra extension types.

View File

@ -1,5 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// TODO: implement the 'NodeJS.Timeout' and 'NodeJS.Immediate' versions of the timers.
// TODO(bartlomieju): implement the 'NodeJS.Timeout' and 'NodeJS.Immediate' versions of the timers.
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1163ead296d84e7a3c80d71e7c81ecbd1a130e9a/types/node/v12/globals.d.ts#L1120-L1131
export const setTimeout = window.setTimeout;
export const clearTimeout = window.clearTimeout;

View File

@ -76,7 +76,7 @@ function getPathFromURLWin(url: URL): string {
pathname = pathname.replace(forwardSlashRegEx, "\\");
pathname = decodeURIComponent(pathname);
if (hostname !== "") {
//TODO add support for punycode encodings
// TODO(bartlomieju): add support for punycode encodings
return `\\\\${hostname}${pathname}`;
} else {
// Otherwise, it's a local path that requires a drive letter

View File

@ -590,8 +590,10 @@ export default class Context {
const memoryView = new DataView(this.#memory.buffer);
memoryView.setUint8(offset, entry.type!);
memoryView.setUint16(offset + 2, entry.flags!, true);
memoryView.setBigUint64(offset + 8, 0n, true); // TODO
memoryView.setBigUint64(offset + 16, 0n, true); // TODO
// TODO(bartlomieju)
memoryView.setBigUint64(offset + 8, 0n, true);
// TODO(bartlomieju)
memoryView.setBigUint64(offset + 16, 0n, true);
return ERRNO_SUCCESS;
}),
@ -1371,19 +1373,19 @@ export default class Context {
}
if ((fdflags & FDFLAGS_DSYNC) != 0) {
// TODO (caspervonb) review if we can emulate this.
// TODO(caspervonb): review if we can emulate this.
}
if ((fdflags & FDFLAGS_NONBLOCK) != 0) {
// TODO (caspervonb) review if we can emulate this.
// TODO(caspervonb): review if we can emulate this.
}
if ((fdflags & FDFLAGS_RSYNC) != 0) {
// TODO (caspervonb) review if we can emulate this.
// TODO(caspervonb): review if we can emulate this.
}
if ((fdflags & FDFLAGS_SYNC) != 0) {
// TODO (caspervonb) review if we can emulate this.
// TODO(caspervonb): review if we can emulate this.
}
if (!options.read && !options.write && !options.truncate) {

View File

@ -4,10 +4,12 @@ import {
buildMode,
getPrebuiltToolPath,
getSources,
join,
ROOT_PATH,
} from "./util.js";
async function dlint() {
const configFile = join(ROOT_PATH, ".dlint.json");
const execPath = getPrebuiltToolPath("dlint");
console.log("dlint");
@ -49,7 +51,7 @@ async function dlint() {
}
for (const chunk of chunks) {
const p = Deno.run({
cmd: [execPath, "run", ...chunk],
cmd: [execPath, "run", "--config=" + configFile, ...chunk],
});
const { success } = await p.status();
if (!success) {