Skip to content

Commit a79d39f

Browse files
authored
Merge pull request #228 from JdeRobot/feature-2
frequency control using rate
2 parents 297ec6c + b4c047a commit a79d39f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

manager/manager/lint/linter.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,16 @@ def evaluate_code(self, code, ros_version, warnings=False, py_lint_source="pylin
6464
r'[^ ]while\s*1\s*:|'
6565
r'[^ ]while\s*\(\s*1\s*\)\s*:|'
6666
r'rclpy\.spin\(\s*\w+\s*\)|'
67-
r'rclpy\.spin_once\(\s*\w+\s*.*?\)'
67+
r'rclpy\.spin_once\(\s*\w+\s*.*?\)|'
68+
r'\.create_rate\(\s*[\w.]+\s*\)'
6869

6970
)
7071
loop_match = re.search(loop_regex, code)
7172

7273
if loop_match is None:
73-
return "ERROR: No event loop found. Add 'while True:', 'rclpy.spin(node)', or 'rclpy.spin_once(node)'"
74+
return "ERROR: No event loop found. Add 'while True:', 'rclpy.spin(node)', or 'rclpy.spin_once(node)' or use 'Rate'"
7475

75-
if "rclpy.spin" in loop_match.group() or "rclpy.spin_once" in loop_match.group():
76+
if "rclpy.spin" in loop_match.group() or "rclpy.spin_once" in loop_match.group() or ".create_rate" in loop_match.group():
7677
# Keep the code as-is; don't modify it
7778
pass
7879
else:

0 commit comments

Comments
 (0)