Skip to content

Commit

Permalink
Add pre-commit hooks and CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
ch3ck committed Feb 6, 2022
1 parent 11cd90e commit 000a8bd
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
ci:
autofix_prs: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-case-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii, --no-sort-keys]
- id: check-ast
- id: debug-statements
- id: check-docstring-first
- id: mixed-line-ending
args:
- --fix=lf

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: [--py36-plus]
exclude: '^(install|get)-poetry.py$'

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: "isort (python)"
types: [python]

- repo: https://github.com/psf/black
rev: 22.1.0
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8

- repo: local
hooks:
# - id: mypy
# name: Check mypy static types match
# entry: poetry run python -m mypy protect_archivers
# pass_filenames: false
# language: system
# types: [python]
- id: pytest
name: Check pytest unit tests pass
entry: poetry run python -m pytest -vv
pass_filenames: false
language: system
types: [python]
16 changes: 16 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- id: poetry-check
name: poetry-check
description: run poetry check to validate config
entry: poetry check
language: python
language_version: python3
pass_filenames: false
files: ^pyproject.toml$

- id: poetry-lock
name: poetry-lock
description: run poetry lock to update lock file
entry: poetry lock
language: python
language_version: python3
pass_filenames: false
14 changes: 14 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,26 @@ $ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-po
$ source $HOME/.poetry/env
```

OR

```bash
$ pip install -U poetry
$ source $HOME/.poetry/env
```

### Clone the source repository
```bash
$ git clone https://github.com/unifi-toolbox/unifi-protect-video-downloader
$ cd unifi-protect-video-downloader
```

### Install pre-commit hooks
```bash
$ pip install pre-commit
$ pre-commit install
$ pre-commit run --all # first run
```

### Spawn a shell within the virtual environment
If no virtual environment exists yet, a new one will be created automatically.
```bash
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

0 comments on commit 000a8bd

Please sign in to comment.