README.md in lint_trap-0.0.10 vs README.md in lint_trap-0.0.11

- old
+ new

@@ -1,10 +1,10 @@ # LintTrap -[ ![Codeship Status for lintci/lint_trap](https://codeship.io/projects/2ce67c60-0c55-0132-9858-121f4cfeea24/status)](https://codeship.io/projects/32171) +[![Circle CI](https://circleci.com/gh/lintci/lint_trap.svg?style=svg)](https://circleci.com/gh/lintci/lint_trap) -Parses the output of various linters. Designed for usage with [permpress](https://github.com/lintci/permpress) on [LintCI](http://www.lintci.com). +Detects languages of files, determines appropriate linters, and runs then. Created for [LintCI](http://www.lintci.com). ## Installation Add this line to your application's Gemfile: @@ -20,22 +20,39 @@ $ gem install lint_trap ## Usage +### Language Detection + ``` ruby require 'lint_trap' -require 'stringio' -# This would typically be a stdout for another process -io = StringIO.new("bad.rb:2:7:4:Style/MethodName:convention:Use snake_case for methods.\n") +language = LintTrap::Language.detect('bad.rb') +language.name #=> 'Ruby' +language.linters #=> [<Rubocop>] +``` -LintTrap.parse('rubocop', io) do |violation| - puts violation.inspect +### Linting + +``` ruby +require 'lint_trap' + +container = LintTrap::Container::Docker.new('lintci/lint_trap') +linter = LintTrap::Linter.find('RuboCop') + +linter.run(['bad.rb'], container, {}) do |violation| + violation #=> { + # file: 'bad.rb', + # line: '2', + # column: '7', + # length: '4', + # rule: 'Style/MethodName', + # severity: 'convention', + # message: 'Use snake_case for methods.' + # } end -# Output -# {:file=>"bad.rb", :line=>"2", :column=>"7", :length=>"4", :rule=>"Style/MethodName", :severity=>"convention", :message=>"Use snake_case for methods."} ``` ## Contributing 1. Fork it ( https://github.com/[my-github-username]/lint_trap/fork )