Skip to content

Commit

Permalink
chore: Enforce ban-untagged-todo lint rule (denoland/deno#9135)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju authored and denobot committed Jan 31, 2021
1 parent e2906e4 commit b176d43
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 40 deletions.
2 changes: 1 addition & 1 deletion encoding/_yaml/loader/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion encoding/toml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions fmt/printf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
24 changes: 15 additions & 9 deletions fmt/printf_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, "�"],
// 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, "�"],
["%c", 0x110000, "�"],
["%c", 0xfffffffff, "�"],
// TODO
// TODO(bartlomieju):
// escaped characters
// Runes that are not printable.
// Runes that are not valid.
Expand All @@ -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"],
Expand All @@ -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
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion fs/copy_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion fs/expand_glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion http/_io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion http/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions http/file_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion http/file_server_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion io/bufio_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
];

Expand Down
2 changes: 1 addition & 1 deletion mime/multipart_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions node/_fs/_fs_access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions node/_fs/_fs_appendFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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");
}

Expand Down
2 changes: 1 addition & 1 deletion node/global_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions node/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ".";
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion node/timers.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion node/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions wasi/snapshot_preview1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}),
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b176d43

Please sign in to comment.