face_control 0.5.1 → 0.6.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 +54 -5
- data/lib/face_control/version.rb +1 -1
- data/lib/stash/pull_request/diff.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b374e68daaa27205ecc59c9465ff8f11433bb5d1
|
4
|
+
data.tar.gz: 3afdc0deb89bc2e385032c54c950e59d9d1b461d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ff712dbd9a72ac6612cd3e20974c82ae8aedb72fe97a00a388b7eab4857d03c0164970b9b156fc160c98ffb1a4b7d1a8e9a295685cf0b3838fd85aacb0fbdc2
|
7
|
+
data.tar.gz: 9b7b31b34cc4b460c75066b463cd1bd20cb1752d056f102f490ca15a5b6c7ce86ced03b5265945a0dd5cdacb2ecffbebb2386f97c65842a3d94d7eb3e972b8e7
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Face Control
|
2
2
|
|
3
|
-
Comment on added lines of pull requests in [Atlassian Stash]
|
3
|
+
Comment on added lines of pull requests in [Atlassian Stash][].
|
4
4
|
Take comments from static checkers reports.
|
5
|
-
(Currently supports [RuboCop]
|
5
|
+
(Currently supports [RuboCop][] and [CoffeeLint][].)
|
6
6
|
|
7
|
-
Inspired by [Hound]
|
7
|
+
Inspired by [Hound][].
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -16,10 +16,59 @@ Inspired by [Hound](https://houndci.com).
|
|
16
16
|
coffeelint --reporter raw app/assets/javascripts > coffeelint_report.json
|
17
17
|
face-control <project> <repository> <pull_request_id>
|
18
18
|
|
19
|
+
It's natural to run this on a continuous integration server.
|
20
|
+
For example, here's a [Jenkins][] project setup:
|
21
|
+
|
22
|
+
* Source Code Management
|
23
|
+
* Git
|
24
|
+
* Repositories
|
25
|
+
* Refspec:
|
26
|
+
|
27
|
+
+refs/pull-requests/*:refs/remotes/origin/pull-requests/*
|
28
|
+
|
29
|
+
(make Jenkins fetch otherwise ignored Stash-created branches)
|
30
|
+
|
31
|
+
* Branches to build
|
32
|
+
* Branch Specifier:
|
33
|
+
|
34
|
+
origin/pull-requests/*/merge
|
35
|
+
|
36
|
+
(merge results of open non-conflicting pull requests)
|
37
|
+
|
38
|
+
* Build
|
39
|
+
* Execute shell
|
40
|
+
* Command
|
41
|
+
|
42
|
+
export PULL_REQUEST_ID=`echo $GIT_BRANCH | cut -d / -f 3`
|
43
|
+
gem install rubocop face_control
|
44
|
+
npm install -g coffeelint
|
45
|
+
|
46
|
+
rubocop -f json -o rubocop.json || true
|
47
|
+
coffeelint --reporter raw app/assets/javascripts > coffeelint_report.json || true
|
48
|
+
face-control <project> <repository> $PULL_REQUEST_ID
|
49
|
+
|
50
|
+
If you don't want to receive RuboCop comments with certain severity level,
|
51
|
+
pass the severity in the `--skip-severity` option like so:
|
52
|
+
|
53
|
+
face-control --skip-severity convention <project> <repository> <pull_request_id>
|
54
|
+
|
55
|
+
You can use just `-S`.
|
56
|
+
You can also pass multiple severity levels as a comma-separated list:
|
57
|
+
|
58
|
+
face-control -S convention,refactor <project> <repository> <pull_request_id>
|
59
|
+
|
19
60
|
`face-control` uses the same configuration file (`~/.stashconfig.yml`)
|
20
|
-
as the official [Atlassian Stash Command Line Tools]
|
61
|
+
as the official [Atlassian Stash Command Line Tools][]
|
21
62
|
to connect to your Stash instance.
|
22
63
|
|
23
64
|
## Etymology
|
24
65
|
|
25
|
-
[Face control]
|
66
|
+
[Face control][] in Wikipedia
|
67
|
+
|
68
|
+
[Hound]: https://houndci.com
|
69
|
+
[Atlassian Stash]: https://www.atlassian.com/software/stash
|
70
|
+
[Atlassian Stash Command Line Tools]: https://bitbucket.org/atlassian/stash-command-line-tools
|
71
|
+
[RuboCop]: http://batsov.com/rubocop/
|
72
|
+
[CoffeeLint]: http://www.coffeelint.org
|
73
|
+
[Jenkins]: http://jenkins-ci.org
|
74
|
+
[Face control]: http://en.wikipedia.org/wiki/Face_control
|
data/lib/face_control/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Stash
|
2
2
|
class PullRequest
|
3
3
|
class Diff
|
4
|
-
def initialize(
|
5
|
-
@
|
4
|
+
def initialize(diff)
|
5
|
+
@diff = diff
|
6
6
|
end
|
7
7
|
|
8
8
|
def added_line?(file, line)
|
@@ -15,7 +15,7 @@ module Stash
|
|
15
15
|
@added_lines ||= {}
|
16
16
|
@added_lines[file] ||= begin
|
17
17
|
file_diff(file)['hunks'].map do |hunk|
|
18
|
-
hunk['segments'].select{
|
18
|
+
hunk['segments'].select{|segment| segment['type'] == 'ADDED' }.map do |segment|
|
19
19
|
segment['lines'].map do |line|
|
20
20
|
line['destination']
|
21
21
|
end
|
@@ -25,7 +25,7 @@ module Stash
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def file_diff(file)
|
28
|
-
@
|
28
|
+
@diff['diffs'].detect{|diff| diff['destination'] && diff['destination']['toString'] == file } || {'hunks' => []}
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|