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

Add pylint configuration, fix linting issues, and update CI pipeline for Python #467

Merged
merged 51 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
45d1285
chore(pylint): add .pylintrc configuration file
kluge7 Sep 23, 2024
7727642
refactor: fix pylint warning W1510
kluge7 Sep 23, 2024
b17fd24
refactor: fix pylint warning C0116
kluge7 Sep 23, 2024
d6766cf
refactor: fix pylint warning C0411
kluge7 Sep 23, 2024
9f9cd12
refactor: fix pylint warning R1731
kluge7 Sep 23, 2024
47f38a0
refactor: fix pylint warning R1705
kluge7 Sep 23, 2024
9ba7724
refactor: fix pylint warning W1514
kluge7 Sep 23, 2024
90eacac
refactor: fix pylint warning C0200
kluge7 Sep 23, 2024
e4fb07f
refactor: fix pylint warning W0611
kluge7 Sep 23, 2024
d4e3331
refactor: fix pylint warning W0702
kluge7 Sep 23, 2024
8478f60
refactor: fix pylint warning C0121
kluge7 Sep 23, 2024
e49408b
refactor: fix pylint warning W0107
kluge7 Sep 23, 2024
f971a79
refactor: fix pylint warning R1714
kluge7 Sep 23, 2024
6953afc
refactor: fix pylint warning C0201
kluge7 Sep 23, 2024
3e24960
refactor: fix pylint warning C0303 and W0613
kluge7 Sep 23, 2024
73f7e1d
refactor: fix pylint warning W0621
kluge7 Sep 23, 2024
6349e1e
refactor: fix pylint warning R0402
kluge7 Sep 23, 2024
3296c3e
refactor: fix pylint warning W0212
kluge7 Sep 23, 2024
36bd73f
chore(pylint): update rule adjustments and formatting
kluge7 Sep 23, 2024
44f683e
style: format code with black
kluge7 Sep 23, 2024
5dae721
style: format imports with isort
kluge7 Sep 23, 2024
61a507c
ci: add isort and pylint to Python pipeline
kluge7 Sep 23, 2024
a0aa60e
Committing black-format changes
Sep 23, 2024
13c3e23
chore: add pyproject.toml for project configuration
kluge7 Sep 23, 2024
45e2919
ci: update order of pipeline jobs
kluge7 Sep 23, 2024
975ed60
ci: update pylint job and pylint rules
kluge7 Sep 23, 2024
154d2e6
ci: update which python versions pylint test
kluge7 Sep 23, 2024
fc9ebef
ci: update python pipeline to only run on pull_request
kluge7 Sep 23, 2024
002fb32
refactor: fix pylint warning C0103
kluge7 Sep 23, 2024
36699f4
chore: update linting and project configuration rules in .pylintrc an…
kluge7 Sep 23, 2024
d01b76b
Rename files to snake_case
kluge7 Sep 23, 2024
c5eff24
ci: add pipeline for grammar in comments
kluge7 Sep 24, 2024
d7cee00
refactor: fix spelling mistakes in comments
kluge7 Sep 24, 2024
399294c
ci: update job codespell_fix to continue on error
kluge7 Sep 24, 2024
369d7d6
refactor: fix spelling mistakes in comments
kluge7 Sep 24, 2024
cd305d5
ci: update pipeline codespell to only have one job
kluge7 Sep 24, 2024
377f8c1
refactor: fix variable naming issues and adjust imports as per review
kluge7 Sep 24, 2024
8497150
Committing codespell fixes
Sep 24, 2024
b01102a
refactor: spelling correction
Hallfred Sep 24, 2024
428ede3
ci: update CI file and job names for consistency
kluge7 Sep 24, 2024
f26643a
ci: update CI file for more clarity
kluge7 Sep 24, 2024
de9c3de
chore: add codespell configuration and ignore list
kluge7 Sep 24, 2024
99b8d20
chore: add type hints and return types
kluge7 Sep 25, 2024
6dc658a
ci: add mypy.ini for type checking configuration
kluge7 Sep 25, 2024
fd50092
ci: add mypy type checking workflow
kluge7 Sep 25, 2024
352e8ab
refactor: format code with black
kluge7 Sep 25, 2024
4a3e1c2
refactor: format all yaml files using prettier
kluge7 Sep 25, 2024
aad0bfc
ci: add pipeline for yaml formatting using prettier
kluge7 Sep 25, 2024
fd63bea
ci: update yaml formatting pipeline to run on pull request
kluge7 Sep 25, 2024
99c5646
refactor: remove deprecated typing
kluge7 Sep 27, 2024
bcd5cc4
refactor: fix import sorting
kluge7 Sep 27, 2024
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
1 change: 1 addition & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theses
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
# File containing words to ignore during the spell check.
ignore-words = .codespellignore

# Check file names as well.
check-filenames = true
28 changes: 0 additions & 28 deletions .github/workflows/black-formatter.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/clang-formatter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run clang-format Linter

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: "."
exclude: "./lib"
extensions: "h,cpp,c"
clangFormatVersion: 18
inplace: True
- uses: EndBug/add-and-commit@v9
with:
author_name: Clang Robot
author_email: [email protected]
message: "Committing clang-format changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/clang-formatter.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/codespell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: codespell

on: [pull_request]

jobs:
codespell:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install codespell
run: |
sudo apt-get update
sudo apt-get install -y codespell

- name: Run codespell to fix spelling mistakes
run: |
codespell -w .

- name: Commit codespell changes
uses: EndBug/add-and-commit@v9
with:
author_name: Codespell Robot
author_email: [email protected]
message: "Committing codespell fixes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 10 additions & 10 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish Docker image to ghcr

on:
push:
branches: [ development ]
branches: [development]

env:
REGISTRY: ghcr.io
Expand All @@ -18,32 +18,32 @@ jobs:
steps:
- name: Checkout own repository
uses: actions/checkout@v3

# vortex_msgs needs to be in the same location as the rest of the vortex-auv packages
- name: Checkout vortex_msgs
uses: actions/checkout@v3
with:
repository: 'vortexntnu/vortex-msgs'
path: './vortex-msgs'
repository: "vortexntnu/vortex-msgs"
path: "./vortex-msgs"
- name: Move vortex_msgs
run: mv ./vortex-msgs ../vortex-msgs
# robot_localization needs to be in the same location as the rest of the vortex-auv packages

# robot_localization needs to be in the same location as the rest of the vortex-auv packages
- name: Checkout robot_localization
uses: actions/checkout@v3
with:
repository: 'vortexntnu/robot_localization'
path: './robot_localization'
repository: "vortexntnu/robot_localization"
path: "./robot_localization"
- name: Move robot_localization
run: mv ./robot_localization ../robot_localization

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: mypy

on: [pull_request]

jobs:
mypy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install mypy
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip3 install mypy

- name: Run mypy type checking
run: |
mypy . --explicit-package-bases
68 changes: 68 additions & 0 deletions .github/workflows/python-format-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Python Format and Lint (isort, black, pylint)

on: [pull_request]

jobs:
isort:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Run isort to sort imports
uses: isort/isort-action@v1

- name: Commit isort changes
uses: EndBug/add-and-commit@v9
with:
author_name: Isort Robot
author_email: [email protected]
message: "Committing isort changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

black:
runs-on: ubuntu-latest
needs: isort

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Check files using the black formatter
uses: rickstaa/action-black@v1
id: action_black
with:
black_args: "."

- name: Commit black-format changes
uses: EndBug/add-and-commit@v9
with:
author_name: Black Robot
author_email: [email protected]
message: "Committing black-format changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pylint:
runs-on: ubuntu-latest
needs: black
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- 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: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
31 changes: 31 additions & 0 deletions .github/workflows/yaml-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Yaml Format (prettier)

on: [pull_request]

jobs:
prettier:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install Prettier
run: |
sudo npm install -g prettier

# Run Prettier to format all YAML files
- name: Run Prettier to format YAML files
run: |
prettier --write "**/*.yaml" "**/*.yml"

# Commit Prettier changes
- name: Commit Prettier changes
uses: EndBug/add-and-commit@v9
with:
author_name: Prettier Robot
author_email: [email protected]
message: "Committing Prettier formatting fixes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading