Skip to content

Commit

Permalink
Many bug fixes and fixes of deprecated code, update of dev environmen…
Browse files Browse the repository at this point in the history
…t and dependencies
  • Loading branch information
cyberjunky committed Jan 20, 2025
1 parent 34d88ff commit 36d6f77
Show file tree
Hide file tree
Showing 35 changed files with 933 additions and 700 deletions.
30 changes: 17 additions & 13 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cyberjunky/home-assistant-garmin_connect",
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand All @@ -20,29 +20,32 @@
},
"customizations": {
"extensions": [
"charliermarsh.ruff",
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"GitHub.copilot"
],
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"files.eol": "\n",
"editor.tabSize": 4,
"python.pythonPath": "/usr/local/python/bin/python",
"python.analysis.autoSearchPaths": false,
"python.linting.pylintArgs": [
"--disable",
"import-error"
],
"python.formatting.provider": "black",
"python.pythonPath": "/usr/local/bin/python",
"python.formatting.provider": "ruff",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.rulers": [
100
],
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"files.trimTrailingWhitespace": true
},
"extensions": [
"GitHub.copilot",
"github.vscode-pull-request-github",
"ms-python.python",
"ms-python.vscode-pylance",
Expand All @@ -53,6 +56,7 @@
},
"remoteUser": "vscode",
"features": {
"rust": "latest"
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/rust:1": {}
}
}
27 changes: 19 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
labels:
- "pr: dependency-update"
schedule:
interval: weekly
time: "06:00"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
labels:
- "pr: dependency-update"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
interval: weekly
time: "06:00"
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
labels:
- "pr: dependency-update"
schedule:
interval: "weekly"
ignore:
# Dependabot should not update Home Assistant as that should match the homeassistant key in hacs.json
- dependency-name: "homeassistant"
interval: weekly
time: "06:00"
open-pull-requests-limit: 10
104 changes: 71 additions & 33 deletions .github/pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,88 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
- repo: local
hooks:
- id: pyupgrade
stages: [manual]
- id: codespell
name: Check code for common misspellings
language: system
types: [text]
stages: [commit-msg, post-commit, manual]
entry: codespell
args:
- "--py39-plus"
- --quiet-level=2
- --ignore-words-list=hass,ba,fo
- --skip=tests/fixtures/*,custom_components/garmin_connect/translations/*

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
name: Sort imports
language: system
types: [text]
stages: [commit-msg, post-commit, manual]
entry: isort

- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
stages: [manual]
- id: pyupgrade
name: Run pyupgrade
language: system
types: [text]
stages: [commit-msg, post-commit, manual]
entry: pyupgrade
files: ^.*.py$
args:
- --safe
- --quiet
files: ^((custom_components|script|tests)/.+)?[^/]+\.py$
- "--py39-plus"

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
stages: [manual]
- id: ruff-check
name: Run ruff check
language: system
types: [text]
stages: [commit-msg, post-commit, manual]
entry: ruff
args:
- --quiet-level=2
- --ignore-words-list=hass,ba,fo
- --exclude-file=custom_components/hacs/utils/default.repositories
- check
files: ^((action|custom_components|script|tests)/.+)?[^/]+\.py$

- id: ruff-format
name: Run ruff format
language: system
types: [text]
stages: [commit-msg, post-commit, manual]
entry: ruff
args:
- format
files: ^((action|custom_components|script)/.+)?[^/]+\.py$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-executables-have-shebangs
stages: [manual]
name: Check that executables have shebangs
language: system
types: [text, executable]
entry: check-executables-have-shebangs
stages: [commit-msg, post-commit, manual]

- id: check-json
stages: [manual]
name: Check JSON files
language: system
types: [json]
stages: [commit-msg, post-commit, manual]
entry: check-json

- id: requirements-txt-fixer
stages: [manual]
name: Check requirements files
language: system
types: [text]
stages: [commit-msg, post-commit, manual]
entry: requirements-txt-fixer
files: ^requirements_.*.txt$

- id: check-ast
stages: [manual]
name: Check Python AST
language: system
types: [python]
stages: [commit-msg, post-commit, manual]
entry: check-ast

- id: mixed-line-ending
stages: [manual]
name: Check line nedings
language: system
types: [text]
stages: [commit-msg, post-commit, manual]
entry: mixed-line-ending
args:
- --fix=lf
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# misc
.vscode
outputdata
settings.json

# Translation files
custom_components/garmin_connect/translations
!custom_components/garmin_connect/translations/en.json
Expand Down
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

48 changes: 0 additions & 48 deletions .ruff.toml

This file was deleted.

28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"configurations": [
{
"justMyCode": false,
"name": "Python: Attach Local",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
],
"request": "attach",
"type": "debugpy"
},
{
"name": "Python: Attach Remote",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/usr/src/homeassistant"
}
],
"request": "attach",
"type": "debugpy"
}
],
"version": "0.2.0"
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"tasks": [
{
"command": "scripts/develop",
"label": "Run Home Assistant",
"problemMatcher": [],
"type": "shell"
},
{
"command": "scripts/setup",
"label": "Upgrade environment",
"problemMatcher": [],
"type": "shell"
},
{
"command": "scripts/test",
"label": "Run tests",
"problemMatcher": [],
"type": "shell"
},
{
"command": "scripts/lint",
"label": "Run lint checks",
"problemMatcher": [],
"type": "shell"
}
],
"version": "2.0.0"
}
Loading

0 comments on commit 36d6f77

Please sign in to comment.