diff --git a/qt/aqt/data/web/js/toolbar.ts b/qt/aqt/data/web/js/toolbar.ts index d7c2aa6c0..abc4e1e1c 100644 --- a/qt/aqt/data/web/js/toolbar.ts +++ b/qt/aqt/data/web/js/toolbar.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + enum SyncState { NoChanges = 0, Normal, diff --git a/scripts/copyright_headers.py b/scripts/copyright_headers.py index 570775362..344d9d19c 100644 --- a/scripts/copyright_headers.py +++ b/scripts/copyright_headers.py @@ -14,6 +14,12 @@ nonstandard_header = { "qt/aqt/winpaths.py", } +ignored_folders = [ + "bazel-", + "qt/forms", + "ts/node_modules", +] + if not os.path.exists("WORKSPACE"): print("run from workspace root") sys.exit(1) @@ -21,22 +27,30 @@ if not os.path.exists("WORKSPACE"): found = False for dirpath, dirnames, fnames in os.walk("."): dir = Path(dirpath) - if "bazel-" in dirpath: - continue - if "qt/forms" in dirpath: + + ignore = False + for folder in ignored_folders: + if folder in dirpath: + ignore = True + break + if ignore: continue + for fname in fnames: - if fname.endswith(".py"): - path = dir / fname - with open(path) as f: - top = f.read(256) - if not top.strip(): - continue - if str(path) in nonstandard_header: - continue - if "Ankitects Pty Ltd and contributors" not in top: - print("missing standard copyright header:", path) - found = True + for ext in ".py", ".ts": + if fname.endswith(ext): + path = dir / fname + with open(path) as f: + top = f.read(256) + if not top.strip(): + continue + if str(path) in nonstandard_header: + continue + if fname.endswith(".d.ts"): + continue + if "Ankitects Pty Ltd and contributors" not in top: + print("missing standard copyright header:", path) + found = True if found: sys.exit(1) \ No newline at end of file diff --git a/ts/editor/changeTimer.ts b/ts/editor/changeTimer.ts index fc7c22bbe..30e442e5d 100644 --- a/ts/editor/changeTimer.ts +++ b/ts/editor/changeTimer.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import type { EditingArea } from "./editingArea"; diff --git a/ts/editor/editable.ts b/ts/editor/editable.ts index 69eec5624..b67a21b49 100644 --- a/ts/editor/editable.ts +++ b/ts/editor/editable.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import { nodeIsInline } from "./helpers"; function containsInlineContent(field: Element): boolean { diff --git a/ts/editor/editingArea.ts b/ts/editor/editingArea.ts index 6b7d7c4af..737493f6b 100644 --- a/ts/editor/editingArea.ts +++ b/ts/editor/editingArea.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import type { Editable } from "./editable"; import { bridgeCommand } from "./lib"; diff --git a/ts/editor/editorField.ts b/ts/editor/editorField.ts index eb0b3005e..789af8d3d 100644 --- a/ts/editor/editorField.ts +++ b/ts/editor/editorField.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import type { EditingArea } from "./editingArea"; import type { LabelContainer } from "./labelContainer"; diff --git a/ts/editor/focusHandlers.ts b/ts/editor/focusHandlers.ts index ec676f6db..6ca0528dd 100644 --- a/ts/editor/focusHandlers.ts +++ b/ts/editor/focusHandlers.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import type { EditingArea } from "./editingArea"; diff --git a/ts/editor/helpers.ts b/ts/editor/helpers.ts index 9281af818..bfed2ed7a 100644 --- a/ts/editor/helpers.ts +++ b/ts/editor/helpers.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import type { EditingArea } from "./editingArea"; diff --git a/ts/editor/index.ts b/ts/editor/index.ts index acb18994f..44101244d 100644 --- a/ts/editor/index.ts +++ b/ts/editor/index.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { filterHTML } from "html-filter"; diff --git a/ts/editor/index_wrapper.ts b/ts/editor/index_wrapper.ts index a2b98fa16..13b2ec606 100644 --- a/ts/editor/index_wrapper.ts +++ b/ts/editor/index_wrapper.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + // extend the global namespace with our exports - not sure if there's a better way with esbuild import * as globals from "./index"; for (const key in globals) { diff --git a/ts/editor/inputHandlers.ts b/ts/editor/inputHandlers.ts index 8a4d5b28b..afb38bf0f 100644 --- a/ts/editor/inputHandlers.ts +++ b/ts/editor/inputHandlers.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { EditingArea } from "./editingArea"; import { caretToEnd, nodeIsElement } from "./helpers"; diff --git a/ts/editor/labelContainer.ts b/ts/editor/labelContainer.ts index 41b205048..7f9b2a02e 100644 --- a/ts/editor/labelContainer.ts +++ b/ts/editor/labelContainer.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import { bridgeCommand } from "./lib"; import pinIcon from "./pin-angle.svg"; diff --git a/ts/editor/lib.ts b/ts/editor/lib.ts index 63a9b0324..49c2e0961 100644 --- a/ts/editor/lib.ts +++ b/ts/editor/lib.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html declare global { interface Window { diff --git a/ts/editor/noteId.ts b/ts/editor/noteId.ts index 649db8d5e..fc10d7a99 100644 --- a/ts/editor/noteId.ts +++ b/ts/editor/noteId.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let currentNoteId: number | null = null; diff --git a/ts/editor/toolbar.ts b/ts/editor/toolbar.ts index a4d87819b..1e6cdb274 100644 --- a/ts/editor/toolbar.ts +++ b/ts/editor/toolbar.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const highlightButtons = ["bold", "italic", "underline", "superscript", "subscript"]; diff --git a/ts/editor/wrap.ts b/ts/editor/wrap.ts index 3c45b731c..c96fc7f8d 100644 --- a/ts/editor/wrap.ts +++ b/ts/editor/wrap.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { getCurrentField, setFormat } from "."; diff --git a/ts/graphs/preferences.ts b/ts/graphs/preferences.ts index 5dad878a2..5ac11a394 100644 --- a/ts/graphs/preferences.ts +++ b/ts/graphs/preferences.ts @@ -1,3 +1,7 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +// languageServerHost taken from MIT sources - see below. + import pb from "anki/backend_proto"; import { getGraphPreferences, setGraphPreferences } from "./graph-helpers"; import { Writable, writable, get } from "svelte/store"; diff --git a/ts/html-filter/element.ts b/ts/html-filter/element.ts index 4ef495f2f..0e68bf5a2 100644 --- a/ts/html-filter/element.ts +++ b/ts/html-filter/element.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import { isHTMLElement, isNightMode } from "./helpers"; import { removeNode as removeElement } from "./node"; import { diff --git a/ts/html-filter/helpers.ts b/ts/html-filter/helpers.ts index 7945d8942..eed5a492a 100644 --- a/ts/html-filter/helpers.ts +++ b/ts/html-filter/helpers.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + export function isHTMLElement(elem: Element): elem is HTMLElement { return elem instanceof HTMLElement; } diff --git a/ts/html-filter/index.test.ts b/ts/html-filter/index.test.ts index 3e881845d..35d33bb3b 100644 --- a/ts/html-filter/index.test.ts +++ b/ts/html-filter/index.test.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + test("it should work", () => { expect("test").toBe("test"); }); diff --git a/ts/html-filter/index.ts b/ts/html-filter/index.ts index cec3835e2..f3ef0df31 100644 --- a/ts/html-filter/index.ts +++ b/ts/html-filter/index.ts @@ -1,5 +1,5 @@ -/* Copyright: Ankitects Pty Ltd and contributors - * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { filterElementBasic, diff --git a/ts/html-filter/node.ts b/ts/html-filter/node.ts index 735e52fff..dccbe896c 100644 --- a/ts/html-filter/node.ts +++ b/ts/html-filter/node.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + export function removeNode(element: Node): void { element.parentNode?.removeChild(element); } diff --git a/ts/html-filter/styling.ts b/ts/html-filter/styling.ts index 4295f5015..6896268a5 100644 --- a/ts/html-filter/styling.ts +++ b/ts/html-filter/styling.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + interface AllowPropertiesBlockValues { [property: string]: string[]; } diff --git a/ts/lib/time.test.ts b/ts/lib/time.test.ts index 64a86b9de..a17d8266c 100644 --- a/ts/lib/time.test.ts +++ b/ts/lib/time.test.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import { naturalUnit, naturalWholeUnit, TimespanUnit } from "./time"; test("natural unit", () => { diff --git a/ts/lib/typing.ts b/ts/lib/typing.ts index e9cd02a0b..205930ff3 100644 --- a/ts/lib/typing.ts +++ b/ts/lib/typing.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + export function assertUnreachable(x: never): never { throw new Error(`unreachable: ${x}`); } diff --git a/ts/sql_format.ts b/ts/sql_format.ts index 56722eeda..fc5beedfa 100644 --- a/ts/sql_format.ts +++ b/ts/sql_format.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import sqlFormatter from "@sqltools/formatter"; import * as Diff from "diff"; import process from "process"; diff --git a/ts/svelte/svelte.ts b/ts/svelte/svelte.ts index a50023ffb..d1fdf3bde 100644 --- a/ts/svelte/svelte.ts +++ b/ts/svelte/svelte.ts @@ -1,3 +1,7 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +// languageServerHost taken from MIT sources - see below. + const fs = require("fs"); const worker = require("@bazel/worker"); const svelte2tsx = require("svelte2tsx"); diff --git a/ts/sveltelib/async.ts b/ts/sveltelib/async.ts index c6af59cc8..bed798520 100644 --- a/ts/sveltelib/async.ts +++ b/ts/sveltelib/async.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import { Readable, readable } from "svelte/store"; interface AsyncData { diff --git a/ts/sveltelib/asyncReactive.ts b/ts/sveltelib/asyncReactive.ts index 0b0aced12..80d75ee40 100644 --- a/ts/sveltelib/asyncReactive.ts +++ b/ts/sveltelib/asyncReactive.ts @@ -1,3 +1,6 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import { Readable, derived } from "svelte/store"; interface AsyncReativeData {