face_control 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b374e68daaa27205ecc59c9465ff8f11433bb5d1
4
- data.tar.gz: 3afdc0deb89bc2e385032c54c950e59d9d1b461d
3
+ metadata.gz: 4a232c3cf9da606837421e0f388819373c6aa46b
4
+ data.tar.gz: 07bedda93cc95dba9c5ea6b716c1f2c5e894506a
5
5
  SHA512:
6
- metadata.gz: 1ff712dbd9a72ac6612cd3e20974c82ae8aedb72fe97a00a388b7eab4857d03c0164970b9b156fc160c98ffb1a4b7d1a8e9a295685cf0b3838fd85aacb0fbdc2
7
- data.tar.gz: 9b7b31b34cc4b460c75066b463cd1bd20cb1752d056f102f490ca15a5b6c7ce86ced03b5265945a0dd5cdacb2ecffbebb2386f97c65842a3d94d7eb3e972b8e7
6
+ metadata.gz: 54fe2769b81e249dc71c9aac26bb8311b4f522999a4d181af30322c30e0e6dedaa1e2f2fc869bb13421bde49df9877728e38a16fbe8e9d1370dbbbf1e2b65bad
7
+ data.tar.gz: d7511c518230fa2200e9ec6da57522fbc3c23e5f049ff8e4207350f1df8017e187d4074e71ab8680d332ab8a048f708ca20dff06cd3cdec830cb3b10d52dc5d8
data/.rubocop.yml CHANGED
@@ -11,5 +11,8 @@ Style/FileName:
11
11
  Style/SpaceBeforeBlockBraces:
12
12
  EnforcedStyle: no_space
13
13
 
14
+ Style/SpaceInsideBlockBraces:
15
+ SpaceBeforeBlockParameters: false
16
+
14
17
  Style/SpaceInsideHashLiteralBraces:
15
18
  EnforcedStyle: no_space
