Skip to content

Conversation

@ConnorNeed
Copy link
Member

Made the python linting more strict.

Behaviour should stay the same.

No rush on the review. I know its exam season. This was me looking for some mindless distraction from exam stress.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements stricter Python linting by switching from an allowlist to a blocklist approach in .pylintrc. The changes include numerous code quality improvements across the codebase: import reorganization following PEP 8 conventions, removal of unnecessary f-strings, conversion of instance methods to static methods where appropriate, simplification of control flow structures, addition of UTF-8 encoding to file operations, and correction of None comparisons to use identity operators.

Key Changes:

  • Modified .pylintrc to enable most pylint checks with a blocklist of specific rules to disable
  • Reorganized imports across 20+ files to follow standard library → third-party → local package ordering
  • Improved code quality with static method decorators, proper None comparisons, exception chaining, and UTF-8 encoding specifications

Reviewed changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.pylintrc Changed from allowlist (enable= specific checks) to blocklist (enable=all with disable= exceptions) for stricter linting
src/Nav/navigation/launch/traversability_gridmap.launch.py Removed unnecessary f-string from static log message
src/Nav/navigation/launch/ouster.launch.py Reorganized imports following PEP 8 ordering (stdlib, third-party, local)
src/Nav/nav_commanders/nav_commanders/nav_to_gps_coords.py Reorganized imports, converted instance variables to local variables in method scope, removed unused cleanup() call
src/Nav/nav_commanders/nav_commanders/nav_to_gps_aruco.py Reorganized imports, simplified control flow (elif chains to early returns), added @staticmethod decorator, improved error handling structure
src/Nav/nav_commanders/nav_commanders/incremental_gps_commander.py Reorganized imports, added @staticmethod decorator, changed elif to if for independent state checks
src/Nav/nav_commanders/known_gps_coords/send_gps_command.py Added UTF-8 encoding to file open operation
src/Nav/localization/localization/republish_odometry.py Reorganized imports following PEP 8 ordering
src/Nav/localization/localization/lidar_mask_tool.py Reorganized imports, moved PointField import to top, removed unnecessary f-string
src/Nav/localization/launch/rtabmap.launch.py Reorganized imports following PEP 8 ordering with blank line separation
src/Nav/localization/launch/localization.launch.py Reorganized imports following PEP 8 ordering
src/Nav/localization/launch/ekf.launch.py Reorganized imports following PEP 8 ordering
src/Nav/localization/launch/description.launch.py Added UTF-8 encoding to file open operation
src/Nav/gps/gps/rtcm_pub_node.py Removed destroy_node() override (potential resource management issue)
src/Nav/gps/gps/heading_pub_node.py Added @staticmethod decorator to quaternion_from_euler method
src/Nav/cprt_gridmap_filters/scripts/visualize_decay_rate.py Removed unnecessary f-string from label with only static text
src/Nav/cprt_gridmap_filters/scripts/calculate_decay_rate.py Added type hints, moved imports to top, removed unnecessary else clause (introduced bug in formula)
src/HW-Devices/servo_pkg/servo_pkg/pi_Servo.py Changed elif to if for independent condition checks
src/HW-Devices/servo_pkg/servo_pkg/maestro.py Simplified boolean return logic by storing value and returning comparison
src/HW-Devices/servo_pkg/servo_pkg/i2c_Servo.py Changed None comparisons to use 'is not None', corrected port indexing (introduced potential off-by-one bug)
src/HW-Devices/science_sensors/science_sensors/stellarnet_demo.py Removed trailing whitespace
src/HW-Devices/science_sensors/science_sensors/raman.py Removed extra blank line and trailing whitespace
src/HW-Devices/science_sensors/science_sensors/pi_gpio_reader.py Changed import style from 'import RPi.GPIO as GPIO' to 'from RPi import GPIO'
src/HW-Devices/science_sensors/science_sensors/pi_gpio_controller.py Changed import style from 'import RPi.GPIO as GPIO' to 'from RPi import GPIO'
src/HW-Devices/science_sensors/science_sensors/gas_sensor.py Added exception chaining with 'from e' to preserve traceback
src/Bringup/launch/video_streaming.launch.py Reorganized imports following PEP 8 ordering
src/Bringup/launch/drive.launch.py Reorganized imports following PEP 8 ordering
src/Bringup/launch/core.launch.py Reorganized imports following PEP 8 ordering
src/Bringup/launch/basestation.launch.py Reorganized imports following PEP 8 ordering
src/Bringup/launch/arm.launch.py Reorganized imports following PEP 8 ordering
src/Arm/arm_srdf/launch/servo.launch.py Added UTF-8 encoding to file open operation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants