Skip to content

Commit

Permalink
linting / precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Oct 12, 2023
1 parent 6116f69 commit 7c8d6b1
Show file tree
Hide file tree
Showing 14 changed files with 231 additions and 145 deletions.
1 change: 1 addition & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
crate
9 changes: 4 additions & 5 deletions .github/workflows/cancel_dupes.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
---

# Cancels duplicate github actions when superseded

name: Cancelling Duplicates
on:
workflow_run:
workflows:
- 'Pull Request'
- 'Deploy'
- 'Linting (Non-Image)'
types: ['requested']
- "Pull Request"
- "Deploy"
- "Linting (Non-Image)"
types: ["requested"]

jobs:
cancel-duplicate-workflow-runs:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/check_versions.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

name: Check upstream versions

on:
Expand All @@ -8,7 +7,6 @@ on:
- cron: "0 12 * * *"

jobs:

version_in_container:
name: Check version in 'latest' image
runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ on:
branches:
- main
paths:
- 'Dockerfile'
- "Dockerfile"

jobs:

hadolint:
name: Run hadolint against docker files
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
- main
# only run these if markdown files are updated
paths:
- '**.md'
- '**.MD'
- "**.md"
- "**.MD"

jobs:
markdownlint:
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ on:
- main
# Don't trigger if it's just a documentation update
paths-ignore:
- '**.md'
- '**.MD'
- '**.yml'
- 'LICENSE'
- '.gitattributes'
- '.gitignore'
- '.dockerignore'
- "**.md"
- "**.MD"
- "**.yml"
- "LICENSE"
- ".gitattributes"
- ".gitignore"
- ".dockerignore"

jobs:

test-build:
name: Test
uses: sdr-enthusiasts/common-github-workflows/.github/workflows/build_and_push_image.yml@main
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/pre-commit-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Update pre-commit hooks

on:
workflow_dispatch:
schedule:
- cron: 0 0 * * *

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: vrslev/[email protected]
- uses: peter-evans/create-pull-request@v5
with:
branch: pre-commit-autoupdate
title: "chore(deps): Update pre-commit hooks"
commit-message: "chore(deps): Update pre-commit hooks"
body: Update pre-commit hooks
labels: dependencies
delete-branch: True
2 changes: 1 addition & 1 deletion .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- main
# only run when yaml files are updated
paths:
- '**.yml'
- "**.yml"

jobs:
yamllint:
Expand Down
66 changes: 66 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
repos:
# lint yaml, line and whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: requirements-txt-fixer
- id: mixed-line-ending
- id: check-executables-have-shebangs
exclude: fa_services.tcl
- id: check-shebang-scripts-are-executable

# lint the dockerfiles
- repo: https://github.com/hadolint/hadolint
rev: v2.12.1-beta
hooks:
- id: hadolint

# prettier
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3" # Use the sha / tag you want to point at
hooks:
- id: prettier
types_or: [file, bash, sh, javascript, jsx, ts, tsx]
additional_dependencies:
- [email protected]
exclude: ^(Dockerfile*)

- repo: https://github.com/codespell-project/codespell.git
rev: "v2.2.5" # Use the sha / tag you want to point at
hooks:
- id: codespell
types: [text]
args: [--ignore-words=.dictionary.txt]
exclude: ^(Dockerfile*)

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.27.0
hooks:
- id: check-github-actions
- id: check-github-workflows

- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check

# lint python formatting
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: "6.1.0" # pick a git hash / tag to point to
hooks:
- id: flake8
args: ["--extend-ignore=W503,W504,E501"]
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]

COPY rootfs/ /

# hadolint ignore=DL3008,SC2086,SC2039,SC2068
RUN set -x && \
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
Expand Down
4 changes: 2 additions & 2 deletions README.DockerHub.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ For more information on what PiAware is, see here: [FlightAware - PiAware](https

This container can operate in "net only" mode and pull ADS-B Mode-S & UAT data from another host/container. **This is the recommended way of deploying the container**, and I'd humbly suggest [`sdr-enthusiasts/docker-readsb-protobuf`](https://github.com/sdr-enthusiasts/docker-readsb-protobuf) and [`sdr-enthusiasts/docker-dump978`](https://github.com/sdr-enthusiasts/docker-dump978) (if you live in an area that uses UAT).

*Note:* `bladerf`/`hackrf`/`limesdr`/`radarcape` - Support for these is compiled in, but I need to complete the wrapper/helper scripts. I don't have access to these devices. If you do, and would be willing to test, please get in touch with me!
_Note:_ `bladerf`/`hackrf`/`limesdr`/`radarcape` - Support for these is compiled in, but I need to complete the wrapper/helper scripts. I don't have access to these devices. If you do, and would be willing to test, please get in touch with me!

## Documentation

Please [read this container's detailed and thorough documentation in the GitHub repository.](https://github.com/sdr-enthusiasts/docker-piaware/blob/main/README.md)
Please [read this container's detailed and thorough documentation in the GitHub repository.](https://github.com/sdr-enthusiasts/docker-piaware/blob/main/README.md)
Loading

0 comments on commit 7c8d6b1

Please sign in to comment.