From dfca89b7b5047ac4c49e4534df3364612499c53d Mon Sep 17 00:00:00 2001 From: Evan Hubinger Date: Tue, 26 Nov 2024 02:07:33 -0800 Subject: [PATCH] Allow semicolon at end of line Resolves #859. --- DOCS.md | 1 - coconut/compiler/compiler.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DOCS.md b/DOCS.md index 8e4b5ef1..6c51b0ea 100644 --- a/DOCS.md +++ b/DOCS.md @@ -341,7 +341,6 @@ The style issues which will cause `--strict` to throw an error are: - use of `"hello" "world"` implicit string concatenation (use explicit `+` instead) - use of `from __future__` imports (Coconut does these automatically) - inheriting from `object` in classes (Coconut does this automatically) -- semicolons at end of lines - use of `u` to denote Unicode strings (all Coconut strings are Unicode strings) - `f`-strings with no format expressions in them - commas after [statement lambdas](#statement-lambdas) (not recommended as it can be unclear whether the comma is inside or outside the lambda) diff --git a/coconut/compiler/compiler.py b/coconut/compiler/compiler.py index d9acfbd8..3f1c6518 100644 --- a/coconut/compiler/compiler.py +++ b/coconut/compiler/compiler.py @@ -5399,7 +5399,8 @@ def lambdef_check(self, original, loc, tokens): def endline_semicolon_check(self, original, loc, tokens): """Check for semicolons at the end of lines.""" - return self.check_strict("semicolon at end of line", original, loc, tokens, always_warn=True) + # only warn since this can have a real impact in jupyter notebooks (#859) + return self.check_strict("semicolon at end of line", original, loc, tokens, only_warn=True) def u_string_check(self, original, loc, tokens): """Check for Python-2-style unicode strings."""