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

A big pile of refactoring #140

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Conversation

k-stewart
Copy link
Contributor

@k-stewart k-stewart commented May 10, 2018

  • Move PhantomJS logic into its own files, so we can easily swap it out with something else
  • remove unused methods
  • separate concerns
  • split multi-concern files into single-concern files
  • use class << self when there are more than one class method
  • simplify a bunch of if trees and case switches
  • remove some unnecessary cross-object dependencies
  • DRY up duplicated logic
  • use .map instead of .each when the only goal is to push things to an array

@k-stewart k-stewart requested review from wioux and j-ro May 11, 2018 00:10
@k-stewart
Copy link
Contributor Author

Tagging @wioux and @j-ro as people who might have opinions about these changes; feel free to unassign yourselves

@j-ro
Copy link
Collaborator

j-ro commented May 11, 2018

We're pretty behind the master branch and don't generally keep up (and I'm not a developer exactly myself), so I don't have many opinions. I'd just say please keep the documentation updated as to any changes in the front-facing API (rake tasks, etc...).

@k-stewart
Copy link
Contributor Author

Will do.

Removes aliases that make common congress_member instance methods
into class methods.  I wonder why those seemed useful.
* shorten long lines
* move single-use method into the only place it's used
    * DRY up last_response_json
    * use `let` to create instance methods
    * use string interpolation instead of `'' + foo.to_s`
* break the crazy-long execute method into smaller methods
* move some code that doesn't pertain to the model out of the model
* fewer nested if statements
* put `extends` calls and ActiveRecord methods at the top of the file
* don't pass the CongressMember, the record already knows its CongressMember.
* remove unused `fill_out_form!` method
* shallower if statments
* move code into named methods
Split the giant factories.rb into smaller, single-model factories.
Move the list into a constant that the wider app can rely on
* Everything is a class method; use class << self instead of declaring
individually
* Remove unused methods
Smaller, more focused files are more legible than larger ones.
* delegate to a named scope in CongressMemberAction
* use new hash syntax
Now it will be easy to swap out PhantomJS with something else!
* the CongressMemberAction model doesn't need to know about Capybara,
* move screenshot methods into their own file
Pull the logic into a tidy lib class
* code style consistency
* DRY up repeated logic
* keep constants in one place
* more expressive names
* DRY up repeated logic
* use .map instead of instantiating and pushing to an ary
* fix some typos
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

Successfully merging this pull request may close these issues.

2 participants