You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add --pure compilation mode flag for enforcing functional programming norms
- Currently disallows global and nonlocal statements in --pure mode
- Refactor strict_err_or_warn to support noqa_able parameter
- Remove strict_qa_error in favor of unified strict_err_or_warn
- Add NOQA suppression support to check_strict
- Add has_noqa_comment utility method
- Add tests for --pure mode and NOQA suppression
- Add documentation for --pure mode in DOCS.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: DOCS.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -327,7 +327,7 @@ _Note: Periods are optional in target specifications, such that the target `27`
327
327
328
328
#### `strict` Mode
329
329
330
-
If the `--strict` (`-s` for short) flag is enabled, Coconut will perform additional checks on the code being compiled. It is recommended that you use the `--strict` flag if you are starting a new Coconut project, as it will help you write cleaner code. Almost all of these checks can be disabled on a line-by-line basis by adding `# NOQA` or `# noqa` comments. Specifically, the extra checks done by `--strict` are:
330
+
If the `--strict` (`-s` for short) flag is enabled, Coconut will perform additional checks on the code being compiled. It is recommended that you use the `--strict` flag if you are starting a new Coconut project, as it will help you write cleaner code. Most of these checks can be disabled on a line-by-line basis by adding `# NOQA` or `# noqa` comments (the error message will say whether `NOQA` is supported). Specifically, the extra checks done by `--strict` are:
331
331
332
332
- disabling deprecated features (making them entirely unavailable to code compiled with `--strict`),
333
333
- errors instead of warnings on unused imports (unless they have a `# NOQA` or `# noqa` comment),
@@ -354,6 +354,14 @@ The style issues which will cause `--strict` to throw an error are:
354
354
355
355
Note that many of the above style issues will still show a warning if `--strict` is not present.
356
356
357
+
#### `pure` Mode
358
+
359
+
If the `--pure` flag is enabled, Coconut will enforce functional programming norms on the code being compiled. These checks are compatible with `--strict` mode—when both are enabled, violations become errors instead of warnings. Like `--strict`, these checks can usually be disabled on a line-by-line basis by adding `# NOQA` or `# noqa` comments.
360
+
361
+
The following are disallowed in `--pure` mode:
362
+
-`global` statements
363
+
-`nonlocal` statements
364
+
357
365
#### Backports
358
366
359
367
In addition to the newer Python features that Coconut can backport automatically itself to older Python versions, Coconut will also automatically compile code to make use of a variety of external backports as well. These backports are automatically installed with Coconut if needed and Coconut will automatically use them instead of the standard library if the standard library is not available. These backports are:
0 commit comments