Skip to content

Invalid byte sequence when running on CI #12

@olliebennett

Description

@olliebennett

When running Ruumba on our CI (continuous integration) system, it's failing with the backtrace below (triggered on this line).

Any idea what I can do to fix this? It doesn't appear specifically related to this gem, but I've tried workarounds mentioned elsewhere (setting LC_ALL and LANG env vars).

We experienced similar problems (again, on CI only) with Brakeman - presidentbeef/brakeman#102. In that case, setting LC_ALL as suggested fixed the problem. No luck with Ruumba.

Is it possible that this gem could rescue the exception, and identify any incorrectly formatted/encoded files in some way, rather than crashing?

bash: warning: setlocale: LC_ALL: cannot change locale (en_GB.UTF-8)
/pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:58:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:58:in `parse_file'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:37:in `extract'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:105:in `block (2 levels) in copy_erb_files'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:104:in `open'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:104:in `block in copy_erb_files'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:100:in `each'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:100:in `copy_erb_files'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/lib/ruumba/analyzer.rb:29:in `run'
	from /pipeline/cache/bundle-install/ruby/2.4.0/gems/ruumba-0.1.3/bin/ruumba:70:in `<top (required)>'
	from /pipeline/cache/bundle-install/ruby/2.4.0/bin/ruumba:25:in `load'
	from /pipeline/cache/bundle-install/ruby/2.4.0/bin/ruumba:25:in `<main>'

The script used to execute ruumba (bin/ruumba) is:

#!/usr/bin/env bash

bundle exec ruumba -D -e app/views -c .ruumba.yml

Running bin/ruumba on my local system runs smoothly (reporting "no offenses detected").

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions