Skip to content

Conversation

robertapplin
Copy link
Contributor

@robertapplin robertapplin commented Oct 29, 2024

Description of work

This PR fixes any remaining ruff E741 errors, documented here:
https://docs.astral.sh/ruff/rules/ambiguous-variable-name/

It also enables this check to run on all pull requests.

To test:

Code review - check that all changes look reasonable

Run ruff locally on all files using the following terminal command

pre-commit run ruff --all-files

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@robertapplin robertapplin added Maintenance Unassigned issues to be addressed in the next maintenance period. ISIS: Core Issue and pull requests at ISIS that relate to Core features and functions labels Oct 29, 2024
@robertapplin robertapplin added this to the Release 6.12 milestone Oct 29, 2024
@robertapplin robertapplin marked this pull request as ready for review October 29, 2024 11:38
@jclarkeSTFC jclarkeSTFC self-assigned this Oct 30, 2024
Copy link
Contributor

@jclarkeSTFC jclarkeSTFC left a comment

Choose a reason for hiding this comment

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

Looks good, I just spotted some small things.

jclarkeSTFC
jclarkeSTFC previously approved these changes Oct 31, 2024
Copy link
Contributor

@jclarkeSTFC jclarkeSTFC left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes.

@thomashampson thomashampson self-assigned this Oct 31, 2024
Copy link
Contributor

@thomashampson thomashampson left a comment

Choose a reason for hiding this comment

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

I think we should check with more people before deciding whether to turn this rule on. It's quite common to e.g. loop over the indices h, k, and l, and maybe we shouldn't be restricting this.

@RichardWaiteSTFC
Copy link
Contributor

I don't mind hugely, but it's a bit confusing to change just l to L and leave h,k lower case...personally I would prefer to supress the objection to h,k,l as these mean something in our domain and probably involves changing a lot of files (are we sure we have good test coverage for all of them, would it pick up if there was an existing L variable already?). Granted H,K,L is equally meaningful but in python you tend to use lower case to start a variable name. Just my opinion though!

@robertapplin
Copy link
Contributor Author

robertapplin commented Oct 31, 2024

It was decided that the l variable is meaningful and readable in a situation where the file is using h,k,l variables. In this case, l is preferrable to L. Therefore it was decided its best to suppress E741 at the top of files that are likely to use h,k,l , so that we can then keep the E741 check on by default for all other files

@peterfpeterson peterfpeterson merged commit e3d8de8 into main Nov 1, 2024
10 checks passed
@peterfpeterson peterfpeterson deleted the 0-enable-ruff-e741 branch November 1, 2024 16:22
@peterfpeterson
Copy link
Member

I merged without Tom's (in github) approval. The changes he requested were made.

peterfpeterson pushed a commit to peterfpeterson/mantid that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS: Core Issue and pull requests at ISIS that relate to Core features and functions Maintenance Unassigned issues to be addressed in the next maintenance period.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants