From 3e8dc41bdf11f11a594c2c2f4316e2301b2e777e Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Thu, 4 Sep 2025 07:48:08 -0400 Subject: [PATCH] Add microagent for fixing E501 line too long errors (#10796) Co-authored-by: openhands --- microagents/fix-py-line-too-long.md | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 microagents/fix-py-line-too-long.md diff --git a/microagents/fix-py-line-too-long.md b/microagents/fix-py-line-too-long.md new file mode 100644 index 0000000000..7a3b3fe956 --- /dev/null +++ b/microagents/fix-py-line-too-long.md @@ -0,0 +1,39 @@ +--- +name: fix-py-line-too-long +type: knowledge +version: 1.0.0 +agent: CodeActAgent +triggers: +- E501 +- line too long +--- + +# Instructions for fixing "E501 Line too long" + +## For code lines +Break into multiple lines using parentheses or brackets: +```python +result = some_very_long_function_name( + parameter1, parameter2, parameter3 +) +``` + +## For single-line strings +Use string concatenation: `"ABC"` → `("A" "B" "C")` +```python +message = ("This is a very long string " + "that needs to be broken up") +``` + +## For long multi-line strings (docstrings) +Add `# noqa: E501` AFTER the ending `"""`. NEVER add it inside the docstring. +```python +def example_function(): + """This is a very long docstring that exceeds the line length limit.""" # noqa: E501 + pass +``` + +## What NOT to do +- Do not add `# noqa: E501` inside docstrings or multi-line strings +- Do not break strings in the middle of words +- Do not sacrifice code readability for line length compliance