forked from MetroRobots/ros_glint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ROS Interface Glinters (MetroRobots#3)
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from .core import get_linters | ||
|
||
__all__ = ['get_linters'] | ||
from .glinters import ros_interfaces | ||
|
||
__all__ = ['get_linters', 'ros_interfaces'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from ..core import glinter | ||
from ros_introspect.components.ros_interface import PRIMITIVES | ||
|
||
STANDARD = { | ||
'Header': 'std_msgs' | ||
} | ||
|
||
|
||
@glinter | ||
def clean_whitespace_from_interface_definition(package): | ||
# Formerly remove_trailing_whitespace_from_generators | ||
for interface in package.get_ros_interfaces(): | ||
interface.changed = True | ||
|
||
|
||
@glinter | ||
def fill_in_msg_package_names(package): | ||
interfaces = package.get_ros_interfaces() | ||
all_names = {ros_i.name for ros_i in interfaces} | ||
|
||
for interface in interfaces: | ||
for section in interface.sections: | ||
for field in section.fields: | ||
if '/' in field.type or field.type in PRIMITIVES: | ||
continue | ||
|
||
if field.type in STANDARD: | ||
field.type = STANDARD[field.type] + '/' + field.type | ||
interface.changed = True | ||
elif field.type in all_names: | ||
field.type = package.name + '/' + field.type | ||
interface.changed = True |