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
bin/rubocop and bundle exec rubocop detect different offenses with spring-commands-rubocop.
Expected behavior
Same offenses with/without spring.
Actual behavior
With spring:
% bin/rubocop sample.rbRunning via Spring preloader in process 86090Inspecting 1 fileWOffenses:sample.rb:5:5: C: Performance/CollectionLiteralInLoop: Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant. [1, 2].exclude?(i) ^^^^^^sample.rb:7:1: W: Lint/ShadowedException: Do not shadow rescued Exceptions.rescue ActiveRecord::RecordNotFound, ActiveRecord::ActiveRecordError, StandardError => e ...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1 file inspected, 2 offenses detected
Just to elaborate a bit, spring preloads the application and this seems to result in RuboCop running in that environment as well so there does appear to happen some accidental runtime analysis:
bin/rubocop
andbundle exec rubocop
detect different offenses withspring-commands-rubocop
.Expected behavior
Same offenses with/without spring.
Actual behavior
With spring:
Without spring:
Steps to reproduce the problem
I created a minimal reproduce example.
Use https://github.com/znz/spring-rubocop-offenses-sample and run commands in Actual behavior.
RuboCop version
The text was updated successfully, but these errors were encountered: