From 68350b8f3e2218f8ef711a8111b9b1f3dc4395a0 Mon Sep 17 00:00:00 2001 From: vlebourl Date: Fri, 1 Apr 2022 15:04:42 +0200 Subject: [PATCH] add missing files from previous repo --- .gitattributes | 2 + .github/pr-labeler.yml | 6 +++ .github/release-drafter.yml | 23 ++++++++++ .github/workflows/hassfest.yml | 13 ++++++ .github/workflows/linters.yml | 12 +++++ .github/workflows/matchers/python.json | 18 ++++++++ .github/workflows/pr-labeler.yml | 12 +++++ .github/workflows/release-drafter.yml | 15 +++++++ .github/workflows/stale.yml | 27 ++++++++++++ .github/workflows/validate.yml | 17 +++++++ .gitignore | 4 ++ .gitpod.Dockerfile | 8 ++++ .gitpod.yml | 29 ++++++++++++ .pre-commit-config.yaml | 40 +++++++++++++++++ .yamllint | 61 ++++++++++++++++++++++++++ 15 files changed, 287 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/pr-labeler.yml create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/hassfest.yml create mode 100644 .github/workflows/linters.yml create mode 100644 .github/workflows/matchers/python.json create mode 100644 .github/workflows/pr-labeler.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/stale.yml create mode 100644 .github/workflows/validate.yml create mode 100644 .gitignore create mode 100644 .gitpod.Dockerfile create mode 100644 .gitpod.yml create mode 100644 .pre-commit-config.yaml create mode 100644 .yamllint diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 0000000..098bd7b --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,6 @@ +feature: ['feature/*', 'feat/*'] +enhancement: enhancement/* +bug: fix/* +breaking: breaking/* +documentation: doc/* +backport: '*backport*' diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..9dd34e8 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,23 @@ +name-template: 'v$NEXT_PATCH_VERSION' +tag-template: 'v$NEXT_PATCH_VERSION' +exclude-labels: + - 'Meta: Exclude From Changelog' + - 'auto-changelog' +categories: + - title: 'โคฝ Backport from Core' + label: 'backport' + - title: 'โš ๏ธ Breaking changes' + label: 'breaking' + - title: '๐Ÿš€ Features' + label: 'feature' + - title: 'โœจ Enhancement' + label: 'enhancement' + - title: '๐Ÿ“˜ Documentation' + label: 'documentation' + - title: '๐Ÿ› Bug Fixes' + label: 'bug' +template: | + ## What's changed + $CHANGES + ## Contributors to this release + $CONTRIBUTORS diff --git a/.github/workflows/hassfest.yml b/.github/workflows/hassfest.yml new file mode 100644 index 0000000..16c617f --- /dev/null +++ b/.github/workflows/hassfest.yml @@ -0,0 +1,13 @@ +name: Validate with hassfest + +on: + pull_request: + schedule: + - cron: '0 0 * * *' + +jobs: + validate: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v2 + - uses: home-assistant/actions/hassfest@master diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..f6d86ed --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,12 @@ +name: Linters (flake8, black, isort) + +on: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.0 diff --git a/.github/workflows/matchers/python.json b/.github/workflows/matchers/python.json new file mode 100644 index 0000000..1052a1c --- /dev/null +++ b/.github/workflows/matchers/python.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "owner": "python", + "pattern": [ + { + "regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$", + "file": 1, + "line": 2 + }, + { + "regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$", + "message": 2 + } + ] + } + ] +} \ No newline at end of file diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 0000000..70627d0 --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,12 @@ +name: PR Labeler +on: + pull_request_target: + types: [opened] + +jobs: + pr-labeler: + runs-on: ubuntu-latest + steps: + - uses: TimonVS/pr-labeler-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..a0683aa --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,15 @@ +name: Release Drafter + +on: + push: + branches: + - main + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - name: Update release draft + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..dc5b4f3 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,27 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: > + 'There hasn't been any activity on this issue recently. Is this issue still present? + + Please make sure to update to the latest Home Assistant version and version of this integration to see + if that solves the issue. Let us know if that works for you by adding a + comment ๐Ÿ‘. + + This issue now has been marked as stale and will be closed if no further + activity occurs. Thank you for your contributions.' + days-before-stale: 30 + days-before-close: 30 + stale-issue-label: 'no-issue-activity' + exempt-issue-labels: 'work-in-progress,blocked,help wanted,under investigation' diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..a5c95a9 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,17 @@ +name: Validate + +on: + pull_request: + schedule: + - cron: "0 0 * * *" + +jobs: + validate: + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v2" + - name: HACS validation + uses: "hacs/action@main" + with: + category: "integration" + comment: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d2d6e01 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.venv +Config/ +.vscode/ +**/__pycache__/ \ No newline at end of file diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 0000000..72b354e --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,8 @@ +FROM gitpod/workspace-full:latest + +USER gitpod + +RUN pyenv install 3.9.7 &&\ + pyenv global 3.9.7 &&\ + echo "export PIP_USER=no" >> /home/gitpod/.bashrc &&\ + python -m pip install virtualenv diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..e238786 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,29 @@ +image: + file: .gitpod.Dockerfile +tasks: + - name: Requirements + init: | + python -m virtualenv .venv + . .venv/bin/activate + pip3 install pre-commit + pre-commit install + pre-commit run --all-files + pip3 install -r requirements_dev.txt +ports: + - port: 9123 + onOpen: notify +github: + prebuilds: + master: true + branches: false + pullRequests: true + pullRequestsFromForks: true + addCheck: true + addComment: false + addBadge: false +vscode: + extensions: + - esbenp.prettier-vscode + - github.vscode-pull-request-github + - eamodio.gitlens + - ms-python.python diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b951048 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,40 @@ +repos: + - repo: https://github.com/asottile/pyupgrade + rev: v2.31.1 + hooks: + - id: pyupgrade + args: [--py37-plus] + - repo: https://github.com/psf/black + rev: 22.3.0 + hooks: + - id: black + additional_dependencies: ['click==8.0.4'] + args: + - --safe + - --quiet + files: ^((custom_components)/.+)?[^/]+\.py$ + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: + - --ignore-words-list=threshHold,hass,alot,datas,dof,dur,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing + - --skip="./.*,*.csv,*.json,*.md" + - --quiet-level=2 + exclude_types: [csv, json] + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + additional_dependencies: + - flake8-docstrings==1.5.0 + - pydocstyle==5.1.1 + files: ^(custom_components)/.+\.py$ + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.26.3 + hooks: + - id: yamllint diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..f7cd7c6 --- /dev/null +++ b/.yamllint @@ -0,0 +1,61 @@ +ignore: | + .github +rules: + braces: + level: error + min-spaces-inside: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: + level: error + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + level: error + max-spaces-before: 0 + max-spaces-after: 1 + commas: + level: error + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + level: error + require-starting-space: true + min-spaces-from-content: 2 + comments-indentation: + level: error + document-end: + level: error + present: false + document-start: + level: error + present: false + empty-lines: + level: error + max: 1 + max-start: 0 + max-end: 1 + hyphens: + level: error + max-spaces-after: 1 + indentation: + level: error + spaces: 2 + indent-sequences: true + check-multi-line-strings: false + key-duplicates: + level: error + line-length: disable + new-line-at-end-of-file: + level: error + new-lines: + level: error + type: unix + trailing-spaces: + level: error + truthy: + level: warning