-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add yaml linting and formatting to pre-commit (#332)
* feat: added yaml linting and formatting to pre-commit hook * feat: added yaml linting and formatting to pre-commit hook * fix: revert approval test files and ignore yaml formatting on them * fix: revert approval test files and ignore yaml formatting on them * fix: space reference
- Loading branch information
Showing
174 changed files
with
68,537 additions
and
68,674 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
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,43 +1,54 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 24.1.1 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# Ruff version. | ||
rev: 'v0.0.292' | ||
hooks: | ||
- id: ruff | ||
args: | ||
- --fix | ||
- --exit-non-zero-on-fix | ||
- --config=pyproject.toml | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: debug-statements | ||
- id: trailing-whitespace | ||
- id: check-builtin-literals | ||
- id: end-of-file-fixer | ||
- id: check-ast | ||
- id: check-docstring-first | ||
|
||
- repo: https://github.com/frnhr/pre-commit-nocommit | ||
rev: 0.0.1 | ||
hooks: | ||
- id: check-nocommit | ||
|
||
# Mypy must be run in the local system environment, not in the pre-commit environment. | ||
- hooks: | ||
- id: mypy | ||
name: mypy | ||
# Gradually, the entire codebase should be checked by mypy, plan is to gradually add mypy for each | ||
# module as we refactor it. | ||
entry: dmypy run -- cognite/powerops/resync cognite/powerops/utils | ||
files: ^.*.(py|pyi)$ | ||
language: system | ||
pass_filenames: false | ||
repo: local | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 24.1.1 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# Ruff version. | ||
rev: "v0.0.292" | ||
hooks: | ||
- id: ruff | ||
args: | ||
- --fix | ||
- --exit-non-zero-on-fix | ||
- --config=pyproject.toml | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-builtin-literals | ||
- id: check-docstring-first | ||
- id: check-yaml | ||
exclude: "mkdocs.yml|^test_apply/demo_.*.yml" | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: name-tests-test | ||
args: | ||
- --pytest-test-first | ||
exclude: "constants.py|mock_.*.py" | ||
- id: no-commit-to-branch | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/google/yamlfmt | ||
rev: v0.10.0 | ||
hooks: | ||
- id: yamlfmt | ||
|
||
- repo: https://github.com/frnhr/pre-commit-nocommit | ||
rev: 0.0.1 | ||
hooks: | ||
- id: check-nocommit | ||
|
||
# Mypy must be run in the local system environment, not in the pre-commit environment. | ||
- repo: local | ||
hooks: | ||
- id: mypy | ||
name: mypy | ||
# Gradually, the entire codebase should be checked by mypy, plan is to gradually add mypy for each | ||
# module as we refactor it. | ||
entry: dmypy run -- cognite/powerops/resync cognite/powerops/utils | ||
files: ^.*.(py|pyi)$ | ||
language: system | ||
pass_filenames: false |
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,8 @@ | ||
doublestar: true | ||
exclude: | ||
- "**/test_apply/demo_*.yml" | ||
formatter: | ||
type: basic | ||
disallow_anchors: true | ||
retain_line_breaks: true | ||
retain_line_breaks_single: true |
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,56 +1,56 @@ | ||
environment: | ||
name: dev | ||
project: power-ops-staging | ||
type: dev | ||
selected_modules_and_packages: | ||
- power_model_v1 | ||
|
||
modules: | ||
custom_modules: | ||
power_model_v1: | ||
powerops_type_space: 'sp_powerops_types' | ||
powerops_instance_space: 'sp_powerops_instance' | ||
powerops_models: 'sp_powerops_models' | ||
version: '1' | ||
power_model_v0: | ||
# variables used for substitution in other files in this directory | ||
afrr_model_space: 'power-ops-afrr-bid' | ||
dayahead_model_space: 'power-ops-day-ahead-bid' | ||
shared_model_space: 'power-ops-shared' | ||
type_space: 'power-ops-types' | ||
powerops_instance_space: 'power-ops-instance' | ||
asset_space: 'power-ops-assets' | ||
|
||
# Shared Model Views | ||
base_BidDocument_version: '1' | ||
base_Alert_version: '1' | ||
base_BidMethod_version: '1' | ||
|
||
# AFRR Bid Model Views | ||
afrrbid_BidDocument_version: '1' | ||
afrrbid_BidMethod_version: '1' | ||
afrrbid_BidRow_version: '1' | ||
afrrbid_PriceArea_version: '1' | ||
|
||
# Day-Ahead Bid Model Views | ||
dayaheadbid_BidDocument_version: '1' | ||
dayaheadbid_BidMethod_version: '1' | ||
dayaheadbid_BidMatrix_version: '1' | ||
dayaheadbid_PriceArea_version: '1' | ||
dayaheadbid_SHOPMultiScenarioMethod_version: '1' | ||
dayaheadbid_MultiScenarioMatrix_version: '1' | ||
dayaheadbid_CustomBidMethod_version: '1' | ||
dayaheadbid_WaterValueBasedMethod_version: '1' | ||
dayaheadbid_BasicBidMatrix_version: '1' | ||
dayaheadbid_CustomBidMatrix_version: '1' | ||
dayaheadbid_SHOPPriceScenario_version: '1' | ||
dayaheadbid_SHOPPriceScenarioResult_version: '1' | ||
|
||
# Asset Model Views | ||
asset_PriceArea_version: '1' | ||
asset_Watercourse_version: '1' | ||
asset_Plant_version: '1' | ||
asset_Generator_version: '1' | ||
asset_Reservoir_version: '1' | ||
asset_TurbineEfficiency_version: '1' | ||
asset_GeneratorEfficiency_version: '1' | ||
environment: | ||
name: dev | ||
project: power-ops-staging | ||
type: dev | ||
selected_modules_and_packages: | ||
- power_model_v1 | ||
|
||
modules: | ||
custom_modules: | ||
power_model_v1: | ||
powerops_type_space: 'sp_powerops_types' | ||
powerops_instance_space: 'sp_powerops_instance' | ||
powerops_models: 'sp_powerops_models' | ||
version: '1' | ||
power_model_v0: | ||
# variables used for substitution in other files in this directory | ||
afrr_model_space: 'power-ops-afrr-bid' | ||
dayahead_model_space: 'power-ops-day-ahead-bid' | ||
shared_model_space: 'power-ops-shared' | ||
type_space: 'power-ops-types' | ||
powerops_instance_space: 'power-ops-instance' | ||
asset_space: 'power-ops-assets' | ||
|
||
# Shared Model Views | ||
base_BidDocument_version: '1' | ||
base_Alert_version: '1' | ||
base_BidMethod_version: '1' | ||
|
||
# AFRR Bid Model Views | ||
afrrbid_BidDocument_version: '1' | ||
afrrbid_BidMethod_version: '1' | ||
afrrbid_BidRow_version: '1' | ||
afrrbid_PriceArea_version: '1' | ||
|
||
# Day-Ahead Bid Model Views | ||
dayaheadbid_BidDocument_version: '1' | ||
dayaheadbid_BidMethod_version: '1' | ||
dayaheadbid_BidMatrix_version: '1' | ||
dayaheadbid_PriceArea_version: '1' | ||
dayaheadbid_SHOPMultiScenarioMethod_version: '1' | ||
dayaheadbid_MultiScenarioMatrix_version: '1' | ||
dayaheadbid_CustomBidMethod_version: '1' | ||
dayaheadbid_WaterValueBasedMethod_version: '1' | ||
dayaheadbid_BasicBidMatrix_version: '1' | ||
dayaheadbid_CustomBidMatrix_version: '1' | ||
dayaheadbid_SHOPPriceScenario_version: '1' | ||
dayaheadbid_SHOPPriceScenarioResult_version: '1' | ||
|
||
# Asset Model Views | ||
asset_PriceArea_version: '1' | ||
asset_Watercourse_version: '1' | ||
asset_Plant_version: '1' | ||
asset_Generator_version: '1' | ||
asset_Reservoir_version: '1' | ||
asset_TurbineEfficiency_version: '1' | ||
asset_GeneratorEfficiency_version: '1' |
46 changes: 23 additions & 23 deletions
46
cognite/powerops/custom_modules/power_model_v0/data_models/AFRRBid.datamodel.yaml
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,26 +1,26 @@ | ||
externalId: AFRRBid | ||
space: '{{afrr_model_space}}' | ||
version: '1' | ||
space: "{{afrr_model_space}}" | ||
version: "1" | ||
name: AFRRBid | ||
description: 'Stores results of AFRR bid calculations.' | ||
description: "Stores results of AFRR bid calculations." | ||
views: | ||
- externalId: BidDocument | ||
space: '{{afrr_model_space}}' | ||
type: view | ||
version: '{{afrrbid_BidDocument_version}}' | ||
- externalId: BidRow | ||
space: '{{afrr_model_space}}' | ||
type: view | ||
version: '{{afrrbid_BidRow_version}}' | ||
- externalId: PriceArea | ||
space: '{{afrr_model_space}}' | ||
type: view | ||
version: '{{afrrbid_PriceArea_version}}' | ||
- externalId: BidMethod | ||
space: '{{afrr_model_space}}' | ||
type: view | ||
version: '{{afrrbid_BidMethod_version}}' | ||
- externalId: Alert | ||
space: '{{shared_model_space}}' | ||
type: view | ||
version: '{{base_Alert_version}}' | ||
- externalId: BidDocument | ||
space: "{{afrr_model_space}}" | ||
type: view | ||
version: "{{afrrbid_BidDocument_version}}" | ||
- externalId: BidRow | ||
space: "{{afrr_model_space}}" | ||
type: view | ||
version: "{{afrrbid_BidRow_version}}" | ||
- externalId: PriceArea | ||
space: "{{afrr_model_space}}" | ||
type: view | ||
version: "{{afrrbid_PriceArea_version}}" | ||
- externalId: BidMethod | ||
space: "{{afrr_model_space}}" | ||
type: view | ||
version: "{{afrrbid_BidMethod_version}}" | ||
- externalId: Alert | ||
space: "{{shared_model_space}}" | ||
type: view | ||
version: "{{base_Alert_version}}" |
70 changes: 35 additions & 35 deletions
70
cognite/powerops/custom_modules/power_model_v0/data_models/Asset.datamodel.yaml
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,38 +1,38 @@ | ||
externalId: PowerAsset | ||
space: '{{asset_space}}' | ||
version: '1' | ||
space: "{{asset_space}}" | ||
version: "1" | ||
name: PowerAsset | ||
description: 'Describes the power operations asset model' | ||
description: "Describes the power operations asset model" | ||
views: | ||
- externalId: PriceArea | ||
space: '{{asset_space}}' | ||
type: view | ||
version: '{{asset_PriceArea_version}}' | ||
- externalId: Watercourse | ||
space: '{{asset_space}}' | ||
type: view | ||
version: '{{asset_Watercourse_version}}' | ||
- externalId: Plant | ||
space: '{{asset_space}}' | ||
type: view | ||
version: '{{asset_Plant_version}}' | ||
- externalId: Generator | ||
space: '{{asset_space}}' | ||
type: view | ||
version: '{{asset_Generator_version}}' | ||
- externalId: Reservoir | ||
space: '{{asset_space}}' | ||
type: view | ||
version: '{{asset_Reservoir_version}}' | ||
- externalId: TurbineEfficiencyCurve | ||
space: '{{asset_space}}' | ||
type: view | ||
version: '{{asset_TurbineEfficiency_version}}' | ||
- externalId: GeneratorEfficiencyCurve | ||
space: '{{asset_space}}' | ||
type: view | ||
version: '{{asset_GeneratorEfficiency_version}}' | ||
- externalId: BidMethod | ||
space: '{{shared_model_space}}' | ||
type: view | ||
version: '{{base_BidMethod_version}}' | ||
- externalId: PriceArea | ||
space: "{{asset_space}}" | ||
type: view | ||
version: "{{asset_PriceArea_version}}" | ||
- externalId: Watercourse | ||
space: "{{asset_space}}" | ||
type: view | ||
version: "{{asset_Watercourse_version}}" | ||
- externalId: Plant | ||
space: "{{asset_space}}" | ||
type: view | ||
version: "{{asset_Plant_version}}" | ||
- externalId: Generator | ||
space: "{{asset_space}}" | ||
type: view | ||
version: "{{asset_Generator_version}}" | ||
- externalId: Reservoir | ||
space: "{{asset_space}}" | ||
type: view | ||
version: "{{asset_Reservoir_version}}" | ||
- externalId: TurbineEfficiencyCurve | ||
space: "{{asset_space}}" | ||
type: view | ||
version: "{{asset_TurbineEfficiency_version}}" | ||
- externalId: GeneratorEfficiencyCurve | ||
space: "{{asset_space}}" | ||
type: view | ||
version: "{{asset_GeneratorEfficiency_version}}" | ||
- externalId: BidMethod | ||
space: "{{shared_model_space}}" | ||
type: view | ||
version: "{{base_BidMethod_version}}" |
Oops, something went wrong.