Skip to content

Commit 297ec6c

Browse files
authored
Merge pull request #221 from JdeRobot/feature-1
spin_once implementation along with parameter support
2 parents 4733fe2 + 457c250 commit 297ec6c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

manager/manager/lint/linter.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ def evaluate_code(self, code, ros_version, warnings=False, py_lint_source="pylin
6363
r'[^ ]while\s*True\s*:|'
6464
r'[^ ]while\s*1\s*:|'
6565
r'[^ ]while\s*\(\s*1\s*\)\s*:|'
66-
r'rclpy\.spin\(\s*\w+\s*\)'
66+
r'rclpy\.spin\(\s*\w+\s*\)|'
67+
r'rclpy\.spin_once\(\s*\w+\s*.*?\)'
68+
6769
)
6870
loop_match = re.search(loop_regex, code)
6971

7072
if loop_match is None:
71-
return "ERROR: A loop is required — please use either 'while True:' or 'rclpy.spin(node)'."
72-
73-
if "rclpy.spin" in loop_match.group():
73+
return "ERROR: No event loop found. Add 'while True:', 'rclpy.spin(node)', or 'rclpy.spin_once(node)'"
74+
75+
if "rclpy.spin" in loop_match.group() or "rclpy.spin_once" in loop_match.group():
7476
# Keep the code as-is; don't modify it
7577
pass
7678
else:

0 commit comments

Comments
 (0)