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

update pre commit: to autoupdate and with gitleaks (issues 146, 64) #147

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Empty file modified .github/workflows/wait-for-pypi.py
100644 → 100755
Empty file.
30 changes: 16 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ ci:
autoupdate_branch: "develop"
autofix_prs: false # Comment "pre-commit.ci autofix" on a PR to trigger

default_language_version:
python: python3.10

repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand All @@ -23,32 +31,26 @@ repos:
- id: check-vcs-permalinks
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: no-commit-to-branch # protects `main` by default
- id: debug-statements
- id: trailing-whitespace
exclude: tests(/\w*)*/functional/t/trailing_whitespaces.py|tests/pyreverse/data/.*.html|doc/data/messages/t/trailing-whitespace/bad.py
- id: end-of-file-fixer
exclude: |
(?x)^(
tests(/\w*)*/functional/m/missing/missing_final_newline.py|
tests/functional/t/trailing_newlines.py|
doc/data/messages/t/trailing-newlines/bad.py|
)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.7.3
hooks:
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix"]
- id: ruff-format

- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black-jupyter

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy

# TODO: Reconsider using the alexjs hook when there is a way to ignore particular warnings and/or files.
# - repo: "https://github.com/mfisher87/alexjs-pre-commit-mirror"
# rev: "v11.0.1" # Use the sha / tag you prefer
# hooks:
# - id: "alex"
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- update pre commit: to autoupdate and with gitleaks ([#147](https://github.com/nasa/batchee/pull/147))([**@danielfromearth**](https://github.com/danielfromearth))

## [1.2.0] - 2024-06-27

### Changed
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
<a href="https://www.repostatus.org/#active" target="_blank">
<img src="https://www.repostatus.org/badges/latest/active.svg" alt="Project Status: Active – The project has reached a stable, usable state and is being actively developed">
</a>
<a href="https://github.com/python/black" target="_blank">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style">
</a>
<a href="http://mypy-lang.org/" target="_blank">
<img src="http://www.mypy-lang.org/static/mypy_badge.svg" alt="Mypy checked">
</a>
Expand Down
4 changes: 3 additions & 1 deletion batcher/harmony/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# either express or implied. See the License for the specific language governing permissions and
# limitations under the License.
"""A Harmony CLI wrapper around the concatenate-batcher"""

from argparse import ArgumentParser

import harmony_service_lib
Expand All @@ -45,7 +46,8 @@ def main(config: harmony_service_lib.util.Config = None) -> None:
None
"""
parser = ArgumentParser(
prog="Pre-concatenate-batching", description="Run the pre-concatenate-batching service"
prog="Pre-concatenate-batching",
description="Run the pre-concatenate-batching service",
)
harmony_service_lib.setup_cli(parser)
args = parser.parse_args()
Expand Down
6 changes: 5 additions & 1 deletion batcher/harmony/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# either express or implied. See the License for the specific language governing permissions and
# limitations under the License.
"""Misc utility functions"""

from datetime import datetime

from pystac import Asset, Item
Expand Down Expand Up @@ -104,7 +105,10 @@ def _get_output_date_range(input_items: list[Item]) -> dict[str, str]:
start_datetime = min(start_datetime, new_start_datetime)
end_datetime = max(end_datetime, new_end_datetime)

return {"start_datetime": start_datetime.isoformat(), "end_datetime": end_datetime.isoformat()}
return {
"start_datetime": start_datetime.isoformat(),
"end_datetime": end_datetime.isoformat(),
}


def _get_item_date_range(item: Item) -> tuple[datetime, datetime]:
Expand Down
4 changes: 3 additions & 1 deletion batcher/tempo_filename_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# either express or implied. See the License for the specific language governing permissions and
# limitations under the License.
"""Holds the logic for grouping together data files based on their filenames."""

import logging
import re
from argparse import ArgumentParser
Expand Down Expand Up @@ -79,7 +80,8 @@ def main() -> list[list[str]]:
"""Main CLI entrypoint"""

parser = ArgumentParser(
prog="batchee", description="Simple CLI wrapper around the granule batcher module."
prog="batchee",
description="Simple CLI wrapper around the granule batcher module.",
)
parser.add_argument(
"file_names",
Expand Down
Loading