From 93d182220cb1fe1a88dc2ea9ac52894ab92fc697 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Wed, 28 Feb 2024 17:20:24 -0500 Subject: [PATCH] pre-commit check for files over 5MB (#143) --- .github/workflows/linter_actions.yml | 1 - .pre-commit-config.yaml | 14 +++++++++++++- README.rst | 6 +++++- .../contributing/contribution_guidelines.rst | 7 +++++-- doc/source/contributing/how_to_contribute.rst | 14 +++++++++++++- doc/source/tracking/citations.rst | 2 +- doc/source/tracking/icepyx_pubs.bib | 6 +++--- 7 files changed, 40 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linter_actions.yml b/.github/workflows/linter_actions.yml index 72a793205..d2f8c31f6 100644 --- a/.github/workflows/linter_actions.yml +++ b/.github/workflows/linter_actions.yml @@ -16,4 +16,3 @@ jobs: # note linter arguments are supplied via the .flake8 config file - name: Annotate PR after running flake8 uses: TrueBrain/actions-flake8@v2 - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b7f29308..b7862dc9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,4 +4,16 @@ repos: hooks: - id: black -# you can run `pre-commit autoupdate` to automatically update to the latest version of hooks! \ No newline at end of file +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 # Use the ref you want to point at + hooks: + - id: check-added-large-files + args: ["--maxkb=5000"] + - id: end-of-file-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + +ci: + autoupdate_schedule: monthly + +# you can run `pre-commit autoupdate` to automatically update to the latest version of hooks! diff --git a/README.rst b/README.rst index 6eb800f8d..60220c135 100644 --- a/README.rst +++ b/README.rst @@ -7,7 +7,7 @@ icepyx Latest release (main branch): |Docs Status main| |Travis main Build Status| |Code Coverage main| -Current development version (development branch): |Docs Status dev| |Travis dev Build Status| |Code Coverage dev| +Current development version (development branch): |Docs Status dev| |Travis dev Build Status| |Code Coverage dev| |Pre-commit dev| .. |GitHub license| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg :target: https://opensource.org/licenses/BSD-3-Clause @@ -44,6 +44,10 @@ Current development version (development branch): |Docs Status dev| |Travis dev .. |Code Coverage dev| image:: https://codecov.io/gh/icesat2py/icepyx/branch/development/graph/badge.svg :target: https://codecov.io/gh/icesat2py/icepyx +.. |Pre-commit dev| image:: https://results.pre-commit.ci/badge/github/icesat2py/icepyx/development.svg + :target: https://results.pre-commit.ci/latest/github/icesat2py/icepyx/development + :alt: pre-commit.ci status + Origin and Purpose ------------------ diff --git a/doc/source/contributing/contribution_guidelines.rst b/doc/source/contributing/contribution_guidelines.rst index 1a359118b..ccd979b81 100644 --- a/doc/source/contributing/contribution_guidelines.rst +++ b/doc/source/contributing/contribution_guidelines.rst @@ -58,7 +58,9 @@ By having a *development* branch for daily work, we enable the *main* branch to First Steps ^^^^^^^^^^^ -Before you begin writing code, please first check out our issues page. Someone may already be working on the same problem, and you may be able to contribute directly to their efforts. If not, create a new issue to describe what you plan to do. +Before you begin writing code, please first check out our issues page. +Someone may already be working on the same problem, and you may be able to contribute directly to their efforts. +If not, create a new issue to describe what you plan to do. General Guidelines ^^^^^^^^^^^^^^^^^^ @@ -73,7 +75,8 @@ General Guidelines Basic Steps to Contribute ^^^^^^^^^^^^^^^^^^^^^^^^^ -We encourage users to follow the `git pull request workflow `_. For more detailed steps, please see :ref:`How to Contribute`. +We encourage users to follow the `git pull request workflow `_. +For more detailed steps, please see :ref:`How to Contribute`. Licensing ^^^^^^^^^ diff --git a/doc/source/contributing/how_to_contribute.rst b/doc/source/contributing/how_to_contribute.rst index 50d92fa08..84c21717b 100644 --- a/doc/source/contributing/how_to_contribute.rst +++ b/doc/source/contributing/how_to_contribute.rst @@ -94,7 +94,19 @@ environment (from the home level of your local copy of the icepyx repo) with mamba env create --name icepyx-env --channel conda-forge -f requirements-dev.txt -f requirements.txt -and then pip installing icepyx as described above and below. +and then (1) running `pre-commit install` to let git know about pre-commit and +(2) pip installing icepyx as described above and below. + +One of the tools installed with "requirements-dev.txt" is called [pre-commit](https://pre-commit.com/). +We have included a set of pre-commit formatting hooks that we strongly encourage all contributors to use. +These hooks will check the files you are committing for format consistency, +reformatting the files if necessary. +You can tell files were reformatted if you get a message showing one of the checks failed. +In this case, you will need to re-commit your changes until all pre-commit hooks pass +(i.e. a failed pre-commit check results in no git commit). +Pre-commit will also run on icepyx PRs using the pre-commit CI (continuous integration). +As with other automations happening in PRs, +you'll want to make sure you pull the changes back to your local version before making new commits. Considerations with Jupyter Notebook diff --git a/doc/source/tracking/citations.rst b/doc/source/tracking/citations.rst index e0495018e..d7682040e 100644 --- a/doc/source/tracking/citations.rst +++ b/doc/source/tracking/citations.rst @@ -41,7 +41,7 @@ Presentations that feature or explain icepyx .. bibliography:: icepyx_pubs.bib :style: mystyle - + quest2023agu js2022agu 2022_IS2-HW-tutorials diff --git a/doc/source/tracking/icepyx_pubs.bib b/doc/source/tracking/icepyx_pubs.bib index c928b31b7..7e90bb0f0 100644 --- a/doc/source/tracking/icepyx_pubs.bib +++ b/doc/source/tracking/icepyx_pubs.bib @@ -8,7 +8,7 @@ @misc{quest2023agu Abib, Nicole and {Di Bella}, Alessandro and Tilling, Rachel}, -title = {On a {QUEST (Query, Unify, Explore SpatioTemporal)} +title = {On a {QUEST (Query, Unify, Explore SpatioTemporal)} to Accelerate {ICESat-2} Applications in Ocean Science via {icepyx}}, month = jan, @@ -161,8 +161,8 @@ @misc{js2019agu @INPROCEEDINGS{Bednar2023, author={Bednar, James A. and Durant, Martin}, -booktitle={Proceedings of the 22nd {Python} in Science Conference (SciPy 2023)}, -title={The {Pandata} Scalable Open-Source Analysis Stack}, +booktitle={Proceedings of the 22nd {Python} in Science Conference (SciPy 2023)}, +title={The {Pandata} Scalable Open-Source Analysis Stack}, year={2023}, volume={}, number={},