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

Address some Rubocop validation errors #984

Merged
merged 1 commit into from
Jan 5, 2019
Merged

Address some Rubocop validation errors #984

merged 1 commit into from
Jan 5, 2019

Conversation

Marri
Copy link
Contributor

@Marri Marri commented Jan 5, 2019

  • Per this issue, read_attribute(:attr) and self[:attr] are not in fact equivalent, specifically around handling attributes which aren't found. Therefore I have disabled Rails/ReadWriteAttribute since it appears to be out of date.

  • Since post_scraper.rb is run by us in the command line, it's fine to have output going to stdout instead of Rails.logger, so disabled Rails/Output for just that file.

  • Fixed a couple Style/ExpandPathArguments, one by actually fixing it and one by removing it (we do not need both bin/rails and script/rails)

  • Fixed a couple Rails/LexicallyScopedActionFilter by explicitly declaring CharactersController#icon

  • Fixed a Rails/TimeZone by using Time.new.utc for our example time in the time zone selector

  • Fixed by rescuing StandardError => e in place of generic => e

  • Fixed a few Rails/Present by swapping some blank?s with present?s and vice versa

  • Updated some .each to .find_each to fix Rails/FindEach

  • Updated some .where.first to .find_by to fix Rails/FindBy

  • Tabbed a begin/rescue block to fix a Layout/RescueEnsureAlignment

  • Lint/IneffectiveAccessModifier made me realize that PostScraper.valid_dreamwidth_url? is within a private but not actually private; since it is not supposed to be private (I tried, tests failed, private is wrong) I just moved it out of the private block.

This brings us from 146 Rubocop offenses to 124 offenses. Remaining offenses are primarily Rails/SaveBang and Rails/SkipsModelValidations and spec/*

read_attribute(:attr) and self[:attr] are not in
fact equivalent, specifically around handling attributes which aren't
found. Therefore I have disabled Rails/ReadWriteAttribute since it
appears to be out of date.

Since post_scraper.rb is run by us in the command line, it's fine to
have output going to stdout instead of Rails.logger, so disabled
Rails/Output for just that file.

Fixed a couple Style/ExpandPathArguments, one by actually fixing it and
one by removing it (we do not need both bin/rails and script/rails)

Fixed a couple Rails/LexicallyScopedActionFilter by explicitly declaring
CharactersController#icon

Fixed a Rails/TimeZone by using Time.new.utc for our example time in the
time zone selector

Fixed by rescuing StandardError => e in place of generic => e

Fixed a few Rails/Present by swapping some blank?s with present?s and
vice versa

Updated some .each to .find_each to fix Rails/FindEach

Updated some .where.first to .find_by to fix Rails/FindBy

Tabbed a begin/rescue block to fix a Layout/RescueEnsureAlignment

Lint/IneffectiveAccessModifier made me realize that
PostScraper.valid_dreamwidth_url? is within a private but not actually
private; since it is not supposed to be private (I tried, tests failed,
private is wrong) I just moved it out of the private block.
@Marri Marri merged commit 4773c57 into master Jan 5, 2019
@Marri Marri deleted the rubocop branch January 5, 2019 08:05
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.

1 participant