You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good Smell was crashing on one of my files and I managed to reduce it to a minimal reproducible case. It crashes only if there's a for using a range that takes a len and that inside the loop it appends to a list an object that is part of a list described in a Class. Code is below.
Traceback (most recent call last):
File "C:\Program Files\Python37\Scripts\good_smell-script.py", line 11, in <module>
load_entry_point('good-smell==0.13.0', 'console_scripts', 'good_smell')()
File "c:\program files\python37\lib\site-packages\good_smell\main.py", line 46, in main
Fire({"fix": print_fixed_smell, "warn": print_smell_warnings})
File "c:\program files\python37\lib\site-packages\fire\core.py", line 127, in Fire
component_trace = _Fire(component, args, context, name)
File "c:\program files\python37\lib\site-packages\fire\core.py", line 366, in _Fire
component, remaining_args)
File "c:\program files\python37\lib\site-packages\fire\core.py", line 542, in _CallCallable
result = fn(*varargs, **kwargs)
File "c:\program files\python37\lib\site-packages\good_smell\main.py", line 14, in print_smell_warnings
for warning in smell_warnings(Path(path).read_text(), path)
File "c:\program files\python37\lib\site-packages\good_smell\main.py", line 13, in <genexpr>
warning.warning_string()
File "c:\program files\python37\lib\site-packages\good_smell\main.py", line 22, in smell_warnings
source_code=source, path=str(path)
File "c:\program files\python37\lib\site-packages\good_smell\ast_smell.py", line 29, in check_for_smell
transformer.visit(self.tree)
File "c:\program files\python37\lib\site-packages\good_smell\ast_smell.py", line 20, in visit
return self.generic_visit(node)
File "c:\program files\python37\lib\ast.py", line 317, in generic_visit
value = self.visit(value)
File "c:\program files\python37\lib\site-packages\good_smell\ast_smell.py", line 22, in visit
return super().visit(node)
File "c:\program files\python37\lib\ast.py", line 262, in visit
return visitor(node)
File "c:\program files\python37\lib\site-packages\good_smell\smells\range_len_fix.py", line 57, in visit_For
new_body = deleter.visit(node).body or [ast.Pass()]
File "c:\program files\python37\lib\ast.py", line 262, in visit
return visitor(node)
File "c:\program files\python37\lib\ast.py", line 317, in generic_visit
value = self.visit(value)
File "c:\program files\python37\lib\ast.py", line 262, in visit
return visitor(node)
File "c:\program files\python37\lib\ast.py", line 326, in generic_visit
new_node = self.visit(old_value)
File "c:\program files\python37\lib\ast.py", line 262, in visit
return visitor(node)
File "c:\program files\python37\lib\ast.py", line 317, in generic_visit
value = self.visit(value)
File "c:\program files\python37\lib\ast.py", line 262, in visit
return visitor(node)
File "c:\program files\python37\lib\site-packages\good_smell\smells\range_len_fix.py", line 46, in visit_Subscript
if self.accesses_seq(node):
File "c:\program files\python37\lib\site-packages\good_smell\smells\range_len_fix.py", line 40, in accesses_seq
and node.value.id == self.seq.id
AttributeError: 'Attribute' object has no attribute 'id'
The text was updated successfully, but these errors were encountered:
Description
Good Smell was crashing on one of my files and I managed to reduce it to a minimal reproducible case. It crashes only if there's a
for
using arange
that takes alen
and that inside the loop it appends to a list an object that is part of a list described in a Class. Code is below.To Reproduce
good_smell warn
on the fileExpected behavior
Good smell should not crash, especially when running with flake8 as it breaks all of flake8.
Desktop
Additional context
Might be related with #61
Error log:
The text was updated successfully, but these errors were encountered: