Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Code style #381

Merged
merged 38 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
991f3b0
Add pre-commit with initial setup
iainfogg Nov 9, 2023
1151493
Add cspell and initial config/dict
iainfogg Nov 9, 2023
0812dac
Sort requirements.txt in pre-commit
iainfogg Nov 9, 2023
9c5cfe5
Test commit
iainfogg Nov 9, 2023
ffe014a
Remove test commit
iainfogg Nov 9, 2023
c1d7f8d
Add JSON file check
iainfogg Nov 9, 2023
f04084a
Add JSON5 check
iainfogg Nov 9, 2023
536812a
Add isort
iainfogg Nov 9, 2023
6a4ae85
Add pylint
iainfogg Nov 9, 2023
6262227
Remove incorrect rev line
iainfogg Nov 9, 2023
37d63be
Update dictionary
iainfogg Nov 9, 2023
a250522
Merge remote-tracking branch 'origin/main' into code-style
iainfogg Nov 9, 2023
7535a74
Remove python changes
iainfogg Nov 9, 2023
3c4ac76
Merge remote-tracking branch 'origin/main' into code-style
iainfogg Nov 11, 2023
c480e3b
Update CI configs, add Black
iainfogg Nov 11, 2023
f0a6546
Remove comments in JSON
iainfogg Nov 11, 2023
af23818
Add note in docs TBC
iainfogg Nov 11, 2023
58992b5
Add workflow config
iainfogg Nov 11, 2023
fb4dfbd
Fix spelling
iainfogg Nov 11, 2023
eb0c084
Stop it running on this branch for now
iainfogg Nov 11, 2023
c088058
Stop it running on PRs (temporarily)
iainfogg Nov 11, 2023
1afc94a
Change to fix some markdown issues
iainfogg Nov 11, 2023
581b6de
Add some documentation changes
iainfogg Nov 11, 2023
315c633
Add text with trailing whitespace
iainfogg Nov 11, 2023
dc0d2ab
Update the docs more for coding standards
iainfogg Nov 11, 2023
9baf523
Start section on expected standards
iainfogg Nov 21, 2023
10a904a
Merge remote-tracking branch 'origin/main' into code-style
iainfogg Nov 21, 2023
bc9c994
Add commit with trailing space
iainfogg Nov 27, 2023
5052396
Merge branch 'springfall2008:main' into code-style
iainfogg Nov 27, 2023
5def2a3
Merge pull request #312 from iainfogg/code-style
iainfogg Nov 27, 2023
c0fa3e4
Add another whitespace commit
iainfogg Nov 27, 2023
5cd20b6
More whitespace
iainfogg Nov 27, 2023
f2841ab
Activate checks on PRs
iainfogg Nov 27, 2023
3400de8
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Nov 27, 2023
dd931a0
Ignore ordered list rule
iainfogg Nov 27, 2023
fd0a474
Tidy up docs (spellings, line lengths
iainfogg Nov 27, 2023
31d71d7
Fix spellings in predbat.py
iainfogg Nov 27, 2023
c56a474
Merge branch 'main' into code-style
springfall2008 Nov 30, 2023
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
18 changes: 18 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",

"dictionaries": ["custom-dictionary-workspace"],

"dictionaryDefinitions": [
{
"name": "custom-dictionary-workspace",
"path": "./.cspell/custom-dictionary-workspace.txt",
"addWords": true
}
],
"import": [
"@cspell/dict-en-gb/cspell-ext.json"
],
"language": "en,en-GB"
}
115 changes: 115 additions & 0 deletions .cspell/custom-dictionary-workspace.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Custom Dictionary Words
adata
adbase
Anson
apexcharts
appdaemon
appkey
argname
automations
autopep
Batpred
batteryb
bierner
Chrg
citem
Codespaces
collapsable
crosscharge
customisation
Customise
cvalue
Daeamon
darray
datap
datapoints
dend
devcontainer
devcontainers
dexport
dimport
diverter
dlimit
dstamp
dstart
dwindow
endt
futurerate
gekey
geserial
Ginlong
GivEnergy
givtcp
HACS
hadashboard
hass
hassapi
homeassistant
houseb
iboost
idetails
inday
isort
ivtime
Krakenflex
kwhb
linebreak
lockstep
markdownlint
maximise
mdlrc
metricb
metricmid
minb
minmax
minuteb
mkdocs
Modbus
myenergi
nattribute
nearr
Nordpool
Ohme
oncharge
pdata
pdetails
perc
ppdetails
Pred
Predbat
Predheat
pwindow
pylint
pyproject
pytz
rarr
rname
rowspan
rstart
rtype
searr
Selfuse
socb
socs
SolarEdge
Solax
Solcast
Southwell
startt
stepline
tdata
tdiff
timea
timeb
timec
timeday
timelapse
timeobj
timestr
timezone
Trefor
treforsiphone
Wallbox
xaxis
yaxis
zappi
14 changes: 14 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: linting
on:
pull_request:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
5 changes: 5 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"MD007": { "indent": 4 },
"MD013": {"line_length": 180},
"MD029": false
}
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: file-contents-sorter
files: ^(\.cspell\/custom-dictionary-workspace.txt|requirements\.txt)$
args: ["--ignore-case", "--unique"]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
exclude: (example_chart.yml)
- id: check-json
exclude: ^(\.cspell\.json|\.devcontainer\/devcontainer\.json)$
- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
hooks:
- id: check-json5
files: ^(\.cspell\.json|\.devcontainer\/devcontainer\.json)$
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
# - repo: https://github.com/PyCQA/isort
# rev: 5.12.0
# hooks:
# - id: isort
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.37.0
hooks:
- id: markdownlint-fix # Configure in .mdlrc
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.0.0
hooks:
- id: cspell
additional_dependencies:
- "@cspell/dict-en-gb"
2 changes: 1 addition & 1 deletion apps/predbat/config/apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pred_bat:
octopus_intelligent_slot: 're:(binary_sensor.octopus_energy([0-9a-z_]+|)_intelligent_dispatching)'
octopus_ready_time: 're:(time.octopus_energy([0-9a-z_]+|)_intelligent_ready_time)'
octopus_charge_limit: 're:(number.octopus_energy([0-9a-z_]+|)_intelligent_charge_limit)'

# Octopus saving session points to the saving session Sensor in the Octopus plugin, when enabled saving sessions will be at the assumed
# rate configured with input_number.predbat_metric_octopus_saving_rate in-side HA
octopus_saving_session: 're:(binary_sensor.octopus_energy([0-9a-z_]+|)_saving_session(s|))'
Expand Down
Loading
Loading