Skip to content

Commit

Permalink
refactor(traffic_light_roi_visualizer): adjust shape dimensions and f…
Browse files Browse the repository at this point in the history
…ont style

Signed-off-by: KhalilSelyan <[email protected]>
  • Loading branch information
KhalilSelyan committed May 27, 2024
1 parent b6ba188 commit 2ac8b56
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void drawShape(
params.image,
cv::Rect(
// width should take into account the text width
position.x - 2, position.y - 5, shapeImg.cols + 47, shapeImg.rows + 5),
position.x - 2, position.y - 5, shapeImg.cols + 70, shapeImg.rows + 12),
params.color,
-1); // Filled rectangle

Expand All @@ -82,7 +82,7 @@ void drawShape(
cv::putText(
params.image, std::to_string(static_cast<int>(round(params.probability * 100))) + "%",
cv::Point(position.x + shapeImg.cols + 5, position.y + shapeImg.rows / 2 + 5),
cv::FONT_HERSHEY_COMPLEX, 0.45, cv::Scalar(0, 0, 0), 2);
cv::FONT_HERSHEY_SIMPLEX, 0.7, cv::Scalar(0, 0, 0), 2, cv::LINE_AA);
}

Check warning on line 86 in perception/traffic_light_visualization/src/traffic_light_roi_visualizer/shape_draw.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

drawShape has a cyclomatic complexity of 11, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 86 in perception/traffic_light_visualization/src/traffic_light_roi_visualizer/shape_draw.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Excess Number of Function Arguments

drawShape has 6 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

void drawCircle(const DrawFunctionParams & params)
Expand Down

0 comments on commit 2ac8b56

Please sign in to comment.