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

sonarqube checks #1094

Open
zacharyburnett opened this issue Feb 7, 2024 · 2 comments · May be fixed by #1095
Open

sonarqube checks #1094

zacharyburnett opened this issue Feb 7, 2024 · 2 comments · May be fixed by #1095
Labels
bug Something isn't working

Comments

@zacharyburnett
Copy link
Collaborator

zacharyburnett commented Feb 7, 2024

bugs found by sonar scan:
https://plsonarqube.stsci.edu/project/issues?resolved=false&types=BUG&id=spacetelescope-regresstiontests&open=AY1_N9SAz6SXJ5XqzbxH

  1. Remove or refactor this statement; it has no side effects.

    Should this be =?

  2. result.meta.cal_step.tweakreg == "SKIPPED"

    Remove or refactor this statement; it has no side effects.

    same as 1; should this be =?

  3. def __contains__(self, x, y):

    Remove 1 parameters. Method __contains__ should have 2 parameters.

    will this raise an error if a user calls in, even before the NotImplementedError?

  4. raise BigdataError(f"Path cannot be found: {path}")

    path is used before it is defined. Move the definition before.

@zacharyburnett zacharyburnett added the bug Something isn't working label Feb 7, 2024
@WilliamJamieson
Copy link
Collaborator

Issues 1, 2, and 4 could be caught by ruff if we include the right rule sets. I'll see if I can find those.

@WilliamJamieson
Copy link
Collaborator

Issues 1 and 2 should be caught by B015 (and/or B018).

Issue 4 might be caught by F821.

It is possible that even issue 3 might be caught but I don't see a rule when I glanced through: https://docs.astral.sh/ruff/rules/ that might apply.

In any case I suggest we explicitly turn on Pyflakes (F) and Bugbear (B), fixing all the issues they find as those are both recommended rule sets.

@zacharyburnett zacharyburnett linked a pull request Feb 8, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants