Re: [PATCH v4 09/14] tools/dot2c: Fix generated files going over 100 column limit
From: Gabriele Monaco <gmonaco@redhat.com>
Date: 2025-07-23 11:18:27
Also in:
lkml
From: Gabriele Monaco <gmonaco@redhat.com>
Date: 2025-07-23 11:18:27
Also in:
lkml
On Mon, 2025-07-21 at 16:52 +0200, Nam Cao wrote:
On Mon, Jul 21, 2025 at 10:23:19AM +0200, Gabriele Monaco wrote:quoted
The dot2c.py script generates all states in a single line. This breaks the 100 column limit when the state machines are non-trivial. Change dot2c.py to generate the states in separate lines in case the generated line is going to be too long. Also adapt existing monitors with line length over the limit. Suggested-by: Nam Cao <redacted> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com> --- - strformat = self.__get_state_string_length() - + maxlen = self.__get_max_strlen_of_states() + len(self.enum_suffix) + tab_braces = 2 * 8 + 2 + 1 # "\t\t{ " ... "}" + comma_space = 2 # ", " count last comma herePEP8 prefers two spaces before the comments.quoted
+ linetoolong = tab_braces + (maxlen + comma_space) * nr_events >= self.line_lengthShouldn't this be '>' instead of '>='? 100 columns are still within the limit.
Right, will do. Thanks, Gabriele