face_control 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/face_control.gemspec +1 -6
- data/lib/face_control/checker_runner.rb +6 -1
- data/lib/face_control/checkers/_example.rb +2 -1
- data/lib/face_control/checkers/comments.rb +23 -0
- data/lib/face_control/checkers/rubocop.rb +1 -0
- data/lib/face_control/checkers.rb +1 -0
- data/lib/face_control/cli.rb +3 -2
- metadata +4 -4
- data/lib/face_control/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be4497607119db9bc65a83c2b7d33a23285098a6
|
4
|
+
data.tar.gz: 7bbe96f55858e7006ae44865f6b8b6196fdadd7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc75588340a640a422005198455f6146e0a1b80007164554ae2a1da265e4becdcb77b2e42840a04689a95c00538bbda8c37388e41e9104adfa57b2280e8b761d
|
7
|
+
data.tar.gz: 6837e6f79ff30fdfec2fa7bca03db1c3da62f1d684c99b883230faed98ca434e47add43f231eca953fee6e01b0d9dacc704d8672386d1161f4036ac3a904a109
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
[![Gem Version](https://img.shields.io/gem/v/face_control.svg)](https://rubygems.org/gems/face_control)
|
2
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/vassilevsky/face_control.svg)](https://codeclimate.com/github/vassilevsky/face_control/code)
|
1
3
|
[![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
4
|
[![Coveralls](https://img.shields.io/coveralls/vassilevsky/face_control.svg)](https://coveralls.io/github/vassilevsky/face_control)
|
5
|
+
[![VersionEye](https://img.shields.io/versioneye/d/ruby/face_control.svg)](https://www.versioneye.com/ruby/face_control)
|
3
6
|
|
4
7
|
# Face Control
|
5
8
|
|
@@ -41,6 +44,7 @@ For example, here's a [Jenkins][] project setup:
|
|
41
44
|
* Command
|
42
45
|
|
43
46
|
export PULL_REQUEST_ID=`echo $GIT_BRANCH | cut -d / -f 3`
|
47
|
+
|
44
48
|
gem install rubocop face_control
|
45
49
|
npm install -g coffeelint
|
46
50
|
|
data/face_control.gemspec
CHANGED
@@ -1,11 +1,6 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'face_control/version'
|
5
|
-
|
6
1
|
Gem::Specification.new do |spec|
|
7
2
|
spec.name = 'face_control'
|
8
|
-
spec.version =
|
3
|
+
spec.version = '0.8.0'
|
9
4
|
spec.authors = ['Ilya Vassilevsky']
|
10
5
|
spec.email = ['vassilevsky@gmail.com']
|
11
6
|
|
@@ -12,12 +12,17 @@ module FaceControl
|
|
12
12
|
def comments
|
13
13
|
return [] if relevant_filenames.empty?
|
14
14
|
|
15
|
-
|
15
|
+
report = `#{@checker.command(relevant_filenames.join(' '))}`
|
16
|
+
return [] if report.strip.empty?
|
17
|
+
|
18
|
+
@checker.parse(report)
|
16
19
|
end
|
17
20
|
|
18
21
|
private
|
19
22
|
|
20
23
|
def relevant_filenames
|
24
|
+
return @filenames unless @checker.respond_to?(:relevant_globs)
|
25
|
+
|
21
26
|
@relevant_filenames ||= @checker.relevant_globs.map do |glob|
|
22
27
|
@filenames.select do |filename|
|
23
28
|
File.fnmatch?(glob, filename)
|
@@ -7,6 +7,7 @@ module FaceControl
|
|
7
7
|
# Define only if you use @options in the following methods
|
8
8
|
attr_writer :options
|
9
9
|
|
10
|
+
# @optional
|
10
11
|
# @return [Array<String>] Shell globs to filter only files relevant to this checker
|
11
12
|
# out of all files with added lines in the pull request
|
12
13
|
def relevant_globs
|
@@ -29,7 +30,7 @@ module FaceControl
|
|
29
30
|
mode = fields.first
|
30
31
|
file = fields.last
|
31
32
|
|
32
|
-
|
33
|
+
unless mode == '-rwxr-xr-x'
|
33
34
|
Comment.new(file: file, line: 1, text: 'Invalid file mode')
|
34
35
|
end
|
35
36
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'face_control/comment'
|
2
|
+
|
3
|
+
module FaceControl
|
4
|
+
module Checkers
|
5
|
+
class Comments
|
6
|
+
|
7
|
+
def command(filenames)
|
8
|
+
"grep -inEH '(todo|fixme)' #{filenames}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def parse(command_output)
|
12
|
+
command_output.lines.map do |line|
|
13
|
+
file, line_num = line.split(":", 3)
|
14
|
+
Comment.new(
|
15
|
+
file: file,
|
16
|
+
line: line_num,
|
17
|
+
text: "Do not bury this task in code. Do it now or create a JIRA issue."
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/face_control/cli.rb
CHANGED
@@ -15,7 +15,7 @@ module FaceControl
|
|
15
15
|
comments = check(pull_request, ignored_severities, logger)
|
16
16
|
return if comments.empty?
|
17
17
|
|
18
|
-
logger.info("
|
18
|
+
logger.info("#{comments.size} comments have been created. Posting only those for added lines...")
|
19
19
|
add_comments(pull_request, comments)
|
20
20
|
end
|
21
21
|
|
@@ -28,7 +28,8 @@ module FaceControl
|
|
28
28
|
|
29
29
|
checkers = [
|
30
30
|
FaceControl::CheckerRunner.new(FaceControl::Checkers::RuboCop, filenames, ignored_severities: ignored_severities),
|
31
|
-
FaceControl::CheckerRunner.new(FaceControl::Checkers::CoffeeLint, filenames)
|
31
|
+
FaceControl::CheckerRunner.new(FaceControl::Checkers::CoffeeLint, filenames),
|
32
|
+
FaceControl::CheckerRunner.new(FaceControl::Checkers::Comments, filenames)
|
32
33
|
]
|
33
34
|
|
34
35
|
checkers.map(&:comments).flatten
|
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.
|
4
|
+
version: 0.8.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:
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -161,10 +161,10 @@ files:
|
|
161
161
|
- lib/face_control/checkers.rb
|
162
162
|
- lib/face_control/checkers/_example.rb
|
163
163
|
- lib/face_control/checkers/coffeelint.rb
|
164
|
+
- lib/face_control/checkers/comments.rb
|
164
165
|
- lib/face_control/checkers/rubocop.rb
|
165
166
|
- lib/face_control/cli.rb
|
166
167
|
- lib/face_control/comment.rb
|
167
|
-
- lib/face_control/version.rb
|
168
168
|
- lib/stash.rb
|
169
169
|
- lib/stash/config.rb
|
170
170
|
- lib/stash/pull_request.rb
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
192
|
rubyforge_project:
|
193
|
-
rubygems_version: 2.4.5
|
193
|
+
rubygems_version: 2.4.5.1
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Checks Atlassian Stash pull requests and comments on issues in added code
|
data/lib/face_control/version.rb
DELETED