Tool directives are currently exempted by matching a recognized prefix against the whole comment node. As a result, reader-facing prose appended to a directive is exempted as well.
For example:
// @ts-expect-error the upstream types are wrong
The directive itself is machine-facing and should pass, but the trailing explanation is ordinary prose and can become stale. The same loophole exists for prefixes such as nolint, noqa, and swiftlint.
Ideally, commentcensor would exempt only the machine-consumed directive and inspect any trailing prose. This cannot be fixed by simply splitting on whitespace: directive arguments such as # noqa: F401 are also machine-consumed, and each tool has its own syntax.
Keep the current behavior for now. A future fix should define the accepted syntax of each directive and test both valid arguments and trailing reader-facing text.
Tool directives are currently exempted by matching a recognized prefix against the whole comment node. As a result, reader-facing prose appended to a directive is exempted as well.
For example:
// @ts-expect-error the upstream types are wrongThe directive itself is machine-facing and should pass, but the trailing explanation is ordinary prose and can become stale. The same loophole exists for prefixes such as
nolint,noqa, andswiftlint.Ideally, commentcensor would exempt only the machine-consumed directive and inspect any trailing prose. This cannot be fixed by simply splitting on whitespace: directive arguments such as
# noqa: F401are also machine-consumed, and each tool has its own syntax.Keep the current behavior for now. A future fix should define the accepted syntax of each directive and test both valid arguments and trailing reader-facing text.