Skip to content

Commit

Permalink
New API: Disable irrelevant pylint warnings
Browse files Browse the repository at this point in the history
Warnings E1120 and W0212 are irrelevant in one specific case, but
rule E1101 creates a lot of false-positives in tuf/metadata/api.

For example, there are 4 false-positives in this file related
to "meta" and "targets" fields not existing in "signed_dict" in
"from_dict" functions in Timestamp, Snapshot and Targets classes.

Signed-off-by: Martin Vrachev <[email protected]>
  • Loading branch information
MVrachev committed Jan 5, 2021
1 parent d3c38b4 commit 14ef799
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,11 @@ def from_dict(cls, signed_dict: JsonDict) -> 'Signed':

# Create empty object with default or parametrized constructor with
# default arguments.
obj = cls()
obj._type = signed_dict['_type']
# Warnings about rules E1120 and W0212 are not relevant here because
# cls is most likely a child class of "Signed" and we need to setup
# the appropriate fields.
obj = cls() # pylint: disable=E1120
obj._type = signed_dict['_type'] # pylint: disable=W0212
obj.version = signed_dict['version']
obj.spec_version = signed_dict['spec_version']
# Convert 'expires' TUF metadata string to a datetime object, which is
Expand Down
2 changes: 1 addition & 1 deletion tuf/api/pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[MESSAGE_CONTROL]
disable=fixme
disable=fixme,E1101

[FORMAT]
indent-string=" "
Expand Down

0 comments on commit 14ef799

Please sign in to comment.