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

Moving the unsupported-assignment-operation lint rule #12304

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ disable = [
"docstring-first-line-empty", # relax docstring style
"import-outside-toplevel", "import-error", # overzealous with our optionals/dynamic packages
"nested-min-max", # this gives false equivalencies if implemented for the current lint version
"unsupported-assignment-operation", # one instance needed for the dragon: qiskit/providers/options.py:232
Copy link
Member

Choose a reason for hiding this comment

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

We can put a # pylint: disable=unsupported-assignment-operation with a comment on the offending line, if it's just one place.

We might even be able to get away with not doing that if we put a manual type hint

class Options(Mapping):
    __slots__ = ("_fields", "validator")
    _fields: dict[str, Any]
    validator: dict[str, Any]

in the class body - with any luck, that should get pylint to infer the proper types of those fields, even though it can't reason about the super().__setattr__ stuff we do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the typing was unfortunately insufficient to convince the linter. updates for the single line were added

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that's a shame. The skip is fine, though - it's not uncommon to have very specific lines of code where it makes sense to disable one particular linter rule, which is why the skip syntax is there.

# TODO(#9614): these were added in modern Pylint. Decide if we want to enable them. If so,
# remove from here and fix the issues. Else, move it above this section and add a comment
# with the rationale
Expand All @@ -230,7 +231,6 @@ disable = [
"unnecessary-dunder-call",
"unnecessary-lambda-assignment",
"unspecified-encoding",
"unsupported-assignment-operation",
"use-implicit-booleaness-not-comparison",
]

Expand Down