Skip to content

Add pre-commit hook to check json formatting #128

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented Jun 11, 2025

Progress of the PR

  • Add pre-commit hook to check formatting json,
  • [n/a] docstring updated (if appropriate),
  • [n/a] update user guide (if appropriate),
  • [n/a] added tests,
  • add a changelog entry in the upcoming_changes folder (see upcoming_changes/README.rst),
  • Check formatting of the changelog entry (and eventual user guide changes) in the docs/readthedocs.org:exspy build of this PR (link in github checks)
  • ready for review.

@ericpre ericpre changed the title Pre commit json formatting Add pre-commit hook to check json formatting Jun 11, 2025
Copy link

codecov bot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.94%. Comparing base (65ad47e) to head (4972dcc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #128   +/-   ##
=======================================
  Coverage   88.94%   88.94%           
=======================================
  Files          77       77           
  Lines        7529     7529           
  Branches      896      896           
=======================================
  Hits         6697     6697           
  Misses        563      563           
  Partials      269      269           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ericpre ericpre force-pushed the pre-commit_json_formatting branch from 887a1f6 to 4972dcc Compare June 11, 2025 17:42
@ericpre ericpre requested a review from Copilot June 11, 2025 17:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a pre-commit hook to automatically format JSON files while also updating tests to reflect a change in the expected ordering of complementary edges and revising the JSON file structure.

  • Added a new pre-commit hook configuration for pretty-formatting JSON files.
  • Updated test assertions in test_eels.py and test_edges_range.py to reflect a revised ordering.
  • Reordered the metadata section in elements_general_properties.json.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
upcoming_changes/128.maintenance.rst Added changelog entry for the pre-commit hook update.
exspy/tests/signals/test_eels.py Updated the ordering of expected complementary edges in tests.
exspy/tests/signals/test_edges_range.py Updated the ordering of expected complementary edges in tests.
exspy/_misc/elements_general_properties.json Reordered metadata placement and adjusted formatting in the JSON file.
.pre-commit-config.yaml Added configuration for the pretty-format-json pre-commit hook.

@ericpre
Copy link
Member Author

ericpre commented Jun 12, 2025

@francisco-dlp, what do you think about sorting the keys in the json files alphabetically that this PR introduces? On main, there are mostly sorted by energy, not always.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants