Skip to content

Commit

Permalink
fix: Fix 'possibly-used-before-assignment' pylint issues
Browse files Browse the repository at this point in the history
Latest pylint added a new check for values used before assignment.
This fixes these issues found in the blivet module. Some of these
are false positives, some real potential issues.
  • Loading branch information
vojtechtrefny committed May 22, 2024
1 parent 832aa00 commit eafe208
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,8 @@ def _look_up_device(self):
self._device = None
return # TODO: see if we can create this device w/ the specified name

# pylint doesn't understand that "luks_fmt" is always set when "encrypted" is true
# pylint: disable=possibly-used-before-assignment
def _update_from_device(self, param_name):
""" Return True if param_name's value was retrieved from a looked-up device. """
log.debug("Updating volume settings from device: %r", self._device)
Expand Down Expand Up @@ -1717,6 +1719,8 @@ def str_to_size(spec, hundredpercent=None):

if auto_size_dev_count > 0:
calculated_thinlv_size = available_space / auto_size_dev_count
else:
calculated_thinlv_size = available_space

Check warning on line 1723 in library/blivet.py

View check run for this annotation

Codecov / codecov/patch

library/blivet.py#L1723

Added line #L1723 was not covered by tests

for thinlv in thinlvs_to_create:

Expand Down
5 changes: 3 additions & 2 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: MIT

# This file was generated using `pylint --generate-rcfile > pylintrc` command.
# This file was generated using `pylint --generate-rcfile > pylintrc` command.
[MASTER]

# A comma-separated list of package or module names from where C extensions may
Expand Down Expand Up @@ -57,7 +57,8 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=wrong-import-position
disable=wrong-import-position,
unknown-option-value
#disable=print-statement,
# parameter-unpacking,
# unpacking-in-except,
Expand Down

0 comments on commit eafe208

Please sign in to comment.