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

Pure autocorrect #152

Merged
merged 3 commits into from
Apr 18, 2018
Merged

Pure autocorrect #152

merged 3 commits into from
Apr 18, 2018

Conversation

atz
Copy link
Contributor

@atz atz commented Apr 14, 2018

Cherry-picked from #137. This should be easy to digest as (almost) entirely a bunch of repetitive changes. With the exception of one file (resolving conflicts), all the code changes were done mechanically via rubocop based on .rubocop_todo.yml.

If a particular style enforced by the tool is objectionable, then IMO, the proper reaction is to add exceptions or configuration to .rubocop.yml. It is counterproductive to leave "offenses" listed in a TODO file documented as: The point is for the user to remove these configuration records one by one as the offenses are removed from the code base.

@coveralls
Copy link

coveralls commented Apr 14, 2018

Coverage Status

Coverage decreased (-0.05%) to 98.205% when pulling 3a86684 on pure_autocorrect into 916cb19 on master.

@atz
Copy link
Contributor Author

atz commented Apr 14, 2018

If this gets merged, I'll probably close #137 since there I drifted off into trying to rework test that were previously insufficiently differentiated.

Copy link
Member

@jmartin-sul jmartin-sul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing that looks like it contradicts an intention stated in the prior commit, but otherwise looks good to me.

other_checksums = other.checksums
matching_keys = self_checksums.keys & other_checksums.keys
return false if matching_keys.size == 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the intent according to this comment:
27db283#diff-11a0d7906801d9dea0eccb85667ad811R75

seemed to be to keep #size == 0 instead of switching to #empty, for compatibility's sake?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only matters when called on Pathname objects, which don't have empty? on old rubies. Here, it is called on an Array, and that's fine.

group_addtions.add_file_instance(file.signature, file.instances[0])
end
end
version_additions.groups << group_addtions if group_addtions.files.size > 0
version_additions.groups << group_addtions unless group_addtions.files.empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto the compatibility question from the prior comment

@@ -124,7 +128,7 @@ def generate_content_metadata(file_group, object_id, version_id)
# @return [Boolean] True if contentMetadata has essential file attributes, else raise exception
def validate_content_metadata(content_metadata)
result = validate_content_metadata_details(content_metadata)
raise Moab::InvalidMetadataException, result[0] + " ..." if result.size > 0
raise Moab::InvalidMetadataException, result[0] + " ..." unless result.empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto empty? (and a few more below, won't mark the rest from here out)

Copy link
Member

@jmartin-sul jmartin-sul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was misunderstanding, #empty can be called on things other than Pathname objects.

@jmartin-sul jmartin-sul merged commit dd867db into master Apr 18, 2018
@jmartin-sul jmartin-sul deleted the pure_autocorrect branch April 18, 2018 19:40
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.

None yet

4 participants