Skip to content

Commit 417e3bb

Browse files
committed
Setup development environment
1 parent a518c5d commit 417e3bb

20 files changed

+418
-35
lines changed

.devcontainer.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "codyc1515/ha-yeelock",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
4+
"postCreateCommand": "scripts/setup",
5+
"forwardPorts": [
6+
8123
7+
],
8+
"portsAttributes": {
9+
"8123": {
10+
"label": "Home Assistant",
11+
"onAutoForward": "notify"
12+
}
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"ms-python.python",
18+
"github.vscode-pull-request-github",
19+
"ryanluker.vscode-coverage-gutters",
20+
"ms-python.vscode-pylance"
21+
],
22+
"settings": {
23+
"files.eol": "\n",
24+
"editor.tabSize": 4,
25+
"python.pythonPath": "/usr/bin/python3",
26+
"python.analysis.autoSearchPaths": false,
27+
"python.linting.pylintEnabled": true,
28+
"python.linting.enabled": true,
29+
"python.formatting.provider": "black",
30+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
31+
"editor.formatOnPaste": false,
32+
"editor.formatOnSave": true,
33+
"editor.formatOnType": true,
34+
"files.trimTrailingWhitespace": true
35+
}
36+
}
37+
},
38+
"remoteUser": "vscode",
39+
"features": {
40+
"ghcr.io/devcontainers/features/rust:1": {}
41+
}
42+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/ISSUE_TEMPLATE/bug.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: "Bug report"
3+
description: "Report a bug with the integration"
4+
labels: "Bug"
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: Before you open a new issue, search through the existing issues to see if others have had the same problem.
9+
- type: textarea
10+
attributes:
11+
label: "System Health details"
12+
description: "Paste the data from the System Health card in Home Assistant (https://www.home-assistant.io/more-info/system-health#github-issues)"
13+
validations:
14+
required: true
15+
- type: checkboxes
16+
attributes:
17+
label: Checklist
18+
options:
19+
- label: I have enabled debug logging for my installation.
20+
required: true
21+
- label: I have filled out the issue template to the best of my ability.
22+
required: true
23+
- label: This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
24+
required: true
25+
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/codyc1515/ha-managemyhealth/issues?q=is%3Aissue+label%3A%22Bug%22+)..
26+
required: true
27+
- type: textarea
28+
attributes:
29+
label: "Describe the issue"
30+
description: "A clear and concise description of what the issue is."
31+
validations:
32+
required: true
33+
- type: textarea
34+
attributes:
35+
label: Reproduction steps
36+
description: "Without steps to reproduce, it will be hard to fix. It is very important that you fill out this part. Issues without it will be closed."
37+
value: |
38+
1.
39+
2.
40+
3.
41+
...
42+
validations:
43+
required: true
44+
- type: textarea
45+
attributes:
46+
label: "Debug logs"
47+
description: "To enable debug logs check this https://www.home-assistant.io/integrations/logger/, this **needs** to include _everything_ from startup of Home Assistant to the point where you encounter the issue."
48+
render: text
49+
validations:
50+
required: true
51+
52+
- type: textarea
53+
attributes:
54+
label: "Diagnostics dump"
55+
description: "Drag the diagnostics dump file here. (see https://www.home-assistant.io/integrations/diagnostics/ for info)"

.github/ISSUE_TEMPLATE/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: "Feature request"
3+
description: "Suggest an idea for this project"
4+
labels: "Feature+Request"
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: Before you open a new feature request, search through the existing feature requests to see if others have had the same idea.
9+
- type: checkboxes
10+
attributes:
11+
label: Checklist
12+
options:
13+
- label: I have filled out the template to the best of my ability.
14+
required: true
15+
- label: This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
16+
required: true
17+
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/codyc1515/ha-managemyhealth/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
18+
required: true
19+
20+
- type: textarea
21+
attributes:
22+
label: "Is your feature request related to a problem? Please describe."
23+
description: "A clear and concise description of what the problem is."
24+
placeholder: "I'm always frustrated when [...]"
25+
validations:
26+
required: true
27+
28+
- type: textarea
29+
attributes:
30+
label: "Describe the solution you'd like"
31+
description: "A clear and concise description of what you want to happen."
32+
validations:
33+
required: true
34+
35+
- type: textarea
36+
attributes:
37+
label: "Describe alternatives you've considered"
38+
description: "A clear and concise description of any alternative solutions or features you've considered."
39+
validations:
40+
required: true
41+
42+
- type: textarea
43+
attributes:
44+
label: "Additional context"
45+
description: "Add any other context or screenshots about the feature request here."
46+
validations:
47+
required: true

