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

Ht 3192 enumbug #135

Merged
merged 2 commits into from
Sep 28, 2021
Merged

Ht 3192 enumbug #135

merged 2 commits into from
Sep 28, 2021

Conversation

mwarin
Copy link
Contributor

@mwarin mwarin commented Sep 24, 2021

Not a solution to the problem, but a change to make the warnings make more sense.

@mwarin
Copy link
Contributor Author

mwarin commented Sep 24, 2021

offending enumchrons listed in https://tools.lib.umich.edu/jira/browse/HT-3192

@mwarin mwarin marked this pull request as ready for review September 24, 2021 21:39
Copy link
Member

@aelkiss aelkiss left a comment

Choose a reason for hiding this comment

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

So this fix makes the warning more readable, but it doesn't prevent the underlying problem with the exception being thrown.

To be clear, I don't think we need to make it so that the offending enumchron is parseable in any meaningful way. However, I think we should try to avoid it throwing the undefined method 'gsub!' for nil:NilClass exception internally. Looking at where that's happening:

input_str = input_str.gsub!(m[0], "")

it looks like the issue is that input_str is nil at that point. I don't really understand how that would happen just looking at the code (in particular I don't understand how a nil string could match the regexp, and I don't understand how the string could end up being transformed into nil), but I do think it's worth tracing that path with an offending enumchron.

@aelkiss
Copy link
Member

aelkiss commented Sep 27, 2021

The problem is that:

input.gsub!("not_in_string","replacement") 

returns nil if input does not contain not_in_string.

We should change this to either:

input_str = input_str.gsub(m[0], "")

Or, probably my preference at this point given that we're already mutating input_str a bunch:

input_str.gsub!(m[0], "")

There are several other places we're doing the same thing, so we should probably just review all uses of gsub! and make sure we are using it consistently and correctly.

@mwarin
Copy link
Contributor Author

mwarin commented Sep 28, 2021

The problem is that:
...
There are several other places we're doing the same thing, so we should probably just review all uses of gsub! and make sure we are using it consistently and correctly.

Took care of it.

Copy link
Member

@aelkiss aelkiss left a comment

Choose a reason for hiding this comment

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

LGTM 🌭

@mwarin mwarin merged commit 751439e into master Sep 28, 2021
@aelkiss aelkiss deleted the HT-3192-enumbug branch October 1, 2021 14:50
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