Skip to content

Commit

Permalink
Deduplicate Linter Workflows and make it smoother (#71)
Browse files Browse the repository at this point in the history
* giving the linter a name

* trying to make the check a requirement

* actually write the copyright

* dedup linter

* specify to run on all prs to main

* test linter

* more testing

* Fix code style issues with Autopep8

* Fix code style issues with clang_format

* fix auto-linter locking up ci

* Fix code style issues with clang_format

* testing

* testing with different token

* Fix code style issues with clang_format

* adding auto-lint remove label script

* capitalization

* final test

* whoops

* rename

* switch around ordering

* maybe now?

* Fix code style issues with Autopep8

* Fix code style issues with clang_format

---------

Co-authored-by: WATonomousAdmin <[email protected]>
  • Loading branch information
Edwardius and WATonomousAdmin authored Feb 7, 2024
1 parent 5bcae75 commit 74f3b17
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 47 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/linting_auto.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: Monorepo Code Linting - Auto Linter

on:
push:
branches:
- main
pull_request:
branches:
- main
types:
- labeled
- synchronize

jobs:
run-linters:
Expand All @@ -13,6 +19,8 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GHCR_PWD }}

- name: Set up Python
uses: actions/setup-python@v1
Expand All @@ -23,13 +31,24 @@ jobs:
run: pip install autopep8 clang-format

- name: Run linters, make changes
continue-on-error: true
uses: WATonomous/wato-lint-action@v1
with:
git_name: WATonomousAdmin
git_email: [email protected]
auto_fix: ${{ contains(github.event.pull_request.labels.*.name, 'auto-lint') }}
Autopep8: true
Autopep8_args: "--max-line-length 100"
clang_format: true
clang_format_auto_fix: ${{ contains(github.event.pull_request.labels.*.name, 'auto-lint') }}
clang_format_args: "-style=file"

- name: Remove 'auto-lint' label to stop possible inf loop
if: contains(github.event.pull_request.labels.*.name, 'auto-lint')
uses: actions/github-script@v6
with:
script: |
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: 'auto-lint'
});
35 changes: 0 additions & 35 deletions .github/workflows/linting_check.yml

This file was deleted.

14 changes: 6 additions & 8 deletions src/samples/python/aggregator/aggregator/aggregator_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ def __init__(self):
self.__aggregator = AggregatorCore(node_start_time)

# Initialize ROS2 Constructs
self.unfiltered_subcriber = self.create_subscription(Unfiltered,
'/unfiltered_topic',
self.unfiltered_callback,
10)
self.filtered_subscriber = self.create_subscription(FilteredArray,
'/filtered_topic',
self.filtered_callback,
10)
self.unfiltered_subcriber = self.create_subscription(
Unfiltered, '/unfiltered_topic',
self.unfiltered_callback, 10)
self.filtered_subscriber = self.create_subscription(
FilteredArray, '/filtered_topic',
self.filtered_callback, 10)

def unfiltered_callback(self, msg):
self.__aggregator.update_raw_freq()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def __init__(self):

# Initialize ROS2 Constructs
self.publisher_ = self.create_publisher(FilteredArray, '/filtered_topic', 10)
self.subscription = self.create_subscription(Unfiltered, '/unfiltered_topic',
self.unfiltered_callback, 10)
self.subscription = self.create_subscription(
Unfiltered, '/unfiltered_topic', self.unfiltered_callback, 10)

self.__filtered_array_packets = []

Expand Down

0 comments on commit 74f3b17

Please sign in to comment.