data/.vexor.yml ADDED
@@ -0,0 +1,8 @@
1
+ rvm:
2
+ - 1.9
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
6
+
7
+ before_script:
8
+ - sudo npm install -g coffeelint
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Vexor](https://ci.vexor.io/projects/126da196-c8e6-46f0-8bc7-b5f8f4b49732/status.svg)](https://ci.vexor.io/ui/projects/126da196-c8e6-46f0-8bc7-b5f8f4b49732/builds)
2
+ [![Coveralls](https://img.shields.io/coveralls/vassilevsky/face_control.svg)](https://coveralls.io/github/vassilevsky/face_control)
3
+
1
4
  # Face Control
2
5
 
3
6
  Comment on added lines of pull requests in [Atlassian Stash][].
@@ -12,8 +15,6 @@ Inspired by [Hound][].
12
15
 
13
16
  ## Usage
14
17
 
15
- rubocop -f json -o rubocop.json
16
- coffeelint --reporter raw app/assets/javascripts > coffeelint_report.json
17
18
  face-control <project> <repository> <pull_request_id>
18
19
 
19
20
  It's natural to run this on a continuous integration server.
@@ -43,8 +44,6 @@ For example, here's a [Jenkins][] project setup:
43
44
  gem install rubocop face_control
44
45
  npm install -g coffeelint
45
46
 
46
- rubocop -f json -o rubocop.json || true
47
- coffeelint --reporter raw app/assets/javascripts > coffeelint_report.json || true
48
47
  face-control <project> <repository> $PULL_REQUEST_ID
49
48
 
50
49
  If you don't want to receive RuboCop comments with certain severity level,
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.test_files = FileList['test/**/*_test.rb']
7
+ t.warning = true
8
+ end
9
+
10
+ task :default => :test
data/TODO ADDED
@@ -0,0 +1 @@
1
+ * Warn if RuboCop version is too old (cannot reliably determine if an offense can be corrected automatically)
data/exe/face-control CHANGED
@@ -1,37 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'logger'
4
- require 'docopt'
5
3
  require 'face_control'
6
- require 'stash'
7
4
 
8
- begin
9
- USAGE = "#{File.dirname(__FILE__)}/../USAGE"
10
- args = Docopt.docopt(File.read(USAGE))
11
-
12
- project = args['<project>']
13
- repository = args['<repository>']
14
- pull_request_id = args['<pull_request_id>']
15
-
16
- ignored_severities = []
17
- if args['--skip-severity']
18
- ignored_severities = args['--skip-severity'].split(',')
19
- puts "Skipping RuboCop offenses with severities: #{ignored_severities.join(', ')}."
20
- end
21
-
22
- config = Stash::Config.new
23
- server = Stash::Server.new(config.host, config.user, config.password, Logger.new(STDOUT))
24
- repository = server.repository(project, repository)
25
- pull_request = repository.pull_request(pull_request_id)
26
-
27
- [
28
- FaceControl::Inputs::RubocopJson.new(ignored_severities),
29
- FaceControl::Inputs::CoffeeLintRaw.new
30
- ].each do |input|
31
- input.comments.each do |comment|
32
- pull_request.add_comment(comment.file, comment.line, comment.text)
33
- end
34
- end
35
- rescue Docopt::Exit => e
36
- puts e.message
37
- end
5
+ FaceControl::CLI.new.run
data/face_control.gemspec CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = 'Checks Atlassian Stash pull requests and comments on issues in added code'
13
13
  spec.homepage = 'https://github.com/vassilevsky/face_control'
14
14
 
15
- spec.files = `git ls-files -z`.split("\x0").reject{ |f| f.match(%r{^(test|spec|features)/}) }
15
+ spec.files = `git ls-files -z`.split("\x0").reject{|f| f.match(%r{^(test|spec|features)/}) }
16
16
  spec.bindir = 'exe'
17
- spec.executables = spec.files.grep(%r{^exe/}){ |f| File.basename(f) }
17
+ spec.executables = spec.files.grep(%r{^exe/}){|f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
20
  spec.add_runtime_dependency 'docopt'
@@ -23,4 +23,8 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.8'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'minitest', '~> 5.8'
27
+ spec.add_development_dependency 'minitest-reporters', '~> 1.0'
28
+ spec.add_development_dependency 'webmock', '~> 1.21'
29
+ spec.add_development_dependency 'coveralls', '~> 0.8'
26
30
  end
data/lib/face_control.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  require 'face_control/version'
2
+ require 'face_control/cli'
2
3
  require 'face_control/comment'
3
- require 'face_control/inputs'
4
+ require 'face_control/checker_runner'
5
+ require 'face_control/checkers'
@@ -0,0 +1,28 @@
1
+ module FaceControl
2
+ class CheckerRunner
3
+ def initialize(checker_class, filenames = [], options = {})
4
+ @checker = checker_class.new
5
+ if @checker.respond_to?(:options=)
6
+ @checker.options = options
7
+ end
8
+
9
+ @filenames = filenames
10
+ end
11
+
12
+ def comments
13
+ return [] if relevant_filenames.empty?
14
+
15
+ @checker.parse(`#{@checker.command(relevant_filenames.join(' '))}`)
16
+ end
17
+
18
+ private
19
+
20
+ def relevant_filenames
21
+ @relevant_filenames ||= @checker.relevant_globs.map do |glob|
22
+ @filenames.select do |filename|
23
+ File.fnmatch?(glob, filename)
24
+ end
25
+ end.flatten.uniq
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,2 @@
1
+ require 'face_control/checkers/rubocop'
2
+ require 'face_control/checkers/coffeelint'
@@ -0,0 +1,39 @@
1
+ require 'face_control/comment'
2
+
3
+ module FaceControl
4
+ module Checkers
5
+ class Example
6
+ # @optional
7
+ # Define only if you use @options in the following methods
8
+ attr_writer :options
9
+
10
+ # @return [Array<String>] Shell globs to filter only files relevant to this checker
11
+ # out of all files with added lines in the pull request
12
+ def relevant_globs
13
+ %w(bin/*)
14
+ end
15
+
16
+ # @param filenames [String] Files with added lines in the pull request
17
+ # only relevant to this checker (filtered by globs above)
18
+ # @return [String] Command line to check the files
19
+ def command(filenames)
20
+ "ls -l #{filenames}"
21
+ end
22
+
23
+ # @param command_output [String] Stdout of the command above
24
+ # @return Array<FaceControl::Comment> Comments to post to the pull request
25
+ def parse(command_output)
26
+ command_output.split("\n").map do |line|
27
+ fields = line.split
28
+
29
+ mode = fields.first
30
+ file = fields.last
31
+
32
+ if mode != '-rwxr-xr-x'
33
+ Comment.new(file: file, line: 1, text: 'Invalid file mode')
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,28 @@
1
+ require 'json'
2
+ require 'face_control/comment'
3
+
4
+ module FaceControl
5
+ module Checkers
6
+ class CoffeeLint
7
+ def relevant_globs
8
+ %w(*.coffee)
9
+ end
10
+
11
+ def command(filenames)
12
+ "coffeelint --reporter raw #{filenames}"
13
+ end
14
+
15
+ def parse(command_output)
16
+ JSON.parse(command_output).map do |file, problems|
17
+ problems.map do |problem|
18
+ Comment.new(
19
+ file: file,
20
+ line: problem['lineNumber'],
21
+ text: "(#{problem['level']}) #{problem['message']}"
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,21 +1,31 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'json'
2
4
  require 'rubocop'
3
5
  require 'face_control/comment'
4
6
 
5
7
  module FaceControl
6
- module Inputs
7
- class RubocopJson
8
- attr_accessor :ignored_severities, :filename
8
+ module Checkers
9
+ class RuboCop
10
+ attr_writer :options
9
11
 
10
- def initialize(ignored_severities = [], filename = 'rubocop.json')
11
- self.ignored_severities = ignored_severities
12
- self.filename = filename
12
+ def relevant_globs
13
+ %w(
14
+ *.rb
15
+ *.rake
16
+ Capfile
17
+ Gemfile
18
+ Rakefile
19
+ Vagrantfile
20
+ )
21
+ end
13
22
 
14
- fail "#{filename} does not exist" unless File.exist?(filename)
23
+ def command(filenames)
24
+ "rubocop --format json #{filenames}"
15
25
  end
16
26
 
17
- def comments
18
- report['files'].map do |file|
27
+ def parse(command_output)
28
+ JSON.parse(command_output)['files'].map do |file|
19
29
  file['offenses'].reject do |offense|
20
30
  ignored_severities.include?(offense['severity'])
21
31
  end.map do |offense|
@@ -25,13 +35,13 @@ module FaceControl
25
35
  text: text(offense, file)
26
36
  )
27
37
  end
28
- end.flatten
38
+ end
29
39
  end
30
40
 
31
41
  private
32
42
 
33
- def report
34
- JSON.parse(File.read(filename))
43
+ def ignored_severities
44
+ @options.fetch(:ignored_severities, [])
35
45
  end
36
46
 
37
47
  def text(offense, file)
@@ -50,7 +60,7 @@ module FaceControl
50
60
 
51
61
  def style_guide_url(offense)
52
62
  cop_name = offense['cop_name']
53
- cop_config = RuboCop::ConfigLoader.default_configuration[cop_name]
63
+ cop_config = ::RuboCop::ConfigLoader.default_configuration[cop_name]
54
64
  cop_config['StyleGuide']
55
65
  end
56
66
 
@@ -0,0 +1,72 @@
1
+ require 'logger'
2
+ require 'docopt'
3
+ require 'stash'
4
+
5
+ module FaceControl
6
+ class CLI
7
+ USAGE = File.read("#{File.dirname(__FILE__)}/../../USAGE")
8
+
9
+ def run
10
+ logger = Logger.new(STDOUT)
11
+ project, repository, pull_request_id, ignored_severities = arguments
12
+ pull_request = pull_request(project, repository, pull_request_id, logger)
13
+
14
+ logger.info('Running checkers...')
15
+ comments = check(pull_request, ignored_severities, logger)
16
+ return if comments.empty?
17
+
18
+ logger.info("Posting #{comments.size} comments...")
19
+ add_comments(pull_request, comments)
20
+ end
21
+
22
+ def check(pull_request, ignored_severities, logger)
23
+ unless ignored_severities.empty?
24
+ logger.info("Skipping RuboCop offenses with severities: #{ignored_severities.join(', ')}.")
25
+ end
26
+
27
+ filenames = pull_request.filenames_with_added_lines
28
+
29
+ checkers = [
30
+ FaceControl::CheckerRunner.new(FaceControl::Checkers::RuboCop, filenames, ignored_severities: ignored_severities),
31
+ FaceControl::CheckerRunner.new(FaceControl::Checkers::CoffeeLint, filenames)
32
+ ]
33
+
34
+ checkers.map(&:comments).flatten
35
+ end
36
+
37
+ def add_comments(pull_request, comments)
38
+ comments.each do |comment|
39
+ pull_request.add_comment(comment.file, comment.line, comment.text)
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def arguments
46
+ args = Docopt.docopt(USAGE)
47
+
48
+ project = args['<project>']
49
+ repository = args['<repository>']
50
+ pull_request_id = args['<pull_request_id>']
51
+
52
+ ignored_severities = []
53
+ if args['--skip-severity']
54
+ ignored_severities = args['--skip-severity'].split(',')
55
+ end
56
+
57
+ [project, repository, pull_request_id, ignored_severities]
58
+ rescue Docopt::Exit => e
59
+ puts e.message
60
+ exit(1)
61
+ end
62
+
63
+ def pull_request(project, repository, pull_request_id, logger)
64
+ @pull_request ||= begin
65
+ config = Stash::Config.new
66
+ server = Stash::Server.new(config.host, config.user, config.password, logger)
67
+ repository = server.repository(project, repository)
68
+ repository.pull_request(pull_request_id)
69
+ end
70
+ end
71
+ end
72
+ end
@@ -2,10 +2,10 @@ module FaceControl
2
2
  class Comment
3
3
  attr_accessor :file, :line, :text
4
4
 
5
- def initialize(file:, line:, text:)
6
- self.file = file
7
- self.line = line
8
- self.text = text
5
+ def initialize(options)
6
+ self.file = options.fetch(:file)
7
+ self.line = options.fetch(:line)
8
+ self.text = options.fetch(:text)
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module FaceControl
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -9,6 +9,10 @@ module Stash
9
9
  self.id = id
10
10
  end
11
11
 
12
+ def filenames_with_added_lines
13
+ diff.filenames_with_added_lines
14
+ end
15
+
12
16
  def add_comment(file, line, text)
13
17
  return unless diff.added_line?(file, line)
14
18
  return if already_commented?(file, line, text)
@@ -5,12 +5,29 @@ module Stash
5
5
  @diff = diff
6
6
  end
7
7
 
8
+ def filenames_with_added_lines
9
+ diffs_with_added_lines.map do |diff|
10
+ diff['destination']['toString']
11
+ end
12
+ end
13
+
8
14
  def added_line?(file, line)
9
15
  added_lines(file).include?(line)
10
16
  end
11
17
 
12
18
  private
13
19
 
20
+ def diffs_with_added_lines
21
+ @diff['diffs'].select do |diff|
22
+ diff['destination'] &&
23
+ diff['hunks'].find do |hunk|
24
+ hunk['segments'].find do |segment|
25
+ segment['type'] == 'ADDED'
26
+ end
27
+ end
28
+ end
29
+ end
30
+
14
31
  def added_lines(file)
15
32
  @added_lines ||= {}
16
33
  @added_lines[file] ||= begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: face_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Vassilevsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -80,6 +80,62 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '5.8'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-reporters
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.21'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.21'
125
+ - !ruby/object:Gem::Dependency
126
+ name: coveralls
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.8'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.8'
83
139
  description:
84
140
  email:
85
141
  - vassilevsky@gmail.com
@@ -90,25 +146,24 @@ extra_rdoc_files: []
90
146
  files:
91
147
  - ".gitignore"
92
148
  - ".rubocop.yml"
149
+ - ".vexor.yml"
93
150
  - CODE_OF_CONDUCT.md
94
151
  - Gemfile
95
152
  - LICENSE
96
153
  - README.md
97
154
  - Rakefile
155
+ - TODO
98
156
  - USAGE
99
- - bin/bundler
100
- - bin/console
101
- - bin/face-control
102
- - bin/httparty
103
- - bin/rake
104
- - bin/setup
105
157
  - exe/face-control
106
158
  - face_control.gemspec
107
159
  - lib/face_control.rb
160
+ - lib/face_control/checker_runner.rb
161
+ - lib/face_control/checkers.rb
162
+ - lib/face_control/checkers/_example.rb
163
+ - lib/face_control/checkers/coffeelint.rb
164
+ - lib/face_control/checkers/rubocop.rb
165
+ - lib/face_control/cli.rb
108
166
  - lib/face_control/comment.rb
109
- - lib/face_control/inputs.rb
110
- - lib/face_control/inputs/coffeelint_raw.rb
111
- - lib/face_control/inputs/rubocop_json.rb
112
167
  - lib/face_control/version.rb
113
168
  - lib/stash.rb
114
169
  - lib/stash/config.rb
@@ -135,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
190
  version: '0'
136
191
  requirements: []
137
192
  rubyforge_project:
138
- rubygems_version: 2.2.2
193
+ rubygems_version: 2.4.5
139
194
  signing_key:
140
195
  specification_version: 4
141
196
  summary: Checks Atlassian Stash pull requests and comments on issues in added code
data/bin/bundler DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'bundler' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('bundler', 'bundler')
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'face_control'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start
data/bin/face-control DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'face-control' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('face_control', 'face-control')
data/bin/httparty DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'httparty' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('httparty', 'httparty')
data/bin/rake DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'rake' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('rake', 'rake')
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,2 +0,0 @@
1
- require 'face_control/inputs/rubocop_json'
2
- require 'face_control/inputs/coffeelint_raw'
@@ -1,34 +0,0 @@
1
- require 'json'
2
- require 'face_control/comment'
3
-
4
- module FaceControl
5
- module Inputs
6
- class CoffeeLintRaw
7
- attr_accessor :filename
8
-
9
- def initialize(filename = 'coffeelint_report.json')
10
- self.filename = filename
11
-
12
- fail "#{filename} does not exist" unless File.exist?(filename)
13
- end
14
-
15
- def comments
16
- report.map do |file, problems|
17
- problems.map do |problem|
18
- Comment.new(
19
- file: file,
20
- line: problem['lineNumber'],
21
- text: "(#{problem['level']}) #{problem['message']}"
22
- )
23
- end
24
- end.flatten
25
- end
26
-
27
- private
28
-
29
- def report
30
- JSON.parse(File.read(filename))
31
- end
32
- end
33
- end
34
- end