Skip to content

Commit

Permalink
added add_file_location() to checks
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Wenninger <johannes.wenninger@lcm.at>
  • Loading branch information
johannesWen committed Dec 18, 2024
1 parent a1b29b8 commit dae5d1f
Show file tree
Hide file tree
Showing 21 changed files with 389 additions and 43 deletions.
10 changes: 9 additions & 1 deletion qc_opendrive/checks/basic/fileheader_is_present.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,13 @@ def check_rule(checker_data: models.CheckerData) -> None:
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(root),
description=f"No child element header",
lines=root.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=root.sourceline,
column=0,
description="No child element header",
)
10 changes: 9 additions & 1 deletion qc_opendrive/checks/basic/root_tag_is_opendrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,13 @@ def check_rule(checker_data: models.CheckerData) -> bool:
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(root),
description=f"Root is not OpenDRIVE",
lines=root.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=root.sourceline,
column=0,
description="Root is not OpenDRIVE",
)
10 changes: 9 additions & 1 deletion qc_opendrive/checks/basic/version_is_defined.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,13 @@ def check_rule(checker_data: models.CheckerData) -> bool:
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(file_header_tag),
description=f"Header tag has invalid or missing version info",
lines=file_header_tag.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=file_header_tag.sourceline,
column=0,
description="Header tag has invalid or missing version info",
)
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ def _check_all_roads(checker_data: models.CheckerData) -> None:
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(geometry),
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
lines=geometry.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=geometry.sourceline,
column=0,
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
)

s_coordinate = utils.get_s_from_geometry(geometry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ def _check_all_roads(checker_data: models.CheckerData) -> None:
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(geometry),
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
lines=geometry.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=geometry.sourceline,
column=0,
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
)

s_coordinate = utils.get_s_from_geometry(geometry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ def _check_all_roads(checker_data: models.CheckerData) -> None:
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(geometry),
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
lines=geometry.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=geometry.sourceline,
column=0,
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
)

