Skip to content

Commit 4e438c6

Browse files
Add pre-commit and implement automatic linting and formatting (#544)
2 parents 4a5fad4 + 877716d commit 4e438c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4482
-3197
lines changed

.bandit.yaml

-3
This file was deleted.

.flake8

-11
This file was deleted.

.github/CODEOWNERS

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# automatically requests pull request reviews for files matching the given pattern; the last match takes precendence
1+
# automatically requests pull request reviews for files matching the given pattern; the last match takes precedence
22

3-
* @spacetelescope/gwcs-maintainers
3+
* @spacetelescope/gwcs-maintainers

.github/dependabot.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ updates:
1313
actions:
1414
patterns:
1515
- "*"
16-

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
with:
2424
envs: |
2525
- linux: check-style
26-
- linux: check-security
2726
test:
2827
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1f43251dde69da8613ea8e11144f05cdea41d5 # v1.15.0
2928
with:

.github/workflows/downstream.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
GALSIM_CAT_PATH: ${{ needs.romanisim_data.outputs.cache_path }}/galsim_data/real_galaxy_catalog_23.5_example.fits
8484
FFTW_DIR: /opt/homebrew/opt/fftw/lib/
8585
cache-path: ${{ needs.romanisim_data.outputs.cache_path }}
86-
cache-key: ${{ needs.romanisim_data.outputs.cache_key }}
86+
cache-key: ${{ needs.romanisim_data.outputs.cache_key }}
8787
envs: |
8888
- linux: py311-test-romanisim-cov-xdist
8989

.pre-commit-config.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
ci:
2+
autofix_prs: false
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v5.0.0
7+
hooks:
8+
- id: check-added-large-files
9+
args: ["--enforce-all", "--maxkb=300"]
10+
# Prevent giant files from being committed.
11+
- id: check-case-conflict
12+
# Check for files with names that would conflict on a case-insensitive
13+
# filesystem like MacOS HFS+ or Windows FAT.
14+
- id: check-json
15+
# Attempts to load all json files to verify syntax.
16+
- id: check-merge-conflict
17+
# Check for files that contain merge conflict strings.
18+
- id: check-symlinks
19+
# Checks for symlinks which do not point to anything.
20+
- id: check-toml
21+
# Attempts to load all TOML files to verify syntax.
22+
- id: check-xml
23+
# Attempts to load all xml files to verify syntax.
24+
- id: check-yaml
25+
# Attempts to load all yaml files to verify syntax.
26+
- id: detect-private-key
27+
# Checks for the existence of private keys.
28+
- id: end-of-file-fixer
29+
# Makes sure files end in a newline and only a newline.
30+
exclude: ".*(data.*)$"
31+
# - id: fix-encoding-pragma # covered by pyupgrade
32+
- id: trailing-whitespace
33+
# Trims trailing whitespace.
34+
exclude_types: [python] # Covered by Ruff W291.
35+
exclude: ".*(data.*)$"
36+
37+
- repo: https://github.com/pre-commit/pygrep-hooks
38+
rev: v1.10.0
39+
hooks:
40+
- id: rst-directive-colons
41+
# Detect mistake of rst directive not ending with double colon.
42+
- id: rst-inline-touching-normal
43+
# Detect mistake of inline code touching normal text in rst.
44+
- id: text-unicode-replacement-char
45+
# Forbid files which have a UTF-8 Unicode replacement character.
46+
47+
- repo: https://github.com/codespell-project/codespell
48+
rev: v2.3.0
49+
hooks:
50+
- id: codespell
51+
args: ["--write-changes"]
52+
additional_dependencies:
53+
- tomli
54+
exclude: ".*.asdf"
55+
56+
- repo: https://github.com/astral-sh/ruff-pre-commit
57+
rev: v0.6.9
58+
hooks:
59+
- id: ruff
60+
args: ["--fix", "--show-fixes"]
61+
- id: ruff-format

CHANGES.rst

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
0.22.0 (2024-12-19)
1+
0.23.0 (unreleased)
22
-------------------
33

44
- Coordinate frames now have a "native" order and then are sorted based on ``axes_order``. [#457]
@@ -11,6 +11,12 @@
1111

1212
- Inputs to ``CelestialFrame``, such as ``axes_names`` are now explicitly in lon, lat order and will re sorted based on ``axes_order=``. [#457]
1313

14+
- Implement code linting and automatic formatting. [#544]
15+
16+
17+
0.22.0 (2024-12-19)
18+
-------------------
19+
1420
- Replace usages of ``copy_arrays`` with ``memmap`` [#503]
1521

1622
- Fix an issue with units in ``wcs_from_points``. [#507]
@@ -21,7 +27,6 @@
2127

2228
- Add support for compound bounding boxes and ignored bounding box entries. [#519]
2329

24-
2530
- Add ``gwcs.examples`` module, based on the examples located in the testing ``conftest.py``. [#521]
2631

2732
- Force ``bounding_box`` to always be returned as a ``F`` ordered box. [#522]
@@ -221,7 +226,7 @@ New Features
221226
- Added ``insert_frame`` method to modify the pipeline of a ``WCS`` object. [#299]
222227

223228
- Added ``to_fits_tab`` method to generate FITS header and binary table
224-
extension following FITS WCS ``-TAB`` convension. [#295]
229+
extension following FITS WCS ``-TAB`` convention. [#295]
225230

226231
- Added ``in_image`` function for testing whether a point in world coordinates
227232
maps back to the domain of definition of the forward transformation. [#322]
@@ -277,7 +282,7 @@ New Features
277282

278283
- Removed astropy-helpers from package. [#249]
279284

280-
- Added a method ``fix_inputs`` which rturns an unique WCS from a compound
285+
- Added a method ``fix_inputs`` which returns an unique WCS from a compound
281286
WCS by fixing inputs. [#254]
282287

283288
- Added two new transforms - ``ToDirectionCosines`` and ``FromDirectionCosines``. [#256]

CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Spacetelescope Open Source Code of Conduct
22

3-
We expect all "spacetelescope" organization projects to adopt a code of conduct that ensures a productive, respectful environment for all open source contributors and participants. We are committed to providing a strong and enforced code of conduct and expect everyone in our community to follow these guidelines when interacting with others in all forums. Our goal is to keep ours a positive, inclusive, successful, and growing community. The community of participants in open source Astronomy projects is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences success and continued growth.
3+
We expect all "spacetelescope" organization projects to adopt a code of conduct that ensures a productive, respectful environment for all open source contributors and participants. We are committed to providing a strong and enforced code of conduct and expect everyone in our community to follow these guidelines when interacting with others in all forums. Our goal is to keep ours a positive, inclusive, successful, and growing community. The community of participants in open source Astronomy projects is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences success and continued growth.
44

55

66
As members of the community,

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Please open a new issue or new pull request for bugs, feedback, or new features you would like to see. If there is an issue you would like to work on, please leave a comment and we will be happy to assist. New contributions and contributors are very welcome!
22

3-
New to github or open source projects? If you are unsure about where to start or haven't used github before, please feel free to contact the package maintainers.
3+
New to github or open source projects? If you are unsure about where to start or haven't used github before, please feel free to contact the package maintainers.
44

55
Feedback and feature requests? Is there something missing you would like to see? Please open an issue or send an email to the maintainers. This package follows the Spacetelescope [Code of Conduct](CODE_OF_CONDUCT.md) strives to provide a welcoming community to all of our users and contributors.

README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ GWCS - Generalized World Coordinate System
1616
.. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
1717
:target: http://www.astropy.org
1818
:alt: Powered by Astropy Badge
19-
19+
2020
.. image:: https://img.shields.io/badge/powered%20by-STScI-blue.svg?colorA=707170&colorB=3e8ddd&style=flat
2121
:target: http://www.stsci.edu
2222
:alt: Powered by STScI Badge
@@ -37,15 +37,15 @@ Installation
3737

3838
To install::
3939

40-
pip install gwcs
40+
pip install gwcs
4141

4242
To clone from github and install the master branch::
4343

4444
git clone https://github.com/spacetelescope/gwcs.git
4545
cd gwcs
4646
pip install --editable .
4747

48-
48+
4949
Contributing Code, Documentation, or Feedback
5050
---------------------------------------------
5151

0 commit comments

Comments
 (0)