Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Missing input validation for sign_magneticfield parameter in get_exchange_kernels_GaussLegendre. The parameter was used without checking it's a valid value (1 or -1).

Changes

  • Add validation check matching the pattern in planewave.py and exchange_hankel.py
if sign_magneticfield not in (1, -1):
    raise ValueError("sign_magneticfield must be 1 or -1")

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: skilledwolf <18141588+skilledwolf@users.noreply.github.com>
Copilot AI changed the title [WIP] Add validation for sign/indexing fixes and improvements Add sign_magneticfield validation to exchange_legendre.py Dec 3, 2025
Copilot AI requested a review from skilledwolf December 3, 2025 19:28
@skilledwolf skilledwolf marked this pull request as ready for review December 3, 2025 19:36
Copilot AI review requested due to automatic review settings December 3, 2025 19:36
@skilledwolf skilledwolf merged commit 71a8d12 into Fixes_B_field Dec 3, 2025
@skilledwolf skilledwolf deleted the copilot/sub-pr-2-again branch December 3, 2025 19:36
Copy link

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 input validation for the sign_magneticfield parameter in get_exchange_kernels_GaussLegendre to ensure it only accepts values of 1 or -1, bringing it into consistency with the validation patterns already established in planewave.py and exchange_hankel.py.

  • Adds defensive validation check for the sign_magneticfield parameter
  • Uses identical validation pattern and error message as other modules
  • Places validation in the "Input handling" section before parameter usage
Comments suppressed due to low confidence (1)

src/quantumhall_matrixelements/exchange_legendre.py:107

  • Variable Veff is not used.
        Veff = None

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants