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
I just installed fasterer 0.8.1 and got the following error on running it:
% fasterer
app/models/freelancers/freelancer.rb:149 Array#reverse.each is slower than Array#reverse_each.
app/models/concerns/has_phone_numbers.rb:100 Using tr is faster than gsub when replacing a single character in a string with another single character.
app/dashboards/freelancers/freelancer_dashboard.rb:102 Hash#keys.each is slower than Hash#each_key. N.B. Hash#each_key cannot be used if the hash is modified during the each block.
app/controllers/admin/freelancers_controller.rb:137 Array#select.last is slower than Array#reverse.detect.
Traceback (most recent call last):
34: from /Users/manuel/.rbenv/versions/2.6.5/bin/fasterer:23:in `<main>'
33: from /Users/manuel/.rbenv/versions/2.6.5/bin/fasterer:23:in `load'
32: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/bin/fasterer:5:in `<top (required)>'
31: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/cli.rb:7:in `execute'
30: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/file_traverser.rb:26:in `traverse'
29: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/file_traverser.rb:49:in `traverse_files'
28: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/file_traverser.rb:49:in `each'
27: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/file_traverser.rb:49:in `block in traverse_files'
26: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/file_traverser.rb:57:in `scan_file'
25: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:22:in `scan'
24: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `traverse_sexp_tree'
23: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `each'
22: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `block in traverse_sexp_tree'
21: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `traverse_sexp_tree'
20: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `each'
19: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `block in traverse_sexp_tree'
18: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `traverse_sexp_tree'
17: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `each'
16: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `block in traverse_sexp_tree'
15: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `traverse_sexp_tree'
14: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `each'
13: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `block in traverse_sexp_tree'
12: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `traverse_sexp_tree'
11: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `each'
10: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `block in traverse_sexp_tree'
9: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `traverse_sexp_tree'
8: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `each'
7: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:45:in `block in traverse_sexp_tree'
6: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:36:in `traverse_sexp_tree'
5: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:54:in `scan_by_token'
4: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:71:in `scan_method_calls'
3: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/analyzer.rb:71:in `new'
2: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/scanners/method_call_scanner.rb:13:in `initialize'
1: from /Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/scanners/method_call_scanner.rb:48:in `check_offense'
/Users/manuel/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/fasterer-0.8.1/lib/fasterer/scanners/method_call_scanner.rb:135:in `check_symbol_to_proc': undefined method `name' for #<Fasterer::Primitive:0x00007f9a2092afd8> (NoMethodError)
The text was updated successfully, but these errors were encountered:
Hi! 👋 Thanks for reporting the issue, i've released fasterer version 0.8.2 with a fix for this situation.
I would really love to know whether you can check your code, as from what I see, it looks like you have a iterator that has a block that invokes a method with no arguments on an array or a range, and I'm not sure what the use case would be, but potentially could be a bug.
The code would look like something like this:
collection.each do |element|
[].perform_something
end
If you look at the code above, it does not make a lot of sense to iterate and then invoke a method on a different array or range. But I might be wrong, and maybe everything's alright with your code, I might not just see a scenario like that.
Hi @DamirSvrtan, thanks for the quick fix! I installed v0.8.2 and indeed the error doesn't happen anymore.
My codebase is quite large, so I can't easily look for the iterator you describe.
Maybe you could add a --verbose option that outputs the file being checked, if that's possible?
I just installed fasterer 0.8.1 and got the following error on running it:
The text was updated successfully, but these errors were encountered: