Skip to content
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

Create pylint.yml #19

Merged
merged 36 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3ca547e
Create pylint.yml
christianvluu Sep 20, 2023
3ae9008
Update pylint.yml
christianvluu Sep 20, 2023
f0c150e
Update pylint.yml
christianvluu Sep 20, 2023
11ed11c
Update pylint.yml
christianvluu Sep 21, 2023
8b88d99
Create .pylintrc
christianvluu Sep 21, 2023
5c5fefb
Update pylint.yml
christianvluu Sep 21, 2023
2b0b153
Update pylint.yml
christianvluu Sep 21, 2023
dee84ae
Update pylint.yml
christianvluu Sep 21, 2023
ceb6a24
Update pylint.yml
christianvluu Sep 21, 2023
e33281d
Update pylint.yml
christianvluu Sep 21, 2023
44376ef
Update pylint.yml
christianvluu Sep 21, 2023
c01437d
Update .pylintrc
christianvluu Sep 22, 2023
2fc2c65
newline
christianvluu Sep 22, 2023
5cfce5c
update pylintrc
christianvluu Sep 22, 2023
5c297fc
Update .pylintrc
christianvluu Nov 19, 2023
c795535
Update pylint.yml
christianvluu Nov 19, 2023
d6a9c42
Update pylint.yml
christianvluu Nov 19, 2023
475ca9f
Update pylint.yml
christianvluu Nov 19, 2023
be89bcf
Update pylint.yml
christianvluu Nov 19, 2023
ca460f5
Erroneous comment removed
christianvluu Nov 19, 2023
6c6673d
Update pylint.yml
christianvluu Nov 19, 2023
0e35ea5
Update pylint.yml
christianvluu Nov 19, 2023
23f1d63
Update pylint.yml
christianvluu Nov 19, 2023
85a621f
Merge branch 'main' into actions
christianvluu Nov 19, 2023
5bc7172
Update pylint.yml
christianvluu Nov 19, 2023
089ca99
Update pylint.yml
christianvluu Nov 19, 2023
dfdb9b0
Update pylint.yml
christianvluu Nov 19, 2023
ae217ee
Update pylint.yml
christianvluu Nov 19, 2023
bdec91d
Update pylint.yml
christianvluu Nov 19, 2023
ab2abe4
Force fail?
christianvluu Nov 19, 2023
c3cb951
Update pylint.yml
christianvluu Nov 19, 2023
5ebac1b
Update .pylintrc
christianvluu Nov 19, 2023
99d7b0c
Update pylint.yml
christianvluu Nov 19, 2023
752c93e
Update telematics.py
christianvluu Nov 19, 2023
4cdf6b1
Update telematics.py
christianvluu Nov 19, 2023
d78be5f
Update telematics.py
christianvluu Nov 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/.pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[MESSAGES CONTROL]

disable=all

enable=
bad-indentation,
trailing-whitespace,
wrong-import-order,
unused-variable,
unused-import
35 changes: 35 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Getting changed Python files and Analysing the code with pylint
run: |
git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
echo CI_COMMIT_SHA=${GITHUB_SHA}
tmp_files=$(git diff --name-only origin/main ${CI_COMMIT_SHA})
echo "Changed files are $tmp_files"
if [ -z "$(echo "$tmp_files" | grep "\.py")" ]; then exit 0; else echo "Python files are found"; fi
tmp_pfiles=$(echo "$tmp_files" | grep "\.py")
echo "Python files are $tmp_pfiles"
if [[ -z "$tmp_pfiles" ]]; then
echo "No files to lint"
else
echo "Running Linter!"
pylint --rc-file=/home/runner/work/RoboBuggy2/RoboBuggy2/.github/workflows/.pylintrc $tmp_pfiles
fi
25 changes: 10 additions & 15 deletions rb_ws/src/buggy/scripts/visualization/telematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ def __init__(self):
self.gnss1_fixinfo_publisher = rospy.Publisher("/gnss1/fix_info_republished", String, queue_size=10)
self.gnss1_fixinfo_int_publisher = rospy.Publisher("/gnss1/fix_info_republished_int", Int8, queue_size=10)
self.gnss1_fixinfo_subscriber = rospy.Subscriber("/gnss1/fix_info", GNSSFixInfo, self.republish_fixinfo, (self.gnss1_fixinfo_publisher, self.gnss1_fixinfo_int_publisher))

self.gnss2_fixinfo_publisher = rospy.Publisher("/gnss2/fix_info_republished", String, queue_size=10)
self.gnss2_fixinfo_int_publisher = rospy.Publisher("/gnss2/fix_info_republished_int", Int8, queue_size=10)
self.gnss2_fixinfo_subscriber = rospy.Subscriber("/gnss2/fix_info", GNSSFixInfo, self.republish_fixinfo, (self.gnss2_fixinfo_publisher, self.gnss2_fixinfo_int_publisher))

def convert_odometry_to_navsatfix(self, msg):
"""Convert Odometry-type to NavSatFix-type for plotting on Foxglove
x`
Args:
msg (Odometry): odometry as per INS
"""
Expand All @@ -48,7 +47,7 @@ def convert_odometry_to_navsatfix(self, msg):
new_msg.longitude = long
new_msg.altitude = down
self.odom_publisher.publish(new_msg)

def convert_navsatfix_to_pose_covariance(self, msg, publishers):
"""Convert NavSatFix-type and related covariance matrix to Pose-type and array
respectively for easy visualization in Foxglove.
Expand All @@ -70,14 +69,14 @@ def convert_navsatfix_to_pose_covariance(self, msg, publishers):
round(msg.position_covariance[4], 4),
round(msg.position_covariance[8], 4)]
publishers[1].publish(covariance)

def republish_fixinfo(self, msg, publishers):
"""
convert gnss/fixinfo to a string for visualization in foxglove
"""
fix_type = msg.fix_type
fix_string = "fix type: "

if (fix_type == 0):
fix_string += "FIX_3D"
elif (fix_type == 1):
Expand All @@ -92,17 +91,13 @@ def republish_fixinfo(self, msg, publishers):
fix_string += "FIX_RTK_FLOAT"
else:
fix_string += "FIX_RTK_FIXED"
fix_string += "\nsbas_used: " + str(msg.sbas_used)

fix_string += "\nsbas_used: " + str(msg.sbas_used)
fix_string += "\ndngss_used: " + str(msg.dngss_used)
publishers[0].publish(fix_string)
publishers[1].publish(fix_type)




if __name__ == "__main__":
rospy.init_node("telematics")
telem = Telematics()
rospy.spin()

rospy.init_node("telematics")
telem = Telematics()
rospy.spin()