lintci-rubocop 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2dc61b2d528a08e6bd89701daa429a9ab650d9fd
4
+ data.tar.gz: dd0831ea8c0f7d638883e764900d0d390ef9e453
5
+ SHA512:
6
+ metadata.gz: 532a0d6af40a40c48190a34e0105bfc229a62ac85e151be9db97180228840be8617b539e53f24046ae13ed5648a502bd6d58bb08672bff9a6c5035d937aabcac
7
+ data.tar.gz: 23be33086ac774d0f68f1d8872d4e676dd6d87b541bbb90ed1a8f765be199fae4f0b7026178d005b28fff32458bda5e2b20a70279c5b6af59d1b1cb0e9f62f44
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lintci-rubocop.gemspec
4
+ gemspec
5
+
6
+ gem 'pry-byebug'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Allen Madsen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # LintCI::Rubocop
2
+
3
+ Thin wrapper around rubocop that standardizes command and arguments for LintCI.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'lintci-rubocop'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install lintci-rubocop
18
+
19
+ ## Usage
20
+
21
+
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/lintci-rubocop/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'lintci/rubocop'
4
+ puts ARGV.inspect
5
+
6
+ LintCI::Rubocop::CLI.start(ARGV)
@@ -0,0 +1,5 @@
1
+ require 'rubocop'
2
+
3
+ require "lintci/rubocop/version"
4
+ require "lintci/rubocop/formatter"
5
+ require "lintci/rubocop/cli"
@@ -0,0 +1,25 @@
1
+ require 'thor'
2
+
3
+ module LintCI
4
+ module Rubocop
5
+ class CLI < Thor
6
+ desc 'lint [FILES]', 'Runs linter'
7
+ method_option :config, banner: 'CONFIG_FILE'
8
+
9
+ def lint(*files)
10
+ ::RuboCop::CLI.new.run(flags + files)
11
+ end
12
+
13
+ private
14
+
15
+ def flags
16
+ [
17
+ '--format', 'LintCI::Rubocop::Formatter',
18
+ '--no-color'
19
+ ].tap do |flags|
20
+ flags.concat(['--config', options[:config]]) if options[:config]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ require 'rubocop'
2
+
3
+ module LintCI
4
+ module Rubocop
5
+ class Formatter < ::RuboCop::Formatter::BaseFormatter
6
+ LINE_FORMAT = "%s:%d:%d:%d:%s:%s:%s\n"
7
+
8
+ def file_finished(file, offenses)
9
+ offenses.each do |offense|
10
+ line = offense.line
11
+ column = offense.real_column
12
+ length = offense.location.length
13
+
14
+ rule = offense.cop_name
15
+ severity = offense.severity.name
16
+ message = offense.message
17
+
18
+ output.printf(LINE_FORMAT, file, line, column, length, rule, severity, message)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Lintci
2
+ module Rubocop
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lintci/rubocop/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "lintci-rubocop"
8
+ spec.version = Lintci::Rubocop::VERSION
9
+ spec.authors = ["Allen Madsen"]
10
+ spec.email = ["blatyo@gmail.com"]
11
+ spec.summary = %q{A small wrapper around Rubocop that standardizes the command for LintCI}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'rubocop'
21
+ spec.add_runtime_dependency 'thor'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ end
@@ -0,0 +1,4 @@
1
+ class Bob
2
+ def xMan
3
+ end
4
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+ require 'pry'
3
+
4
+ describe LintCI::Rubocop::CLI do
5
+ describe '#lint' do
6
+ context 'when config flag is present' do
7
+ it 'delegates to rubocop with expected arguments' do
8
+ expect_any_instance_of(RuboCop::CLI).to receive(:run).with([
9
+ '--format', 'LintCI::Rubocop::Formatter',
10
+ '--no-color',
11
+ '--config', '.rubocop.yml',
12
+ 'good.rb', 'bad.rb'
13
+ ])
14
+
15
+ LintCI::Rubocop::CLI.start(['lint', '--config', '.rubocop.yml', 'good.rb', 'bad.rb'])
16
+ end
17
+ end
18
+
19
+ context 'when config flag is not present' do
20
+ it 'delegates to rubocop with expected arguments' do
21
+ expect_any_instance_of(RuboCop::CLI).to receive(:run).with([
22
+ '--format', 'LintCI::Rubocop::Formatter',
23
+ '--no-color',
24
+ 'good.rb', 'bad.rb'
25
+ ])
26
+
27
+ LintCI::Rubocop::CLI.start(['lint', 'good.rb', 'bad.rb'])
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe LintCI::Rubocop::CLI do
4
+ describe 'lint' do
5
+ around(:each) do |example|
6
+ $stdout, out = StringIO.new, $stdout
7
+ $stderr, err = StringIO.new, $stderr
8
+
9
+ example.run
10
+
11
+ $stdout, $stderr = out, err
12
+ end
13
+
14
+ let(:file){File.expand_path('../../../fixtures/bad.rb', __FILE__)}
15
+ let(:output){$stdout.string + $stderr.string}
16
+
17
+ it 'generates the expected output' do
18
+ LintCI::Rubocop::CLI.start(['lint', file])
19
+
20
+ expect(output).to eq(
21
+ "#{file}:1:1:5:Style/Documentation:convention:Missing top-level class documentation comment.\n"\
22
+ "#{file}:2:7:4:Style/MethodName:convention:Use snake_case for methods.\n"
23
+ )
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Lintci::Rubocop do
4
+ it 'has a version number' do
5
+ expect(Lintci::Rubocop::VERSION).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'lintci/rubocop'
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lintci-rubocop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Allen Madsen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - blatyo@gmail.com
86
+ executables:
87
+ - lintci-rubocop
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/lintci-rubocop
98
+ - lib/lintci/rubocop.rb
99
+ - lib/lintci/rubocop/cli.rb
100
+ - lib/lintci/rubocop/formatter.rb
101
+ - lib/lintci/rubocop/version.rb
102
+ - lintci-rubocop.gemspec
103
+ - spec/fixtures/bad.rb
104
+ - spec/lintci/rubocop/cli_spec.rb
105
+ - spec/lintci/rubocop/integration_spec.rb
106
+ - spec/lintci/rubocop_spec.rb
107
+ - spec/spec_helper.rb
108
+ homepage: ''
109
+ licenses:
110
+ - MIT
111
+ metadata: {}
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.2.2
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: A small wrapper around Rubocop that standardizes the command for LintCI
132
+ test_files:
133
+ - spec/fixtures/bad.rb
134
+ - spec/lintci/rubocop/cli_spec.rb
135
+ - spec/lintci/rubocop/integration_spec.rb
136
+ - spec/lintci/rubocop_spec.rb
137
+ - spec/spec_helper.rb