Address some Rubocop validation errors #984
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/FindEachUpdated some
.where.first
to.find_by
to fix Rails/FindByTabbed 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/*