mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
Add more checks to pre-commit (#3132)
* Add bandit to pre-commit checks * fix catchall exceptions * remove unused definitons * remove unuseed ariables * Add docstring * fix B006, B008 errors * fix B007 error * ignore B009 * Add checks for formatting and naming
This commit is contained in:
@ -223,7 +223,7 @@ class BuildUnallocate(generics.CreateAPIView):
|
||||
|
||||
try:
|
||||
ctx['build'] = Build.objects.get(pk=self.kwargs.get('pk', None))
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
ctx['request'] = self.request
|
||||
@ -243,7 +243,7 @@ class BuildOrderContextMixin:
|
||||
|
||||
try:
|
||||
ctx['build'] = Build.objects.get(pk=self.kwargs.get('pk', None))
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return ctx
|
||||
|
@ -21,7 +21,7 @@ def build_refs(apps, schema_editor):
|
||||
if result and len(result.groups()) == 1:
|
||||
try:
|
||||
ref = int(result.groups()[0])
|
||||
except: # pragma: no cover
|
||||
except Exception: # pragma: no cover
|
||||
ref = 0
|
||||
|
||||
build.reference_int = ref
|
||||
|
@ -1244,13 +1244,13 @@ class BuildItem(models.Model):
|
||||
try:
|
||||
# Try to extract the thumbnail
|
||||
thumb_url = self.stock_item.part.image.thumbnail.url
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if thumb_url is None and self.bom_item and self.bom_item.sub_part:
|
||||
try:
|
||||
thumb_url = self.bom_item.sub_part.image.thumbnail.url
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if thumb_url is not None:
|
||||
|
@ -195,7 +195,7 @@ class BuildTest(BuildAPITest):
|
||||
self.assertEqual(self.build.incomplete_outputs.count(), 0)
|
||||
|
||||
# Create some more build outputs
|
||||
for ii in range(10):
|
||||
for _ in range(10):
|
||||
self.build.create_build_output(10)
|
||||
|
||||
# Check that we are in a known state
|
||||
|
Reference in New Issue
Block a user