diff options
| author | Charles Brunet <charles.brunet@optelgroup.com> | 2024-06-26 10:44:46 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-06-26 15:44:49 -0400 |
| commit | dbfd3e8c41b96d40511f9a683d9718e2aca32275 (patch) | |
| tree | e581a6e7be4db083a95559e1c7d783ed9ef52a9f /mesonbuild | |
| parent | d2e7250433e561725ff82b167739de903ca17a0f (diff) | |
| download | meson-dbfd3e8c41b96d40511f9a683d9718e2aca32275.tar.gz | |
format: fix edge case with empty functions
format was adding a new empty line each time when trying to split a long line containing a function with no arguments
Diffstat (limited to 'mesonbuild')
| -rw-r--r-- | mesonbuild/mformat.py | 2 | ||||
| -rw-r--r-- | mesonbuild/mparser.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/mformat.py b/mesonbuild/mformat.py index e20e45851..42f562e7f 100644 --- a/mesonbuild/mformat.py +++ b/mesonbuild/mformat.py @@ -744,7 +744,7 @@ class ComputeLineLengths(FullAstVisitor): self.exit_node(node) def split_if_needed(self, node: mparser.ArgumentNode) -> None: - if not node.is_multiline and self.length > self.config.max_line_length: + if len(node) and not node.is_multiline and self.length > self.config.max_line_length: arg = self.argument_stack[self.level] if len(self.argument_stack) > self.level else node if not arg.is_multiline: arg.is_multiline = True diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index ec08ccfb2..50d720313 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -377,7 +377,7 @@ class ArgumentNode(BaseNode): return self.order_error def __len__(self) -> int: - return self.num_args() # Fixme + return self.num_args() + self.num_kwargs() @dataclass(unsafe_hash=True) class ArrayNode(BaseNode): |
