add issue templates, ci linting and update pre-commit

This commit is contained in:
Ivan Schaller 2024-02-20 08:34:56 +01:00
parent 35c069efe9
commit 6aeda2c48b
7 changed files with 113 additions and 36 deletions

View File

@ -1,14 +0,0 @@
name: check code
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
check-code:
uses: actions/workflows/.gitea/workflows/check_python_hatch.yml@master
with:
run-tests: false

35
.github/issue_template/bug_report.md vendored Normal file
View File

@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help improve the tool
title: "[BUG] <short summary>"
labels: bug
assignees: olofvndrhr
---
**System info (please complete the following information):**
- Host: [e.g. Linux/Debian or Docker]
- `octodns-netbox-dns` version [e.g. v2.1.5]
- `netbox-dns` version [e.g. v2.1.5]
- Netbox version [e.g. v2.1.5]
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE] <short summary>"
labels: feature-request
assignees: olofvndrhr
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

28
.github/workflows/check_code.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: check code
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
check-code:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: install hatch
run: pip install -U hatch
- name: test codestyle
run: hatch run lint:style
- name: test typing
run: hatch run lint:typing

View File

@ -1,5 +0,0 @@
#!/bin/env bash
set -euxo pipefail
just format

View File

@ -6,7 +6,7 @@ set shell := ["bash", "-uc"]
set dotenv-load
show_receipts:
@just --list
just --list
show_system_info:
@echo "=================================="
@ -18,34 +18,41 @@ show_system_info:
@echo "=================================="
setup:
@asdf install
@lefthook install
asdf install
lefthook install
create_venv:
@echo "creating venv"
@python3 -m pip install --upgrade pip setuptools wheel
@python3 -m venv venv
python3 -m pip install --upgrade pip setuptools wheel
python3 -m venv venv
install_deps:
@echo "installing dependencies"
@python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
@pip3 install -r /tmp/requirements.txt
python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
pip3 install -r /tmp/requirements.txt
install_deps_dev:
@echo "installing dev dependencies"
@python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
@python3 -m hatch dep show requirements --env-only >> /tmp/requirements.txt
@pip3 install -r /tmp/requirements.txt
python3 -m hatch dep show requirements --project-only > /tmp/requirements.txt
python3 -m hatch dep show requirements --env-only >> /tmp/requirements.txt
pip3 install -r /tmp/requirements.txt
create_reqs:
@echo "creating requirements"
@pipreqs --force --savepath requirements.txt src/octodns_netbox_dns
pipreqs --force --savepath requirements.txt src/octodns_netbox_dns
lint:
just show_system_info
@hatch run lint:style
@hatch run lint:typing
hatch run lint:style
hatch run lint:typing
format:
just show_system_info
@hatch run lint:fmt
hatch run lint:fmt
check:
just format
just lint
build:
hatch build --clean

View File

@ -2,7 +2,13 @@ colors: true
no_tty: false
pre-commit:
scripts:
"format.sh":
commands:
01_ruff_check:
stage_fixed: true
runner: bash
glob: "*.py"
run: ruff check --fix-only --exit-zero --silent {all_files}
02_ruff_format:
stage_fixed: true
glob: "*.py"
run: ruff format {all_files}