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 obsolete code #3730

Merged
merged 18 commits into from
Sep 29, 2019
Merged

Remove obsolete code #3730

merged 18 commits into from
Sep 29, 2019

Conversation

javierm
Copy link
Member

@javierm javierm commented Sep 26, 2019

References

Objectives

  • Remove useless code we've accidentally left
  • Reduce the number of unused variable warnings given by the Ruby interpreter
  • Fix typos

@javierm javierm self-assigned this Sep 26, 2019
@javierm javierm added this to Reviewing in Roadmap via automation Sep 26, 2019
@javierm javierm changed the base branch from fix_extra_records to master September 29, 2019 20:25
Now the test makes more sense, since it checks the third message for the
same sender is valid.
The test passed even if proposal recommendations returned archived
proposals, because we forgot to add the tag list the user is interested
in.
These tests are only checking which proposals are not included in the
recommendations, so we don't need to sort the included ones, just like
we don't use the cached votes up attribute in the tests preceeding these
ones.
This method isn't used since commit e47cbe2, where we replaced it with
`headings_voted_within_group`.
The group is automatically assigned when we assign the heading. The
budget isn't needed either, except for a special case related to the
reason to be rejected.
The file name finished with `_specs.rb` instead of `_spec.rb`, and so it
wasn't being tested at all.
This way we can be more flexible about the factory we can pass as
parameter.
These specs had never been tested before and were always broken.
We were using the same order for most commented and for newest, so the
test wasn't as effective as it could be.
The valuation comment doesn't show up in the comment show action because
it's not a child of the parent comment. With a regular comment, the test
passes as well.

However, if we make the valuation comment a child of the parent comment,
it shows up both in the index and show actions. That's because the
method `root_descendants` in the `CommentTree` class doesn't filter
valuation comments. I'm not sure whether it's a bug or the intended
behaviour.
The attribute made sense before we changed it in commit ba1a6b4. Since
then, all milestones have the same date, so the attribute doesn't affect
the test at all.
Apparently we forgot to use the variables which meant the tests weren't
testing exactly what they were supposed to test.
The `create_proposal_notification` method won't create a new
notification when a proposal has no supporters, so in the test
`notification3` was actually the same as `notification2`, related to
`proposal2`.
This is one of the most strange behaviours in ruby: if a variable
doesn't exist, assigning to itself will return `nil`.

So a line like:

mdmkdfm = ooops if mdmkdfm.respond_to?(:uiqpior)

Surprisingly will not raise any errors: the nonexistent `mdmkdfm`
variable will be evaluated to `nil`, `mdmkdfm.respond_to?(:uiqpior)`
will evaluate to `nil.respond_to?(:uiqpior)`, which will return `false`,
and then the line will be evaluated as `mdmkdfm = ooops if false`, which
will return `nil`.

Maybe in the future Ruby will change this behaviour. We hope CONSUL is
now in better shape if that ever happens :).
The instance variable was being evaluated to `nil`, and the budget was
automatically created by the `set_denormalized_ids` method in the budget
investment class.
These factories were only used in one place and they even declared ID
attributes. Using the comment factory with the `commentable` attribute
does the same thing.
@javierm
Copy link
Member Author

javierm commented Sep 29, 2019

Travis build failed due to issue #3703; not related to this pull request.

@javierm javierm merged commit 24f14ea into master Sep 29, 2019
Roadmap automation moved this from Reviewing to Release 1.1.0 Sep 29, 2019
@javierm javierm deleted the remove_obsolete_code branch September 29, 2019 21:25
smarques pushed a commit to venetochevogliamo/consul that referenced this pull request Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Roadmap
  
Release 1.1.0
Development

Successfully merging this pull request may close these issues.

None yet

2 participants