Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Oct 9, 2023
1 parent 756caa9 commit 92a87ae
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 43 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
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:

shellcheck:
name: Run shellcheck against shell scripts
runs-on: ubuntu-latest
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
65 changes: 65 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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
- 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 @@ -2,6 +2,7 @@ FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base

COPY rootfs/ /

# hadolint ignore=DL3008,DL3003,SC1091
RUN set -x && \
#
# Install libusb
Expand Down
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ It will provide BEAST protocol on TCP port `30005`.

## Environment Variables

| Environment Variable | `airspy_adsb`</br>option | Description | Default |
|----|----|----|----|
| `AIRSPY_ADSB_SERIAL` | `-s` | Device serial number | *unset* |
| `AIRSPY_ADSB_TIMEOUT` | `-t` | Aircraft timeout in seconds | `60` |
| `AIRSPY_ADSB_RF_GAIN` | `-g` | RF gain: `0` to `21` or `auto` | `auto` |
| `AIRSPY_ADSB_FEC_BITS` | `-f` | Forward Error Correction (FEC) bits | `1` |
| `AIRSPY_ADSB_PREAMBLE_FILTER` | `-e` | Preamble filter: `1` to `60` | `4` |
| `AIRSPY_ADSB_CPUTIME_TARGET` | `-C` | CPU processing time target (percentage): `5` to `95` | Disabled</br>*(adjusts preamble filter while running)*|
| `AIRSPY_ADSB_PREAMBLE_FILTER_MAX` | `-E` | Maximum preamble filter when using CPU target: `1` to `60` | `60` |
| `AIRSPY_ADSB_PREAMBLE_FILTER_NONCRC` | `-P` | Non-CRC Preamble filter: `1` to `$AIRSPY_ADSB_PREAMBLE_FILTER` | Disabled |
| `AIRSPY_ADSB_WHITELIST_THRESHOLD` | `-w` | Whitelist threshold: `1` to `20` | `5` |
| `AIRSPY_ADSB_MLAT_FREQ` | `-m` | MLAT frequency in MHz: `12`, `20` or `24` (Airspy R2 only) | *unset* |
| `AIRSPY_ADSB_VERBATIM_MODE` | `-n` | Set to `true` to enable Verbatim mode | *unset* |
| `AIRSPY_ADSB_DX_MODE` | `-x` | Set to `true` to enable DX mode | *unset* |
| `AIRSPY_ADSB_REDUCE_IF_BW` | `-r` | Set to `true` reduce the IF bandwidth to 4 MHz | *unset* |
| `AIRSPY_ADSB_RSSI_MODE` | `-R` | RSSI mode: `snr` (ref = 42 dB), `rms` (default: rms) | `rms` |
| `AIRSPY_ADSB_IGNORE_DF_TYPES` | `-D` | Ignore these DF types (comma separated list) | `24,25,26,27,28,29,30,31` |
| `AIRSPY_ADSB_BIAS_TEE` | `-b` | Set to `true` to enable Bias-Tee | *unset* |
| `AIRSPY_ADSB_BIT_PACKING` | `-p` | Set to `true` to enable Bit Packing | *unset* |
| `AIRSPY_ADSB_VERBOSE` | `-v` | Enable Verbose mode | *unset* |
| `AIRSPY_ADSB_STATS` | `-S` | Set to `true` to enable statistics in `/run/airspy_adsb` (this needs to be shared with a `tar1090` instance) | *unset* |
| `AIRSPY_ADSB_ARCH` | N/A | Forces a specific architecture binary. Supports `arm64`, `armv7`, `arm`, `nehalem`, `x86_64` or `i386`. If unset, will auto-detect. | *unset* |
| Environment Variable | `airspy_adsb`</br>option | Description | Default |
| ------------------------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| `AIRSPY_ADSB_SERIAL` | `-s` | Device serial number | _unset_ |
| `AIRSPY_ADSB_TIMEOUT` | `-t` | Aircraft timeout in seconds | `60` |
| `AIRSPY_ADSB_RF_GAIN` | `-g` | RF gain: `0` to `21` or `auto` | `auto` |
| `AIRSPY_ADSB_FEC_BITS` | `-f` | Forward Error Correction (FEC) bits | `1` |
| `AIRSPY_ADSB_PREAMBLE_FILTER` | `-e` | Preamble filter: `1` to `60` | `4` |
| `AIRSPY_ADSB_CPUTIME_TARGET` | `-C` | CPU processing time target (percentage): `5` to `95` | Disabled</br>_(adjusts preamble filter while running)_ |
| `AIRSPY_ADSB_PREAMBLE_FILTER_MAX` | `-E` | Maximum preamble filter when using CPU target: `1` to `60` | `60` |
| `AIRSPY_ADSB_PREAMBLE_FILTER_NONCRC` | `-P` | Non-CRC Preamble filter: `1` to `$AIRSPY_ADSB_PREAMBLE_FILTER` | Disabled |
| `AIRSPY_ADSB_WHITELIST_THRESHOLD` | `-w` | Whitelist threshold: `1` to `20` | `5` |
| `AIRSPY_ADSB_MLAT_FREQ` | `-m` | MLAT frequency in MHz: `12`, `20` or `24` (Airspy R2 only) | _unset_ |
| `AIRSPY_ADSB_VERBATIM_MODE` | `-n` | Set to `true` to enable Verbatim mode | _unset_ |
| `AIRSPY_ADSB_DX_MODE` | `-x` | Set to `true` to enable DX mode | _unset_ |
| `AIRSPY_ADSB_REDUCE_IF_BW` | `-r` | Set to `true` reduce the IF bandwidth to 4 MHz | _unset_ |
| `AIRSPY_ADSB_RSSI_MODE` | `-R` | RSSI mode: `snr` (ref = 42 dB), `rms` (default: rms) | `rms` |
| `AIRSPY_ADSB_IGNORE_DF_TYPES` | `-D` | Ignore these DF types (comma separated list) | `24,25,26,27,28,29,30,31` |
| `AIRSPY_ADSB_BIAS_TEE` | `-b` | Set to `true` to enable Bias-Tee | _unset_ |
| `AIRSPY_ADSB_BIT_PACKING` | `-p` | Set to `true` to enable Bit Packing | _unset_ |
| `AIRSPY_ADSB_VERBOSE` | `-v` | Enable Verbose mode | _unset_ |
| `AIRSPY_ADSB_STATS` | `-S` | Set to `true` to enable statistics in `/run/airspy_adsb` (this needs to be shared with a `tar1090` instance) | _unset_ |
| `AIRSPY_ADSB_ARCH` | N/A | Forces a specific architecture binary. Supports `arm64`, `armv7`, `arm`, `nehalem`, `x86_64` or `i386`. If unset, will auto-detect. | _unset_ |

