Skip to content
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

Tidy up of unused imports #5002

Merged

Conversation

GarethCabournDavies
Copy link
Contributor

Remove unused imports from codes throughout the repository
This should save time during the running of the codes, as well as helping move towards a code-checked-before-merging model.

Standard information about the request

This change should have absolutely no effect, but changes are in every part of the code base

This change: follows style guidelines (See e.g. PEP8), has been proposed using the contribution guidelines

Motivation

Want to start improving quality and checking whether submitted code meets quality requirements

Contents

Used flake8 to find unused imports, if there were any, then get rid of them
The files chosen were:

  • anything under bin which started with pycbc_
  • anything under pycbc which ends .py, but ignore any __init__.py or the special version.py
  • anything under test which ends .py - ignore the scheme testing as that uses try/except-wrapped imports, which fail flake8

Links to any issues or associated PRs

Issue raised in #4999

  • The author of this pull request confirms they will adhere to the code of conduct

@GarethCabournDavies GarethCabournDavies added the code-quality Improvements to code quality label Jan 8, 2025
@titodalcanton
Copy link
Contributor

Can the new action effectively replace the old Code Climate checks?

@GarethCabournDavies
Copy link
Contributor Author

Can the new action effectively replace the old Code Climate checks?

At the moment, it is looking for unused imports only (the select=F401 flag), but it may be able to replace these eventually. It hasn't actually picked up the action though, so I will try to work out why

@spxiwh
Copy link
Contributor

spxiwh commented Jan 9, 2025

To comment on codeclimate ... It is easy to run the tools that it uses ... They are all open source standard tools etc. It is not so easy to parse the results, figure out what complaints (there will be many complaints) are new and what are pre-existing, and present this to the user (with a pass/fail). Doing all this in a GUI is the value that CodeClimate (or the older thing, who's name I forgot) adds, and is the bit that is not open source.

Copy link
Contributor

@spxiwh spxiwh left a comment

Choose a reason for hiding this comment

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

TL:DR

@GarethCabournDavies GarethCabournDavies merged commit 0695e8d into gwastro:master Jan 9, 2025
27 of 30 checks passed
@GarethCabournDavies GarethCabournDavies deleted the unused_imports branch January 9, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality Improvements to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants