infertux / bashcov

Code coverage tool for Bash
MIT License
151 stars 20 forks source link

Bashcov::Detector: handle non-UTF-8 data #77

Closed tomeon closed 1 year ago

tomeon commented 1 year ago

Follow-up to #73 and #74. Recover from ArgumentError scanning through the first line of a file looking for a shell shebang (StringScanner raises an ArgumentError on bad/unexpected encodings/data).

infertux commented 1 year ago

Thank you, LGTM.

I wish we'd be able to rescue something more specific than ArgumentError though. I see there is a ScanError error but it's not used for unexpected encoding.

tomeon commented 1 year ago

I wish we'd be able to rescue something more specific than ArgumentError though.

Yeah, this is a bummer. I wonder what the bad argument is supposed to be, anyway? The data given to StringScanner.new? Or perhaps StringScanner is just bubbling up an ArgumentError from elsewhere? Didn't look too deeply into it.