Lints

121 lints, each with the code it flags, the rewrite and the reason. cpl lint, the editor and the playground show them; none ever fails cpl build or cpl run. Set a lint's level in cp.toml under [lints], or silence one in code with with lint(name: allow).

By group

Correctness 9

Code that is wrong or almost certainly a bug. Denied by cpl lint.

Performance 7

Code that does more work than it needs to.

Idioms 92

A hand-written pattern the language or the standard library already says in one step.

Style 12

Spelling that hides what the code means.

Pedantic 1

Stricter checks, off by default.

By family

The families of the idioms catalog, spec/idioms/lints.md.

N. Naming and spelling

D. Domains, positions and cuts

W. Ownership, lending and moves

R. Redundancy and dead code

H. C++ habits

S. The standard library would say it shorter

F. Functions, closures and generators

T. Multitest and state

K. Arithmetic, overflow, modulus and floats

O. Optionals and sentinels

I. Input and output

By practice

The practices of spec/idioms/principles.md each lint serves.

1. Name the algorithm

2. Whole-sequence operations for reductions, searches and builds; loops for algorithms

3. Name an index space when it is shared or confusable

5. Absence is an optional, never a sentinel

6. Write each constraint once, as a type

7. One home for each choice

8. Values by default; mutation is explicit and local

10. Costs show

11. Print what you mean

13. One spelling per idea