## Using with `readsb`

```yaml
version: '3.8'
version: "3.8"

volumes:
readsbpb_rrd:
Expand Down
8 changes: 4 additions & 4 deletions rootfs/etc/s6-overlay/scripts/airspy_adsb
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ if [[ -z "$AIRSPY_ADSB_ARCH" ]]; then

elif /usr/local/bin/airspy_adsb.i386 -h > /dev/null 2>&1; then
AIRSPY_ADSB_ARCH="i386"

else
>&2 echo "[airspy_adsb] ERROR: Unsupported architecture: $(uname -m)!"
sleep infinity
sleep infinity
fi
fi

Expand All @@ -147,13 +147,13 @@ AIRSPY_ADSB_BIN="/usr/local/bin/airspy_adsb.${AIRSPY_ADSB_ARCH}"
# Ensure binary exists
if [[ ! -x "$AIRSPY_ADSB_BIN" ]]; then
>&2 echo "[airspy_adsb] ERROR: Executable binary not found for architecture: $AIRSPY_ADSB_ARCH!"
sleep infinity
sleep infinity
fi

# Ensure binary runnable
if ! "$AIRSPY_ADSB_BIN" -h > /dev/null 2>&1; then
>&2 echo "[airspy_adsb] ERROR: Executable $AIRSPY_ADSB_ARCH binary not supported on $(uname -m) architecture!"
sleep infinity
sleep infinity
fi

# Execute binary with arguments prepared above
Expand Down

0 comments on commit 92a87ae

Please sign in to comment.