s_coordinate = utils.get_s_from_geometry(geometry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,15 @@ def _raise_issue(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(left_lane),
description=f"Outer lane border intersects or stays within inner lane border.",
lines=left_lane.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=left_lane.sourceline,
column=0,
description=f"Outer lane border intersects or stays within inner lane border.",
)

checker_data.result.add_xml_location(
Expand All @@ -139,7 +147,15 @@ def _raise_issue(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(right_lane),
description=f"Outer lane border intersects or stays within inner lane border.",
lines=right_lane.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=right_lane.sourceline,
column=0,
description=f"Outer lane border intersects or stays within inner lane border.",
)

s_section = utils.get_s_from_lane_section(lane_section_with_length.lane_section)
Expand Down
120 changes: 108 additions & 12 deletions qc_opendrive/checks/performance/performance_avoid_redundant_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ def _check_road_superelevations(
current_superelevation.xml_element
),
description=f"Redundant superelevation declaration.",
lines=current_superelevation.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=current_superelevation.xml_element.sourceline,
column=0,
description=f"Redundant superelevation declaration.",
)

checker_data.result.add_xml_location(
Expand All @@ -57,7 +65,15 @@ def _check_road_superelevations(
next_superelevation.xml_element
),
description=f"Redundant superelevation declaration.",
lines=next_superelevation.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=next_superelevation.xml_element.sourceline,
column=0,
description=f"Redundant superelevation declaration.",
)

inertial_point = utils.get_point_xyz_from_road_reference_line(
Expand Down Expand Up @@ -99,7 +115,15 @@ def _check_road_elevations(
current_elevation.xml_element
),
description=f"Redundant elevation declaration.",
lines=current_elevation.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=current_elevation.xml_element.sourceline,
column=0,
description=f"Redundant superelevation declaration.",
)

checker_data.result.add_xml_location(
Expand All @@ -110,7 +134,15 @@ def _check_road_elevations(
next_elevation.xml_element
),
description=f"Redundant elevation declaration.",
lines=next_elevation.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=next_elevation.xml_element.sourceline,
column=0,
description=f"Redundant elevation declaration.",
)

inertial_point = utils.get_point_xyz_from_road_reference_line(
Expand Down Expand Up @@ -152,7 +184,15 @@ def _check_lane_offsets(
current_lane_offset.xml_element
),
description=f"Redundant lane offset declaration.",
lines=current_lane_offset.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=current_lane_offset.xml_element.sourceline,
column=0,
description=f"Redundant lane offset declaration.",
)

checker_data.result.add_xml_location(
Expand All @@ -163,7 +203,15 @@ def _check_lane_offsets(
next_lane_offset.xml_element
),
description=f"Redundant lane offset declaration.",
lines=next_lane_offset.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=next_lane_offset.xml_element.sourceline,
column=0,
description=f"Redundant lane offset declaration.",
)

s = next_lane_offset.s_offset
Expand Down Expand Up @@ -218,7 +266,15 @@ def _check_road_plan_view(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(current_geometry),
description=f"Redundant line geometry declaration.",
lines=current_geometry.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=current_geometry.sourceline,
column=0,
description=f"Redundant line geometry declaration.",
)

checker_data.result.add_xml_location(
Expand All @@ -227,7 +283,15 @@ def _check_road_plan_view(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(next_geometry),
description=f"Redundant line geometry declaration.",
lines=next_geometry.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=next_geometry.sourceline,
column=0,
description=f"Redundant line geometry declaration.",
)

s_offset = utils.get_s_from_geometry(next_geometry)
Expand Down Expand Up @@ -274,7 +338,15 @@ def _check_lane_widths(
current_width.xml_element
),
description=f"Redundant lane width declaration.",
lines=current_width.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=current_width.xml_element.sourceline,
column=0,
description=f"Redundant lane width declaration.",
)

checker_data.result.add_xml_location(
Expand All @@ -283,7 +355,15 @@ def _check_lane_widths(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(next_width.xml_element),
description=f"Redundant lane width declaration.",
lines=next_width.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=next_width.xml_element.sourceline,
column=0,
description=f"Redundant lane width declaration.",
)

s_section = utils.get_s_from_lane_section(lane_section)
Expand Down Expand Up @@ -336,7 +416,15 @@ def _check_lane_borders(
current_border.xml_element
),
description=f"Redundant lane border declaration.",
lines=current_border.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=current_border.xml_element.sourceline,
column=0,
description=f"Redundant lane border declaration.",
)

checker_data.result.add_xml_location(
Expand All @@ -345,7 +433,15 @@ def _check_lane_borders(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(next_border.xml_element),
description=f"Redundant lane border declaration.",
lines=next_border.xml_element.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=next_border.xml_element.sourceline,
column=0,
description=f"Redundant lane border declaration.",
)

s_section = utils.get_s_from_lane_section(lane_section)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ def _check_junctions_connection_connect_road_no_incoming_road(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(connection),
description="Connection with connecting road found as incoming road.",
lines=connection.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=connection.sourceline,
column=0,
description=f"Connection with connecting road found as incoming road.",
)

successor_junction_id = utils.get_linked_junction_id(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ def _raise_issue(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(connection),
description=f"Contact point 'end' not used on successor road connection.",
lines=connection.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=connection.sourceline,
column=0,
description=f"Contact point 'end' not used on successor road connection.",
)

inertial_point = utils.get_end_point_xyz_from_road_reference_line(connection_road)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ def _check_junctions_connection_one_connection_element(
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(connection),
description="Connection with reused connecting road id.",
lines=connection.sourceline,
)

checker_data.result.add_file_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
row=connection.sourceline,
column=0,
description=f"Connection with reused connecting road id.",
)

connecting_road = road_id_map.get(connecting_road_id)
Expand Down
Loading

0 comments on commit dae5d1f

Please sign in to comment.