Skip to content

TypeScript linter: a warning for logic that is not in a primitive (CUP-I008) - #10

Open
JoshuaWink wants to merge 3 commits into
betafrom
lint-logic-outside-primitive
Open

JoshuaWink wants to merge 3 commits into
betafrom
lint-logic-outside-primitive

Conversation

@JoshuaWink

Copy link
Copy Markdown
Member

What is added

A project that uses codeupipe writes its logic as Filters, Predicates, Taps, Hooks and Pipelines. Logic in a plain function or a plain class works as well, so nothing showed the mistake. The TypeScript linter now reports it.

path:line:col  CUP-I008 logic-outside-primitive  warning: Function `whoIsDue` has logic and is not a Filter, a Predicate, a Tap, a Hook or a Pipeline. ...
  • Logic is a decision or a loop: if, ? :, switch, for, while, do, try.
  • Flagged, once each: a function at the top of a file, a class at the top of a file that is not a primitive, and the code at the top of a file.
  • Not flagged: a primitive, a function or a class with no logic, a type, and a test file.
  • Not seen: a loop that is a method call (map, filter, forEach), and && / ||.

It is a warning

A warning is in the report and is counted apart: No findings. 3 warnings. It does not make the exit code 1. With --strict, a warning fails the run as a finding does.

For logic that must be plain code, a comment says why: // cup: allow-plain <reason>.

What it finds in this repository

The code of the framework itself (Payload, the shape check of Pipeline, labelOf) is marked with allow-plain. The TypeScript linter and the TypeScript compiler have 40 warnings, because their helpers are plain functions. This pull request does not change them.

Not in this pull request

The Python linter does not have this rule.

🤖 Generated with Claude Code

JoshuaWink and others added 3 commits October 11, 2026 17:42
A project that uses codeupipe writes its logic as Filters, Predicates,
Taps, Hooks and Pipelines. Logic in a plain function or a plain class
works as well, so nothing showed the mistake. The linter now reports a
function, a class or the code at the top of a file that has logic (if,
? :, switch, a loop, try) and is not a primitive.

- It is a warning: it is in the report, it is counted apart, and it
  does not fail the run. --strict makes a warning fail the run.
- A comment with a reason allows plain code: // cup: allow-plain <why>.
- Test files are not checked.

The code of the framework itself is marked. The TypeScript linter and
the TypeScript compiler of this repository have 40 warnings: their
helpers are plain functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cup: allow-... comment that allowed no finding is a warning. It stays
when the code that it was for is gone or has moved, or when its kind
has a spelling error. Rules that are switched off are dropped last, so
that a comment for such a rule is not reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CUP-I008 is logic that is not in a primitive. CUP-I009 is a comment
that allows nothing. Both are warnings: the linter now has warnings,
and --strict makes one fail the run. Rules that are switched off are
dropped last, so that a comment for such a rule is not reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant