Skip to content

Increase code quality and fix test #1124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Mar 31, 2025

Conversation

Daraan
Copy link
Contributor

@Daraan Daraan commented Oct 25, 2024

This change is Reviewable

Comment on lines -1651 to -1656
if scope:
pass
else:
msg = "behavior name: " + name + " is not defined!"
pass

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

Comment on lines -214 to -219
def enter_variable_declaration(self, node: ast_node.VariableDeclaration):
pass

def exit_variable_declaration(self, node: ast_node.VariableDeclaration):
pass

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double defined

Comment on lines -826 to -850
class VariableDeclaration(Declaration):
"""
'var' fieldName (',' fieldName)* ':' typeDeclarator ('=' (sampleExpression | valueExp) )? NEWLINE;
"""

def __init__(self, field_name, field_type):
super().__init__()
self.field_name = field_name
self.field_type = field_type
self.set_children(field_name)

def enter_node(self, listener):
if hasattr(listener, "enter_variable_declaration"):
listener.enter_variable_declaration(self)

def exit_node(self, listener):
if hasattr(listener, "exit_variable_declaration"):
listener.exit_variable_declaration(self)

def accept(self, visitor):
if hasattr(visitor, "visit_variable_declaration"):
return visitor.visit_variable_declaration(self)
else:
return visitor.visit_children(self)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Comment on lines -144 to -146
def visit_variable_declaration(self, node: ast_node.VariableDeclaration):
return self.visit_children(node)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

@Daraan Daraan marked this pull request as ready for review March 14, 2025 10:14
@Daraan
Copy link
Contributor Author

Daraan commented Mar 14, 2025

There's still a longer way to go but this bring us a bit closer to our goal.

Copy link
Contributor

@glopezdiest glopezdiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 28 of 38 files at r1, 26 of 26 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions

Copy link
Contributor

@glopezdiest glopezdiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 4 unresolved discussions

@glopezdiest
Copy link
Contributor

Hey, thanks for the code improvements. I've accepted the PR. If your resolve your comments we can merge it

Copy link
Contributor Author

@Daraan Daraan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was about to do so. Thank you for looking into it. I always forget that simple comments do block.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Daraan)

