forked from asciipip/greenbutton-python
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from vladistan/add-pre-commit
Add pre commit
- Loading branch information
Showing
37 changed files
with
330 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This workflow runs pre-commit hooks on pushes and pull requests to main | ||
# to enforce coding style. To ensure correct configuration, please refer to: | ||
# https://lincc-ppt.readthedocs.io/en/latest/practices/ci_precommit.html | ||
name: Run pre-commit hooks | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
pre-commit-ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
python -m pip install --upgrade pip | ||
pip install .[dev] | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --all-files --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
repos: | ||
|
||
- repo: https://github.com/abravalheri/validate-pyproject | ||
rev: v0.12.1 | ||
hooks: | ||
- id: validate-pyproject | ||
|
||
- repo: https://github.com/rhysd/actionlint | ||
rev: v1.6.26 | ||
hooks: | ||
- id: actionlint | ||
|
||
- repo: https://github.com/sirosen/check-jsonschema | ||
rev: 0.27.3 | ||
hooks: | ||
- id: check-github-actions | ||
- id: check-github-workflows | ||
- id: check-readthedocs | ||
|
||
- repo: https://github.com/pappasam/toml-sort | ||
rev: v0.23.1 | ||
hooks: | ||
- id: toml-sort-fix | ||
stages: ["pre-commit"] | ||
|
||
- repo: meta | ||
hooks: | ||
- id: check-useless-excludes | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.5.5 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix, --show-fixes] | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: ['--maxkb=500'] | ||
- id: check-ast | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-symlinks | ||
- id: check-toml | ||
- id: check-vcs-permalinks | ||
- id: check-xml | ||
- id: check-yaml | ||
args: [--unsafe] | ||
- id: debug-statements | ||
- id: destroyed-symlinks | ||
- id: end-of-file-fixer | ||
types: [python] | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
- id: name-tests-test | ||
args: [--pytest-test-first] | ||
- id: no-commit-to-branch | ||
stages: | ||
- pre-push | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: debug-statements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
|
||
* Handle IntervalReading blocks without timePeriod entries. | ||
Synthesize a timePeriod from MeterReading.readingType.intervalLength. | ||
|
||
* Handle LocalTimeParameters resources | ||
|
||
* Handle ElectricPowerUsageSummary resources | ||
|
||
* Handle ElectricPowerQualitySummary resources | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,52 @@ | ||
[build-system] | ||
requires = ["setuptools>=61.0.0", "wheel"] | ||
requires = [ | ||
"setuptools>=61", | ||
"wheel" | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "greenbutton_objects" | ||
version = "2024.7.11" | ||
description = "Parse Green Button XML files into Python objects." | ||
readme = "README.md" | ||
authors = [{ name = "Phil Gold", email = "[email protected]" }, | ||
{ name = "Adam Finkle", email = "[email protected]" }, | ||
{ name = "Ethan Strominger", email = "[email protected]" }] | ||
license = { file = "LICENSE" } | ||
authors = [ | ||
{name = "Phil Gold", email = "[email protected]"}, | ||
{name = "Adam Finkle", email = "[email protected]"}, | ||
{name = "Ethan Strominger", email = "[email protected]"} | ||
] | ||
license = {file = "LICENSE"} | ||
classifiers = [ | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Development Status :: 4 - Beta", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Intended Audience :: Developers", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3" | ||
] | ||
keywords = ["feed", "reader", "tutorial"] | ||
requires-python = ">=2.7" | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"black", | ||
"bumpver", | ||
"isort", | ||
"mypy", | ||
"pip-tools", | ||
"pydocstyle", | ||
"pytest" | ||
"black", | ||
"bumpver", | ||
"mypy", | ||
"pip-tools", | ||
"pydocstyle", | ||
"pytest", | ||
"pytest-cov", | ||
"ruff" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/codeforboston/greenbutton_objects" | ||
"Homepage" = "https://github.com/codeforboston/greenbutton_objects" | ||
"Source Code" = "https://github.com/codeforboston/greenbutton_objects" | ||
|
||
[tool.black] | ||
line-length = 110 | ||
target-version = ["py38"] | ||
|
||
[tool.bumpver] | ||
current_version = "2024.7.11" | ||
version_pattern = "YYYY.MM.DD" | ||
|
@@ -46,9 +61,58 @@ push = true | |
|
||
[tool.bumpver.file_patterns] | ||
"pyproject.toml" = [ | ||
'current_version = "{version}"', | ||
'current_version = "{version}"' | ||
] | ||
"README.md" = [ | ||
"{version}", | ||
"{pep440_version}", | ||
"{version}", | ||
"{pep440_version}" | ||
] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 110 | ||
|
||
[tool.ruff] | ||
line-length = 110 | ||
target-version = "py38" | ||
preview = true # https://docs.astral.sh/ruff/preview/ | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
# docstrings | ||
# "D", <-- TODO: There are no docstrings in this project | ||
# pycodestyle | ||
"E", | ||
"W", | ||
# Pyflakes | ||
"F", | ||
# pep8-naming | ||
# "N", <-- TODO: This project not PEP8 Naming compliant yet | ||
# pyupgrade | ||
# "UP", <-- TODO: This project uses outdated string formating | ||
# flake8-bugbear | ||
# "B", <-- TODO: There are potential bugs in this project | ||
# flake8-simplify | ||
"SIM", | ||
# isort | ||
"I" | ||
] | ||
ignore = [ | ||
"UP006", # Allow non standard library generics in type hints | ||
"UP007", # Allow Union in type hints | ||
"SIM114", # Allow if with same arms | ||
"B028", # Allow default warning level | ||
"SIM117", # Allow nested with | ||
"UP015", # Allow redundant open parameters | ||
"UP028" # Allow yield in for loop | ||
] | ||
|
||
[tool.ruff.lint.extend-per-file-ignores] # https://docs.astral.sh/ruff/settings/#extend-per-file-ignores | ||
# Ignore missing __init__.py files in tests. | ||
"tests/*" = ["INP001", "PLR2004"] | ||
|
||
[tool.ruff.lint.mccabe] | ||
max-complexity = 10 | ||
|
||
[tool.ruff.lint.pycodestyle] | ||
max-doc-length = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
from enum import Enum | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.