forked from rubocop/rubocop-rspec
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Disable RSpec/LetSetup cop by default #1
Closed
dpisarewski
wants to merge
210
commits into
andyw8:master
from
dpisarewski:feature/disable_let_setup
Closed
Disable RSpec/LetSetup cop by default #1
dpisarewski
wants to merge
210
commits into
andyw8:master
from
dpisarewski:feature/disable_let_setup
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change allows removal of the private method `#node_children` as well as node type checking within loops in `#top_level_nodes` and `#describe_statement_children` by replacing it with `#each_child_node`.
…evel-describe Simplify `TopLevelDescribe` using `#each_child_node`
Add SingleArgumentMessageChain cop
Renames `#to_node_pattern` to `#node_pattern`
Resolves duplicated pattern definitions of the formats (block (send _ #{SELECTOR_SET.node_pattern_union})) and (send _ #{SELECTOR_SET.node_pattern_union})
Refactor selector set
Detect repeated descriptions in example groups
These objects wrap RuboCop::Node objects in order to unify traversal and also clarify how certain nodes are being accessed.
Extract RuboCop::RSpec::{Example,ExampleGroup}
Fix expect violation to match rubocop's offense highlighting behavior
Bump version to 1.9.0
Previously, MultipleExpectations depended on ConfigurableMax defining the method `parameter_name`. This method name changed on the most recent (unreleased) version of rubocop and this broke the cop. Probably safer for us to rely on the literal until the public API for rubocop is clear
The changes in bd88c07 changes the node pattern for NestedGroups from (block (send nil [SELECTORS UNION PATTERN] ...) (args) ...) to (block (send _ [SELECTORS UNION PATTERN] ...) ...) which led to issue rubocop#270 being reported. While this did introduce a change in behavior, it helped reveal an inconsistency in the implementation. With the change mentioned above, the following code generated an offense when it didn't in 1.8.0 RSpec.describe Foo do context 'bar' do it 'baz' do expect(foo).to_not be(1) expect(foo).not_to be(1) end end describe '#qux' do context 'when quuz' do it 'zyxxy' do pass end end end end the following nearly equivalent code *did* generate an offense in 1.8 though: describe Foo do context 'bar' do it 'baz' do expect(foo).to_not be(1) expect(foo).not_to be(1) end end describe '#qux' do context 'when quuz' do it 'zyxxy' do pass end end end end The problem was that the previous node pattern would only start counting nesting at the first bare `describe` or `context` and would not count `RSpec.describe`. It was also probably much less efficient since it was searching through all nodes inside every example group instead of only searching from top level describes. This change fixes rubocop#270 by starting a search at the top level describe and properly handle `RSpec.describe` like `describe`. This change also convinced me that the current default for NestedGroups is too aggressive. Almost all of the specs that I write use `RSpec.describe` which means that rubocop-rspec was more lenient for my tests. The default MaxNesting is now 3 instead of 2.
Fix bad NestedGroups top level describe behavior
Bump version to 1.9.1
Fix broken reference to RuboCop::Node
Show actual/max value in multiple expectations cop
…o_language Add subject! to Language module
- Fixes rubocop violations that are now occuring due to the new rubocop release and the corresponding change in the community style guide.
Update array delimiter style
…ith-hash Fix suggestion when the argument is a hash. Fixes rubocop#267
- Fixes rubocop#402 - Previously the #on_block method would correctly flag cases of leading `it` and `should` case-insensitively by downcasing the docstring but in the autocorrect phase the message casing was left untouched which caused a nil bug for upper cased `Should`s, `IT`s, etc. - Prevents words starting with `should` from being flagged * ex: `it 'shoulders the burden' {}` - Improves `shouldn't be` handling * original docstring: `shouldn't be true` * correction before: `does not be true` * correction after: `is not true` - Fixes the pluralizer so that it is not confused by uppercase letters * original docstrings: `should WISH ME LUCK`, `should WORRY` * corrections before: `WISHs ME LUCK`, `WORRYs` * corrections after: `WISHES ME LUCK`, `WORRIES` - If a whole word being corrected is completely uppercase, the suffix appended will also be uppercase. If the word is mixed case, the lowercase suffix will be appended. - Performs general refactoring.enter the commit message for your changes. Lines starting - Adds pluralization support for words ending in `z` * ex: `buzz` -> `buzzes`
…rrect Fix example wording autocorrect
Fix IteratedExpectation crashing when there is an assignment in the iteration
Bump version to 1.15.1
- Drops dependency on concord - Drops dependency on anima - Drops dependency on adamantium See also rubocop/rubocop#3905
Rename ExpectViolation to ExpectOffense
I have been reworking this code so that I can upstream it to RuboCop proper. See rubocop/rubocop#4337 This implementation is much simpler. We simply split out the annotation lines from the source and initialize an `AnnotatedSource` object. We can provide an array of offenses to the `AnnotatedSource` instance and get back a new `AnnotatedSource` instance representing the real offenses. `AnnotatedSource` instances then generate an annotated source string (just like what is provided to the matcher) so we can compare the strings and get a nice RSpec diff in the output if they don't match. Way simpler AND way nicer to work with thanks to RSpec's diffs.
…tcher Refactor ExpectOffense implementation
…attributes-defined-statically-on-factories Forbids dynamic attributes defined statically on factories
Fix style for RuboCop 0.49.
Add cops for aligning let braces
Add LetBeforeExamples cop
The latest cops (from rubocop#413) depend on the new `Cop.autocorrect_incompatible_with` method so that autocorrect does not immeditately clash with the `ExtraSpacing` autocorrect and create an infinite loop.
…straint Depend on latest RuboCop
This cop checks if example group defines `subject` multiple times. ```ruby describe Foo do subject(:user) { User.new } subject(:post) { Post.new } end describe Foo do let(:user) { User.new } subject(:post) { Post.new } end ``` The autocorrect behavior for this cop depends on the type of duplication: - If multiple named subjects are defined then this probably indicates that the overwritten subjects (all subjects except the last definition) are effectively being used to define helpers. In this case they are replaced with `let`. - If multiple unnamed subjects are defined though then this can *only* be dead code and we remove the overwritten subject definitions. - If subjects are defined with `subject!` then we don't autocorrect. This is enough of an edge case that people can just move this to a `before` hook on their own Closes rubocop#419
Add MultipleSubjects cop
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See issue rubocop#94