<commit_before>require 'rake/clean'
require 'rspec/core/rake_task'

CLEAN.include 'doc'
CLEAN.include 'coverage'
CLEAN.include '*.gem'
CLEAN.include '.yardoc'

desc 'Run specs.'
task :default => :spec

desc 'Run specs.'
RSpec::Core::RakeTask.new :spec do |t|
  t.ruby_opts = ['-w']
end

desc 'Generate SimpleCov spec coverage.'
RSpec::Core::RakeTask.new :coverage do |t|
  t.rspec_opts = ['--require simplecov_helper']
end

desc 'Build the gem.'
task :build do
  sh "gem build #{name}.gemspec"
end

desc 'Install the gem'
task :install do
  sh "gem install ./#{name}-#{version}.gem"
end

desc 'Uninstall the gem'
task :uninstall do
  sh "gem uninstall #{name}"
end

def name
  @name ||= Dir['*.gemspec'].first.split('.').first
end

def version
  text = File.read("lib/#{name}/version.rb")
  text = text[/^\s*VERSION\s*=\s*.*/]
  @version ||= text.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
end<commit_msg>Flog is useful. Adding a Rake task to run it.<commit_after>require 'rake/clean'
require 'rspec/core/rake_task'

CLEAN.include 'doc'
CLEAN.include 'coverage'
CLEAN.include '*.gem'
CLEAN.include '.yardoc'

desc 'Run specs.'
task :default => :spec

desc 'Run specs.'
RSpec::Core::RakeTask.new :spec do |t|
  t.ruby_opts = ['-w']
end

desc 'Generate SimpleCov spec coverage.'
RSpec::Core::RakeTask.new :coverage do |t|
  t.rspec_opts = ['--require simplecov_helper']
end

desc 'Build the gem.'
task :build do
  sh "gem build #{name}.gemspec"
end

desc 'Install the gem'
task :install do
  sh "gem install ./#{name}-#{version}.gem"
end

desc 'Uninstall the gem'
task :uninstall do
  sh "gem uninstall #{name}"
end

begin
  gem 'flog'
  desc 'Flog the code'
  task :flog, [:flags] do |t, args|
    flags = args[:flags] ? "-#{args[:flags]}" : ''
    files = FileList['lib/**/*.rb'].join(' ')
    sh "flog #{flags} #{files}"
  end
rescue Gem::LoadError
end

def name
  @name ||= Dir['*.gemspec'].first.split('.').first
end

def version
  text = File.read("lib/#{name}/version.rb")
  text = text[/^\s*VERSION\s*=\s*.*/]
  @version ||= text.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
end
{'fraction_non_alphanumeric': 0.19778633301251203, 'fraction_numerical': 0.0009624639076034649, 'mean_word_length': 4.046116504854369, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2164419', 'n_tokens_mistral': 798, 'n_tokens_neox': 793, 'n_words': 216}