Daraan and others added 6 commits March 27, 2025 15:44
remove extra lines (carla-simulator#1074)

Add misc type default blueprint (carla-simulator#1064)

Co-authored-by: Pablo Villanueva-Domingo <[email protected]>

Fix: wrong initial transform when using request_new_batch_actors (carla-simulator#1068) (carla-simulator#1075)

See: carla-simulator#1068

Co-authored-by: Daraan <[email protected]>

Update atomic_trigger_conditions.py (carla-simulator#946)

In the StandStill() class, change the EPSILON, 0.001

Implement variable frame rate (carla-simulator#1005)

Replaced class variable frame_rate with an argument provided on the CLI.

Co-authored-by: glopezdiest <[email protected]>

Workflow improvements and code quality passing (carla-simulator#1052)

* CI: Checkout v4 and unit tests name correction

* Small tweaks to ensure Code Quality passes

---------

Co-authored-by: glopezdiest <[email protected]>

Fixed metrics wheel parser (carla-simulator#1076)

Co-authored-by: glopezdiest <[email protected]>

[Feature] Blueprint-based spawn_actor function for CarlaDataProvider (carla-simulator#1071)

* blueprint-based spawn_actor function for CDP

* Auto-Option to decide tracking

* Updated changelog

* spawned actors are tracked if they are Vehicle | Walker

* Updated spawn_actor description

---------

Co-authored-by: glopezdiest <[email protected]>

Hotfix: missing AttachmentType in the carla mock module for unittest (carla-simulator#1077)

* blueprint-based spawn_actor function for CDP

* Auto-Option to decide tracking

* Updated changelog

* spawned actors are tracked if they are Vehicle | Walker

* Updated spawn_actor description

* Added missing AttachmentType for carla mock

---------

Co-authored-by: glopezdiest <[email protected]>

Backward compatible upgrade to fix deprecation warnings concerning LooseVersion and pkg_resources for Python3.8+ (carla-simulator#1058)

* upgraded version checking to fix deprecation warnings

Removed usage of pgk_resources and distutils.version.LooseVersion

* < python3.8 backward compatible version checking

* Compacter version checking.

---------

Co-authored-by: glopezdiest <[email protected]>

Replace deprecated python 3.8 code and add missing __init__.py files for proper python module recognition (carla-simulator#1053)

Co-authored-by: glopezdiest <[email protected]>

add support for scientific notation parsing while running OpenSCENARIO files (carla-simulator#1023)

Co-authored-by: glopezdiest <[email protected]>

Update osc2_scenario_configuration.py (carla-simulator#1040)

Add super.__init__() to class OSC2ScenarioConfiguration to prevent error "AttributeError: 'OSC2ScenarioConfiguration' object has no attribute 'route'" when running scenario_runner.py with --openscenario2 parameter

Co-authored-by: glopezdiest <[email protected]>

Remove version redundancy (carla-simulator#1081)

Update minimum CARLA version to 0.9.14 (carla-simulator#1082)

* Remove version redundancy

* Merge branch 'master' of https://github.com/carla-simulator/scenario_runner

* Update minimum CARLA version

Type-hint comments for CarlaDataProvider (carla-simulator#1066)

* Type-hint comments for CarlaDataProvider

* Suppress Any import warning

* Removed None values, increased type-coverage

Added log agent

[fix]rename compound_symbol.py (carla-simulator#1089)

Fixed a typo in openscenario_parser.py (carla-simulator#1118)

* Fixed a typo

There was a typo in function "get_traffic_light_from_osc_name", which was accessing "CCarlaDataProvider" insted of "CarlaDataProvider".

* Delete the unneeded file

Fix: Remove duplicate clean method calls (carla-simulator#1096)

* [fix]rename compound_symbol.py

* [fix]Remove duplicate clean method calls

* Fix Atomic_behaviors AddActor Func

No return status

Link documentation in README (carla-simulator#1129)

Include 0.9.14 carla release as compatible with scenario runner 0.9.13 (carla-simulator#1130)

* Link documentation in README

* Include 0.9.14 carla release as compatible with scenario runner 0.9.13

* Merge branch 'master' into docs_in_readme

Added a missing element to the blackboard (carla-simulator#1141)

Co-authored-by: glopezdiest <[email protected]>

Replaced deprecated is_intersection with is_junction (carla-simulator#1114)

Co-authored-by: glopezdiest <[email protected]>

CDP request_new_actor new optional argument. (carla-simulator#1113)

spawn_point can be ommited when random_location=True

Co-authored-by: glopezdiest <[email protected]>

Faster information retrieval if actor key is present (carla-simulator#1098)

Co-authored-by: glopezdiest <[email protected]>

Don't depend on distutils (carla-simulator#1121)

distutils are no longer available in Python 3.12. Therefore, we copy
the strtobool function from distutils to our own module. This is in
line with https://peps.python.org/pep-0632/#migration-advice.

Co-authored-by: glopezdiest <[email protected]>

Fix dead actor accumulation in CDP (carla-simulator#1091)

* Slightly more informative function

Returns bool if actor was in the pool, else otherwise

* Fix accumulation of dead actors in CDP actor pool

* Dead actor cleaning in CDP._actor_*_maps

---------

Co-authored-by: glopezdiest <[email protected]>
This fixes warnings like the one below:

    .../srunner/scenarios/osc2_scenario.py:515: SyntaxWarning: invalid escape sequence '\W'
    expression_value = re.split("\W+", option)

Co-authored-by: glopezdiest <[email protected]>
@Daraan
Copy link
Contributor Author

Daraan commented Mar 27, 2025

I've added a few more fixes but ill stop for good now :)

Probably nice would be to just run the formatting tool in an extra PR. And possibly extract other fixes from #1087.

In the long run I think the current tests are way to strict, reducing the rule sets should help.
Possible we could also switch to https://docs.astral.sh/ruff.

Copy link
Contributor

@glopezdiest glopezdiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 19 of 20 files at r4.
Reviewable status: 56 of 57 files reviewed, all discussions resolved (waiting on @Daraan)

Copy link
Contributor

@glopezdiest glopezdiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 20 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Daraan)

Copy link
Contributor

@glopezdiest glopezdiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Daraan)

Copy link
Contributor

@glopezdiest glopezdiest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Daraan)

@glopezdiest
Copy link
Contributor

Agreed, our code analysis is a bit old and needs a revision. Thanks for the contribution, as always.

@glopezdiest glopezdiest merged commit 46b1198 into carla-simulator:master Mar 31, 2025
1 of 4 checks passed
@Daraan Daraan deleted the code-quality branch March 31, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants