Skip to content
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

Cop Idea: Repeated Description in Same Example Group #258

Closed
backus opened this issue Dec 23, 2016 · 9 comments
Closed

Cop Idea: Repeated Description in Same Example Group #258

backus opened this issue Dec 23, 2016 · 9 comments

Comments

@backus
Copy link
Collaborator

backus commented Dec 23, 2016

This issue is very common: rubocop/rubocop#3816 (comment)

Basically, it is easy for people to bootstrap tests they write by copying the previous and forgetting to change the description string. We should consider flagging this if the repeated description is not inside a new context, description, shared_example, etc.

@backus
Copy link
Collaborator Author

backus commented Dec 23, 2016

@andyw8 @bquorning @dgollahon what do you think?

@andyw8
Copy link
Collaborator

andyw8 commented Dec 23, 2016

I haven't run into this very often, but I see no problem with adding a check for it.

@dgollahon
Copy link
Contributor

@backus: I think it's interesting and probably helpful for writing more descriptive tests. I wonder if it should be enabled by default or at what sensitivity though--It might be a little much to have every duplicate flagged by default. It would be interesting to see how many offenses you get on popular / large codebases.

@backus
Copy link
Collaborator Author

backus commented Dec 24, 2016

@dgollahon true. I'll try it on our private codebase and a few others I contribute to see how many false positives there are.

@andyw8
Copy link
Collaborator

andyw8 commented Dec 25, 2016

If you can put on a branch, I can try running it on some repos too.

@backus
Copy link
Collaborator Author

backus commented Dec 26, 2016

@andyw8 see #259

@backus
Copy link
Collaborator Author

backus commented Dec 26, 2016

This cop found a few violations in rubocop-rspec that I fixed :)

@backus
Copy link
Collaborator Author

backus commented Dec 26, 2016

I ran this cop on rubocop's specs. I think rubocop/rubocop#3828 demonstrates that this cop is pretty helpful.

@backus
Copy link
Collaborator Author

backus commented Dec 28, 2016

Implemented in #259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants