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

Remove isolated useless assignments #3724

Merged
merged 8 commits into from
Sep 25, 2019
Merged

Conversation

javierm
Copy link
Member

@javierm javierm commented Sep 25, 2019

Objectives

  • Reduce the number of useless assignment warnings given by the Ruby interpreter
  • Make it easier to find warnings which happen due to actual bugs in the code

Notes

In this pull request we're only removing the useless assignments which don't affect code legibility at all.

@javierm javierm added the Linters Rubocop, ERB Lint, ESLint, SCSS-Lint, ... label Sep 25, 2019
@javierm javierm self-assigned this Sep 25, 2019
@javierm javierm added this to Reviewing in Roadmap via automation Sep 25, 2019
spec/features/debates_spec.rb Show resolved Hide resolved
spec/features/debates_spec.rb Show resolved Hide resolved
spec/features/debates_spec.rb Show resolved Hide resolved
spec/shared/features/relationable.rb Show resolved Hide resolved
spec/shared/features/mappable.rb Show resolved Hide resolved
Boolean arguments are harder to read, so we added a useless variable.
This is the perfect scenario for a named parameter.
The same way it's done in other places. We also remove a useless
assignment.
It doesn't really affect the tests, but it helps isolate useless
assignments, and we already did it this way 94% of the time.
These variables are not surrounded by other assignments, and so they can
safely be removed without making it harder to read the code vertically.
While there are other variables in these tests, they're not part of the
setup of the test, and so these ones can be removed while keeping the
code easy to read.
We also remove useless assignments, and use a neutral email address in
the sample data.
@javierm javierm changed the base branch from simplify_poll_factories to master September 25, 2019 12:42
@javierm javierm merged commit 5463753 into master Sep 25, 2019
Roadmap automation moved this from Reviewing to Release 1.1.0 Sep 25, 2019
@javierm javierm deleted the isolated_unused_variables branch September 25, 2019 12:54
smarques pushed a commit to venetochevogliamo/consul that referenced this pull request Apr 29, 2020
…ariables

Remove isolated useless assignments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linters Rubocop, ERB Lint, ESLint, SCSS-Lint, ...
Projects
No open projects
Roadmap
  
Release 1.1.0
Development

Successfully merging this pull request may close these issues.

None yet

2 participants