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
TODO: Right now, the only fixable errors are via re-serialization.
312
+
Safely fixable errors are applied by default via re-serialization. However,
313
+
rules may implement unsafe fixes (mutating the notebook structure) that require
314
+
the `--unsafe-fixes` flag. To do this, implement an `async def
315
+
apply_unsafe_fixes(self, notebook, diagnostics) -> Notebook` method in your
316
+
rule class, and inherit from `UnsafeFixRule` instead of `LintRule`.
313
317
314
318
## Common Patterns
315
319
@@ -388,6 +392,22 @@ Before submitting your rule:
388
392
-[ ] Error messages are clear and actionable
389
393
-[ ] Performance is reasonable for large notebooks
390
394
391
-
## Example: Simple Rule Implementation
395
+
## Examples
392
396
393
-
Here's a complete example of a simple rule that checks for syntax errors: https://github.com/marimo-team/marimo/pull/6384
397
+
### Simple Rule Implementation
398
+
399
+
Example of a simple rule that checks for syntax errors: https://github.com/marimo-team/marimo/pull/6384
400
+
401
+
### Rule Implementation with `--unsafe-fixes`
402
+
403
+
Some rules may have "fixes" that mutate the notebook structure.
404
+
An example of a rule that mutates the notebook structure (i.e. an unsafe fix) by removing empty cells: https://github.com/marimo-team/marimo/pull/6398
405
+
406
+
### Rule Implementation with Log Context
407
+
408
+
Some parsing issues result in log warnings or errors.
409
+
An example of a rule that hooks into issued logs can be found here:
410
+
411
+
**Note**: Resist intentionally adding log statements such that they trigger
412
+
lint rules. Log statements should be added only when they provide useful
0 commit comments