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

[INFRA] LGTM recommendation: Unused local variable #853

Merged
merged 2 commits into from
Aug 25, 2021

Conversation

DimitriPapadopoulos
Copy link
Collaborator

The value assigned to local variable 'data' is never used.

Copy link
Collaborator

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

LGTM, you have a conflict to solve - but other than that, I think it's good to be merged.

Thanks for your recent series of PRs

The value assigned to local variable 'data' is never used.
@@ -16,7 +16,7 @@
import numpy as np

sys.path.append("../tools/")
from schemacode import macros
from schemacode import macros # lgtm [py/unused-import]
Copy link
Member

Choose a reason for hiding this comment

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

is importing macros somehow required? or could we also remove this line? cc @tsalo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe its is required because we later call eval("macros.some_function(...)"):
https://github.com/bids-standard/bids-specification/blob/dd377ae/pdf_build_src/process_markdowns.py#L457

Thus, the lgtm suppression comment is quite useful, it reminds maintainers of this atypical call of macros. functions. I don't know if there's an equivalent noqa error code, but note that noqa support in LGTM.com is buggy (github/codeql#6517).

Copy link
Member

Choose a reason for hiding this comment

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

thanks! Yes, I have used ... # noqa: F401 before. It that works, it'd be preferable to the LGTM thing, I think.
Perhaps even a comment like: ... # noqa: F401 --> it's used in "eval" below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A simple noqa would be taken into account by LGTM.com, but not noqa: F401. What about these options?

# noqa   (used in "eval" call  below)
# noqa: F401   (noqa because used in "eval" call  below)
# noqa: F401   lgtm [py/unused-import]   (used in "eval" call  below)

Copy link
Member

Choose a reason for hiding this comment

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

+1 for option 2, if that works, else option 1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 OK for option 2, I believe the LGTM regex will catch the second lone noqa :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Option 2 is too long, and I have just noticed the second noqa requires spaces around it.

I've pushed option 1.

Import of 'macros' is not used.
@sappelhoff
Copy link
Member

Thanks @DimitriPapadopoulos

@sappelhoff sappelhoff merged commit 8345d50 into bids-standard:master Aug 25, 2021
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Aug 27, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 1, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 13, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 13, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 13, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 13, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
 Veuillez saisir le message de validation pour vos modifications. Les lignes
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 13, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 13, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
DimitriPapadopoulos added a commit to DimitriPapadopoulos/bids-specification that referenced this pull request Sep 13, 2021
Previous commit bb6065a from bids-standard#853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
sappelhoff pushed a commit that referenced this pull request Sep 13, 2021
Previous commit bb6065a from #853 does not work around the LGTM alert.
We attempt to silence the LGTM alert using an lgtm.yml file, and use
standard Flake8 noqa suppression comments to document the issue at hand.
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.

3 participants