.github/workflows/hacs.yml

-18
This file was deleted.

.github/workflows/hassfest.yml

-15
This file was deleted.

.github/workflows/lint.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Lint"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
10+
11+
jobs:
12+
ruff:
13+
name: "Ruff"
14+
runs-on: "ubuntu-latest"
15+
steps:
16+
- name: "Checkout the repository"
17+
uses: "actions/[email protected]"
18+
19+
- name: "Set up Python"
20+
uses: actions/[email protected]
21+
with:
22+
python-version: "3.11"
23+
cache: "pip"
24+
25+
- name: "Install requirements"
26+
run: python3 -m pip install -r requirements.txt
27+
28+
- name: "Run"
29+
run: python3 -m ruff check .

.github/workflows/release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Release"
2+
3+
on:
4+
release:
5+
types:
6+
- "published"
7+
8+
permissions: {}
9+
10+
jobs:
11+
release:
12+
name: "Release"
13+
runs-on: "ubuntu-latest"
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: "Checkout the repository"
18+
uses: "actions/[email protected]"
19+
20+
- name: "Adjust version number"
21+
shell: "bash"
22+
run: |
23+
yq -i -o json '.version="${{ github.event.release.tag_name }}"' \
24+
"${{ github.workspace }}/custom_components/yeelock/manifest.json"
25+
26+
- name: "ZIP the integration directory"
27+
shell: "bash"
28+
run: |
29+
cd "${{ github.workspace }}/custom_components/yeelock"
30+
zip yeelock.zip -r ./
31+
32+
- name: "Upload the ZIP file to the release"
33+
uses: softprops/[email protected]
34+
with:
35+
files: ${{ github.workspace }}/custom_components/yeelock/yeelock.zip

.github/workflows/validate.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Validate"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
push:
8+
branches:
9+
- "main"
10+
pull_request:
11+
branches:
12+
- "main"
13+
14+
jobs:
15+
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
16+
name: "Hassfest Validation"
17+
runs-on: "ubuntu-latest"
18+
steps:
19+
- name: "Checkout the repository"
20+
uses: "actions/[email protected]"
21+
22+
- name: "Run hassfest validation"
23+
uses: "home-assistant/actions/hassfest@master"
24+
25+
hacs: # https://github.com/hacs/action
26+
name: "HACS Validation"
27+
runs-on: "ubuntu-latest"
28+
steps:
29+
- name: "Checkout the repository"
30+
uses: "actions/[email protected]"
31+
32+
- name: "Run HACS validation"
33+
uses: "hacs/action@main"
34+
with:
35+
category: "integration"
36+
# Remove this 'ignore' key when you have added brand images for your integration to https://github.com/home-assistant/brands
37+
#ignore: "brands"

.ruff.toml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml
2+
3+
target-version = "py310"
4+
5+
select = [
6+
"B007", # Loop control variable {name} not used within loop body
7+
"B014", # Exception handler with duplicate exception
8+
"C", # complexity
9+
"D", # docstrings
10+
"E", # pycodestyle
11+
"F", # pyflakes/autoflake
12+
"ICN001", # import concentions; {name} should be imported as {asname}
13+
"PGH004", # Use specific rule codes when using noqa
14+
"PLC0414", # Useless import alias. Import alias does not rename original package.
15+
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
16+
"SIM117", # Merge with-statements that use the same scope
17+
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys()
18+
"SIM201", # Use {left} != {right} instead of not {left} == {right}
19+
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a}
20+
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'.
21+
"SIM401", # Use get from dict with default instead of an if block
22+
"T20", # flake8-print
23+
"TRY004", # Prefer TypeError exception for invalid type
24+
"RUF006", # Store a reference to the return value of asyncio.create_task
25+
"UP", # pyupgrade
26+
"W", # pycodestyle
27+
]
28+
29+
ignore = [
30+
"D202", # No blank lines allowed after function docstring
31+
"D203", # 1 blank line required before class docstring
32+
"D213", # Multi-line docstring summary should start at the second line
33+
"D404", # First word of the docstring should not be This
34+
"D406", # Section name should end with a newline
35+
"D407", # Section name underlining
36+
"D411", # Missing blank line before section
37+
"E501", # line too long
38+
"E731", # do not assign a lambda expression, use a def
39+
]
40+
41+
[flake8-pytest-style]
42+
fixture-parentheses = false
43+
44+
[pyupgrade]
45+
keep-runtime-typing = true
46+
47+
[mccabe]
48+
max-complexity = 25

.vscode/tasks.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Run Home Assistant on port 8123",
6+
"type": "shell",
7+
"command": "scripts/develop",
8+
"problemMatcher": []
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)