Module: Codeqa

Defined in:
lib/codeqa/utils/erb_sanitizer.rb,
lib/codeqa.rb,
lib/codeqa/runner.rb,
lib/codeqa/checker.rb,
lib/codeqa/version.rb,
lib/codeqa/installer.rb,
lib/codeqa/sourcefile.rb,
lib/codeqa/configuration.rb,
lib/codeqa/runner_decorator.rb,
lib/codeqa/checkers/check_erb.rb,
lib/codeqa/checkers/check_pry.rb,
lib/codeqa/utils/check_errors.rb,
lib/codeqa/checkers/check_yard.rb,
lib/codeqa/checkers/check_linkto.rb,
lib/codeqa/checkers/rubocop_full.rb,
lib/codeqa/checkers/rubocop_lint.rb,
lib/codeqa/checkers/check_conflict.rb,
lib/codeqa/checkers/check_erb_html.rb,
lib/codeqa/checkers/html_validator.rb,
lib/codeqa/checkers/pattern_checker.rb,
lib/codeqa/checkers/check_rspec_focus.rb,
lib/codeqa/checkers/check_ruby_syntax.rb,
lib/codeqa/checkers/rubocop_formatter.rb,
lib/codeqa/checkers/check_strange_chars.rb,
lib/codeqa/checkers/check_utf8_encoding.rb

Overview

Defined Under Namespace

Modules: Checkers Classes: CheckErrors, Checker, Configuration, ErbSanitizer, Installer, Runner, RunnerDecorator, Sourcefile

Constant Summary collapse

CODEQA_HOME =
Pathname.new(File.join(File.dirname(__FILE__), '..')).realpath
VERSION =
'0.5.0'

Class Method Summary collapse

Class Method Details

.check(filename, options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/codeqa.rb', line 15

def check(filename, options={})
  options = { :silent_success => false, :silent => false }.merge(options)
  runner = runner(filename)
  if runner.success?
    $stdout.puts(runner.display_result) unless options[:silent_success] || options[:silent]
    true
  else
    $stderr.puts runner.display_result unless options[:silent]
    false
  end
end

.configurationObject



81
82
83
# File 'lib/codeqa/configuration.rb', line 81

def configuration
  @configuration ||=  Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



85
86
87
88
# File 'lib/codeqa/configuration.rb', line 85

def configure
  yield(configuration) if block_given?
  Codeqa.register_checkers
end

.install(root = '.') ⇒ Object



10
11
12
13
# File 'lib/codeqa.rb', line 10

def install(root='.')
  require 'codeqa/installer'
  Codeqa::Installer.call(root)
end

.register_checkersObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/codeqa.rb', line 32

def register_checkers
  Codeqa::Runner.reset_checkers
  configuration.enabled_checker.each do |checker|
    begin
      checker_klass = Codeqa::Checkers.const_get(checker)
      next unless checker_klass.available?
      Codeqa::Runner.register_checker checker_klass
    rescue
      "checker <#{checker}> not known"
    end
  end
end

.rootObject



6
7
8
# File 'lib/codeqa.rb', line 6

def root
  CODEQA_HOME
end

.runner(filename) ⇒ Object



27
28
29
30
# File 'lib/codeqa.rb', line 27

def runner(filename)
  sourcefile = Codeqa::Sourcefile.new(filename)
  Codeqa::Runner.run(sourcefile)
end