-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a cop to enforce aggregating examples #726
Commits on Apr 24, 2019
-
Add a cop to enforce aggregating examples
The "one expectation per example" rule has been relaxed and allows for several expectations to be set in the same example. https://github.com/rubocop-hq/rspec-style-guide#expectations-per-example In cases the examples don't have any setup, metadata, or even a docstring, and may be aggregated into one thus saving on sometimes expensive context setup. The cop still does report the cases when the examples might be aggregated, but with some risk, e.g. when matchers with side effects are used. It makes sense to do so, since eventually those matchers might be fixed to leave the subject in its original state. Block expectation syntax is deliberately not supported due to: - `subject { -> { ... } }` syntax being hard to detect - aggregation should use composition with `.and` - aggregation of the `not_to` is barely possible when a matcher doesn't provide a negated variant - aggregation of block syntax with non-block syntax should be in a specific order Known caveats: The usages if `its` that are testing private methods/readers will result in spec failure. It's up to the user whether to replace with `__send__`, or test only public interface. Original idea and initial implementation: https://github.com/palkan/test-prof/blob/master/lib/test_prof/cops/rspec/aggregate_failures.rb
Configuration menu - View commit details
-
Copy full SHA for 916eb9b - Browse repository at this point
Copy the full SHA 916eb9bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4ad3e68 - Browse repository at this point
Copy the full SHA 4ad3e68View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4aa83a9 - Browse repository at this point
Copy the full SHA 4aa83a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0adfd01 - Browse repository at this point
Copy the full SHA 0adfd01View commit details -
Configuration menu - View commit details
-
Copy full SHA for e2a5b18 - Browse repository at this point
Copy the full SHA e2a5b18View commit details -
Configuration menu - View commit details
-
Copy full SHA for a9b2983 - Browse repository at this point
Copy the full SHA a9b2983View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5e3a001 - Browse repository at this point
Copy the full SHA 5e3a001View commit details -
Configuration menu - View commit details
-
Copy full SHA for b2c86c1 - Browse repository at this point
Copy the full SHA b2c86c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a756e2 - Browse repository at this point
Copy the full SHA 3a756e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 00f99ce - Browse repository at this point
Copy the full SHA 00f99ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for e32b9a6 - Browse repository at this point
Copy the full SHA e32b9a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4dad154 - Browse repository at this point
Copy the full SHA 4dad154View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd47c96 - Browse repository at this point
Copy the full SHA dd47c96View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9928939 - Browse repository at this point
Copy the full SHA 9928939View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9de045 - Browse repository at this point
Copy the full SHA b9de045View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3d5f62a - Browse repository at this point
Copy the full SHA 3d5f62aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9655c29 - Browse repository at this point
Copy the full SHA 9655c29View commit details -
Configuration menu - View commit details
-
Copy full SHA for b2d5e60 - Browse repository at this point
Copy the full SHA b2d5e60View commit details -
Configuration menu - View commit details
-
Copy full SHA for ef3382a - Browse repository at this point
Copy the full SHA ef3382aView commit details -
Apply suggestions from code review
Improve wording, fix punctuation errors. Co-Authored-By: pirj <pirj@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 0c04a79 - Browse repository at this point
Copy the full SHA 0c04a79View commit details -
Configuration menu - View commit details
-
Copy full SHA for e394a6a - Browse repository at this point
Copy the full SHA e394a6aView commit details -
Configuration menu - View commit details
-
Copy full SHA for a7510b9 - Browse repository at this point
Copy the full SHA a7510b9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 46553f1 - Browse repository at this point
Copy the full SHA 46553f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 458fbf3 - Browse repository at this point
Copy the full SHA 458fbf3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 81c81c1 - Browse repository at this point
Copy the full SHA 81c81c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1e740ab - Browse repository at this point
Copy the full SHA 1e740abView commit details -
Configuration menu - View commit details
-
Copy full SHA for 318c77c - Browse repository at this point
Copy the full SHA 318c77cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8906bf3 - Browse repository at this point
Copy the full SHA 8906bf3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a93dfd - Browse repository at this point
Copy the full SHA 2a93dfdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4b0b0cc - Browse repository at this point
Copy the full SHA 4b0b0ccView commit details -
Configuration menu - View commit details
-
Copy full SHA for 367c7a6 - Browse repository at this point
Copy the full SHA 367c7a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 536fb90 - Browse repository at this point
Copy the full SHA 536fb90View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5745c03 - Browse repository at this point
Copy the full SHA 5745c03View commit details -
Configuration menu - View commit details
-
Copy full SHA for df23cf5 - Browse repository at this point
Copy the full SHA df23cf5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3522224 - Browse repository at this point
Copy the full SHA 3522224View commit details -
Configuration menu - View commit details
-
Copy full SHA for c38d4f6 - Browse repository at this point
Copy the full SHA c38d4f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for c0f67ec - Browse repository at this point
Copy the full SHA c0f67ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for a1ebfad - Browse repository at this point
Copy the full SHA a1ebfadView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0263d7f - Browse repository at this point
Copy the full SHA 0263d7fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3e0fbfc - Browse repository at this point
Copy the full SHA 3e0fbfcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 30e3463 - Browse repository at this point
Copy the full SHA 30e3463View commit details -
Configuration menu - View commit details
-
Copy full SHA for b133213 - Browse repository at this point
Copy the full SHA b133213View commit details -
Configuration menu - View commit details
-
Copy full SHA for 38b1e73 - Browse repository at this point
Copy the full SHA 38b1e73View commit details -
Configuration menu - View commit details
-
Copy full SHA for 82df911 - Browse repository at this point
Copy the full SHA 82df911View commit details -
Detect side effect matcher with qualifiers
Matchers with side effects with qualifiers were still aggregated, e.g.: is_expected.to allow_value('green').for(:color)
Configuration menu - View commit details
-
Copy full SHA for 9d613a7 - Browse repository at this point
Copy the full SHA 9d613a7View commit details -
Do not pretend to correct uncorrectable offenses
Previously, auto-correct run pretended it corrected the offenses, even though they were not.
Configuration menu - View commit details
-
Copy full SHA for aa2fd4a - Browse repository at this point
Copy the full SHA aa2fd4aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0237824 - Browse repository at this point
Copy the full SHA 0237824View commit details -
Configuration menu - View commit details
-
Copy full SHA for d6c2c37 - Browse repository at this point
Copy the full SHA d6c2c37View commit details -
[DO NOT SQUASH] Add support for adding docs from modules
Due to yard's override of docs when the docs are defined in several files for the same class ([see this issue](lsegal/yard#1173)), it's impossible to spread the docs to several files so that they are compiled into one document (e.g. a manual). Comparison using: RuboCop::Cop::Badge.for(code_object.to_s) == cop.badge makes it impossible to put the docs on the included module level without filtering out those modules for which a badge can't be inferred, because `RuboCop::Cop::Badge.for` raises an error.
Configuration menu - View commit details
-
Copy full SHA for 9e00508 - Browse repository at this point
Copy the full SHA 9e00508View commit details -
Configuration menu - View commit details
-
Copy full SHA for f1c0a23 - Browse repository at this point
Copy the full SHA f1c0a23View commit details -
Configuration menu - View commit details
-
Copy full SHA for ad16b40 - Browse repository at this point
Copy the full SHA ad16b40View commit details -
Configuration menu - View commit details
-
Copy full SHA for abe9f0e - Browse repository at this point
Copy the full SHA abe9f0eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2bba4e4 - Browse repository at this point
Copy the full SHA 2bba4e4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6c3afc1 - Browse repository at this point
Copy the full SHA 6c3afc1View commit details -
Configuration menu - View commit details
-
Copy full SHA for a5542f5 - Browse repository at this point
Copy the full SHA a5542f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for bfbe3f2 - Browse repository at this point
Copy the full SHA bfbe3f2View commit details