checking non-ASCII files with reek

reek doesn’t offer a direct way to specify that your source file is UTF-8 or such, but there is a workaround if you need it. reek 0.3.0 introduced Reek::RakeTask, which makes it easy to run reek from a rakefile. And this task has an attribute ruby_opts, which is an array of strings to be passed as arguments directly to the Ruby interpreter. So you can use reek to check for smells in non-ASCII files by adding something like this to your rakefile:


require 'reek/rake_task'

Reek::RakeTask.new('utf8_file') do |t|
t.source_files = 'my_utf8_file.rb'
t.ruby_opts = ['-Ku']
end

Not ideal, I know; so if there’s sufficient outcry, I’ll consider adding either a -K or a –ruby-opts to reek.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s