Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
chore: Update static_code_check.yml with third-party tool for code formatting
  • Loading branch information
TayYim committed Jun 11, 2024
1 parent 58656a3 commit 452e9e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/static_code_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ jobs:
sudo apt-get install pep8 python3-autopep8 python3-pep8 python-is-python3
- name: Check Code Format
run: |
autopep8 srunner/scenariomanager/*.py --in-place --max-line-length=120 --ignore=E731
autopep8 srunner/scenariomanager/scenarioatomics/*.py --in-place --max-line-length=120
autopep8 srunner/scenarios/*.py --in-place --max-line-length=120
autopep8 srunner/tools/*.py --in-place --max-line-length=120
autopep8 srunner/scenarioconfigs/*.py --in-place --max-line-length=120
autopep8 scenario_runner.py --in-place --max-line-length=120
autopep8 srunner/autoagents/*.py --in-place --max-line-length=120
git diff --quiet HEAD --; if [ ! $? -eq 0 ]; then echo "Code is not autopep8 compliant. Please run code_check_and_formatting.sh"; git diff HEAD --; exit 1; fi
uses: peter-evans/autopep8@v2
with:
args: --max-line-length=120 --ignore=E731 --recursive --in-place .

qualityJob:
name: Check Code Quality
Expand Down Expand Up @@ -58,4 +52,4 @@ jobs:
score=`pylint --rcfile=.pylintrc --disable=I srunner/tools | grep -i "rated at" | awk '{print $7}'`; if [ "$score" != "10.00/10" ]; then static_code_quality_passed=0; fi
score=`pylint --rcfile=.pylintrc --disable=I srunner/scenarioconfigs | grep -i "rated at" | awk '{print $7}'`; if [ "$score" != "10.00/10" ]; then static_code_quality_passed=0; fi
score=`pylint --rcfile=.pylintrc --disable=I scenario_runner.py | grep -i "rated at" | awk '{print $7}'`; if [ "$score" != "10.00/10" ]; then static_code_quality_passed=0; fi
if [ $static_code_quality_passed -eq 0 ]; then echo "Code is not pylint compliant. Please run code_check_and_formatting.sh"; exit 1; fi
if [ $static_code_quality_passed -eq 0 ]; then echo "Code is not pylint compliant. Please run code_check_and_formatting.sh"; exit 1; fi
4 changes: 4 additions & 0 deletions scenario_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@
from importlib.metadata import metadata

def get_carla_version():
"""get the version of the CARLA package
"""
return Version(metadata("carla")["Version"])
except ModuleNotFoundError:
# backport checking for older Python versions; module is deprecated
import pkg_resources

def get_carla_version():
"""same but for older Python versions
"""
return Version(pkg_resources.get_distribution("carla").version)

import carla
Expand Down
2 changes: 1 addition & 1 deletion srunner/tests/carla_mocks/carla.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def get_settings(self):

def get_map(self):
return self.map

def set_map(self, map):
self.map = map

Expand Down
3 changes: 2 additions & 1 deletion srunner/tools/openscenario_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,8 @@ def convert_maneuver_to_atomic(action, actor, actor_list, catalogs, config):
atomic = ActorDestroy(entity_ref_actor)
elif entity_action.find('AddEntityAction') is not None:
position = entity_action.find('AddEntityAction').find("Position")
actor_transform = OpenScenarioParser.convert_position_to_transform(position, config.other_actors + config.ego_vehicles)
actor_transform = OpenScenarioParser.convert_position_to_transform(
position, config.other_actors + config.ego_vehicles)
entity_ref_actor = None
for _actor in config.other_actors:
if _actor.rolename == entity_ref:
Expand Down

0 comments on commit 452e9e7

Please sign in to comment.