Skip to content

Commit e40a8cf

Browse files
committed
Address SonarCloud maintainability issues
1 parent eadc0cd commit e40a8cf

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

src/bagit/__init__.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -913,14 +913,6 @@ def _validate_oxum(self):
913913

914914
total_bytes, total_files = self.payload_oxum()
915915

916-
#total_bytes = 0
917-
#total_files = 0
918-
#
919-
#for payload_file in self.payload_files():
920-
# payload_file = os.path.join(self.path, payload_file)
921-
# total_bytes += os.stat(payload_file).st_size
922-
# total_files += 1
923-
924916
if oxum_file_count != total_files or oxum_byte_count != total_bytes:
925917
raise BagValidationError(
926918
_(
@@ -1669,7 +1661,7 @@ def main():
16691661
else:
16701662
LOGGER.info(_("%s is valid"), bag_dir)
16711663
except BagError as e:
1672-
LOGGER.error(
1664+
LOGGER.exception(
16731665
_("%(bag)s is invalid: %(error)s"), {"bag": bag_dir, "error": e}
16741666
)
16751667
rc = 1
@@ -1684,7 +1676,7 @@ def main():
16841676
checksums=args.checksums,
16851677
)
16861678
except Exception as exc:
1687-
LOGGER.error(
1679+
LOGGER.exception(
16881680
_("Failed to create bag in %(bag_directory)s: %(error)s"),
16891681
{"bag_directory": bag_dir, "error": exc},
16901682
exc_info=True,

test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def test_payload_oxum(self):
10451045
self.assertEqual(bag.payload_oxum(), (991765, 5))
10461046

10471047
def test_payload_oxum_after_payload_change(self):
1048-
bag = bagit.make_bag(self.tmpdir, checksums=["md5"])
1048+
bagit.make_bag(self.tmpdir, checksums=["md5"])
10491049

10501050
with open(j(self.tmpdir, "data", "newfile"), "w") as nf:
10511051
nf.write("newfile")

0 commit comments

Comments
 (0)