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

Issue with Encoding::CompatibilityError #283

Open
dwahyudi opened this issue Oct 19, 2018 · 2 comments
Open

Issue with Encoding::CompatibilityError #283

dwahyudi opened this issue Oct 19, 2018 · 2 comments

Comments

@dwahyudi
Copy link

dwahyudi commented Oct 19, 2018

Version
Ruby 2.3.0
RubyCritic 3.5.2

So I run rubycritic inside bitbucket pipelines, and this error happens.

Pipeline script:

image: ruby:2.3

pipelines:
  default:
    - step:
        name: install deps and bundler
        script:
          - export LANG=en_US.UTF-8
          - export LANGUAGE=en_US.UTF-8
          - export LC_ALL=en_US.UTF-8
          - apt-get update -qq && apt-get install -y build-essential libpq-dev mysql-client apt-transport-https ca-certificates unzip xvfb
          - gem install bundler --no-ri --no-rdoc
    - parallel:
      - step:
          name: clean code (rubycritic)
          caches:
            - bundle
          script:
            - gem install rubycritic --no-ri --no-rdoc
            - rubycritic -s 10.00 --no-browser app lib

Error:

+ rubycritic -s 10.00 --no-browser app lib
running flay smells
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................32
m...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
running flog smells
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
running reek smells
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
running complexity
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
running attributes
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
running churn
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
(erb):13:in `concat': incompatible character encodings: US-ASCII and UTF-8 (Encoding::CompatibilityError)
	from (erb):13:in `block in render'
	from (erb):4:in `each'
	from (erb):4:in `render'
	from /usr/local/lib/ruby/2.3.0/erb.rb:864:in `eval'
	from /usr/local/lib/ruby/2.3.0/erb.rb:864:in `result'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html/line.rb:22:in `render'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html/code_file.rb:42:in `block in render'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html/code_file.rb:39:in `each'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html/code_file.rb:39:in `with_index'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html/code_file.rb:39:in `render'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html_report.rb:36:in `block (2 levels) in create_directories_and_files'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html_report.rb:35:in `open'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html_report.rb:35:in `block in create_directories_and_files'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html_report.rb:33:in `each'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html_report.rb:33:in `create_directories_and_files'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/generators/html_report.rb:20:in `generate_report'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/reporter.rb:6:in `generate_report'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/commands/default.rb:29:in `report'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/commands/default.rb:19:in `execute'
	from /usr/local/bundle/gems/rubycritic-3.5.2/lib/rubycritic/cli/application.rb:20:in `execute'
	from /usr/local/bundle/gems/rubycritic-3.5.2/bin/rubycritic:10:in `<top (required)>'
	from /usr/local/bundle/bin/rubycritic:23:in `load'
	from /usr/local/bundle/bin/rubycritic:23:in `<main>'

I have no idea which code of mine causes this error.

@typhoon2099
Copy link

I'm hitting this issue too, 2 and a half years later. I shouldn't have any US-ASCII in my code, but I definitely have code which concerns itself with encoding conversions. I've already had to comment out an RSpec test which deliberately sets up invalid characters in a UTF-8 string as it was killing rubycritic.

@typhoon2099
Copy link

typhoon2099 commented Mar 17, 2021

Well, it seems that having a copyright symbol (©) at the top of any Ruby files will cause rubycritic to crap out, along with some other characters about the place, which I can't be bothered to track down. Looks like we won't be able to use this for the time being.

EDIT: Turns out it was the Docker image I'm running in, which had not been set to UTF-8 by default. Never mind!

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

No branches or pull requests

2 participants