Sha256: a8288f1b94198ee8226523d17887b1cfdc8c3ef095dca968622cd46b22084470
Contents?: true
Size: 1.7 KB
Versions: 4
Compression:
Stored size: 1.7 KB
Contents
#!/usr/bin/env ruby $: << File.join(File.dirname(__FILE__), '../lib') if ENV['CODEQA_DEV'] require 'rubygems' require 'codeqa' require 'pathname' require 'optparse' options = { :silent => false, :failfast => false } ARGV.options do |opts| opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [OPTIONS] FILES" opts.separator '' opts.separator 'Specific Options:' opts.on('-s', '--silent', 'No output') do options[:silent] = true end opts.on('-e', '--silent-success', 'only Output errors') do options[:silent_success] = true end opts.on('-f', '--fail-fast', 'Fail right after the first error.') do options[:failfast] = true end opts.on('-i', '--install', 'Install a basic pre-commit hook.') do options[:install] = true end opts.separator 'Common Options:' opts.on('-h', '--help', 'Show this message.') do puts opts exit end opts.on('-v', '--version', "Show version (it's #{Codeqa::VERSION})") do puts Codeqa::VERSION exit end begin opts.parse! rescue puts opts exit end end if options[:install] Codeqa.install(ARGV.first || '.') exit end exploded_args = ARGV.map do |e| if File.directory?(e) Dir["#{e}/**/*"] else e end end files_to_check = exploded_args. flatten. map{ |e| Pathname.new(e).realpath.to_s }. reject{ |e| File.directory?(e) || Codeqa.configuration.excluded?(e) }. uniq puts "#{files_to_check.count} files to check" unless options[:silent] if options[:failfast] # all? is already lazy/fail-fast so it will stop after the first false exit 1 unless files_to_check.all?{ |e| Codeqa.check(e, options) } else exit 1 unless files_to_check.map{ |e| Codeqa.check(e, options) }.all? end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
codeqa-0.4.2 | bin/codeqa |
codeqa-0.4.1 | bin/codeqa |
codeqa-0.4.0 | bin/codeqa |
codeqa-0.4.0.pre2 | bin/codeqa |