Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add linting and CI workflow #4

Merged
merged 1 commit into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
open-pull-requests-limit: 10
9 changes: 9 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
change-template: "- #$NUMBER - $TITLE (@$AUTHOR)"
categories:
- title: "⚠ Breaking Changes"
labels:
- "breaking change"
template: |
## What’s Changed

$CHANGES
15 changes: 15 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release Drafter

on:
push:
branches:
- main

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will install Python dependencies, run tests and lint
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"

steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.3.1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_lint.txt
- name: Lint
run: pre-commit run
101 changes: 101 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Hide sublime text stuff
*.sublime-project
*.sublime-workspace

# Hide some OS X stuff
.DS_Store
.AppleDouble
.LSOverride
Icon

# Thumbnails
._*

# IntelliJ IDEA
.idea
*.iml

# pytest
.pytest_cache
.cache

# GITHUB Proposed Python stuff:
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
pip-wheel-metadata

# Logs
*.log
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
coverage.xml
nosetests.xml
htmlcov/
test-reports/
test-results.xml
test-output.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

.python-version

# emacs auto backups
*~
*#
*.orig

# venv stuff
pyvenv.cfg
pip-selfcheck.json
venv
.venv
Pipfile*
share/*
Scripts/

# vimmy stuff
*.swp
*.swo
tags
ctags.tmp

# vagrant stuff
virtualization/vagrant/setup_done
virtualization/vagrant/.vagrant
virtualization/vagrant/config

# Visual Studio Code
.vscode/*
!.vscode/cSpell.json
!.vscode/extensions.json
!.vscode/tasks.json

# Typing
.mypy_cache
48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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-docstring-first
- id: check-yaml
- id: debug-statements
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
args:
- --max-line-length=500
- --ignore=E203,E266,E501,W503
- --max-complexity=18
- --select=B,C,E,F,W,T4,B9
- repo: https://github.com/ambv/black
rev: 21.12b0
hooks:
- id: black
language_version: python3
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: ['--py39-plus']
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
args:
- --multi-line=3
- --trailing-comma
- --force-grid-wrap=0
- --use-parentheses
- --line-width=88
- -p=homeassistant
- --force-sort-within-sections
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.930'
hooks:
- id: mypy
27 changes: 27 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[MASTER]
ignore=tests
# Use a conservative default here; 2 should speed up most setups and not hurt
# any too bad. Override on command line as appropriate.
jobs=2
persistent=no

[BASIC]
good-names=id,i,j,k,ex,Run,_,fp
max-attributes=15

[MESSAGES CONTROL]
# Reasons disabled:
# too-many-* - are not enforced for the sake of readability
# too-few-* - same as too-many-*
disable=
too-few-public-methods,
too-many-arguments,
too-many-public-methods,
too-many-instance-attributes,
too-many-branches

[REPORTS]
score=no

[FORMAT]
expected-line-ending-format=LF
7 changes: 7 additions & 0 deletions requirements_lint.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
black==21.12b0
flake8==4.0.1
isort==5.10.1
mypy==0.930
pre-commit==2.16.0
pydocstyle==6.1.1
pylint==2.12.2