face_control 0.8.1 → 0.8.6
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.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.vexor.yml +0 -1
- data/README.md +55 -37
- data/Rakefile +0 -1
- data/face_control.gemspec +1 -2
- data/lib/face_control/checkers/comments.rb +1 -1
- data/lib/face_control/checkers/rubocop.rb +3 -11
- data/lib/stash/pull_request/diff.rb +1 -0
- data/lib/stash/server.rb +18 -4
- metadata +7 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 325aba4c4fdce156c0dae24d9c5cf10b2993b4b70e0fcf184d3645cea22f5563
|
4
|
+
data.tar.gz: 700af54ea35e67f76d9245acb0fc5e63dfaa766295b357d27d71cf5e0a7de3a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5df85b4788e83c52f3cb051fee19d5137794b3ae9096e2bcc626b0585783515bb1479d52bf9c1cc2fab1d0cd829cbbc69120ccdf48f95e9e686144e4a047163
|
7
|
+
data.tar.gz: 308cb4a0b3d91dc19b1da72b537ed7dbd17f327554bbbc091e7ef16cd895f4828391490843ae3e63c554e0c73d4ce7935bb86131120d176b094f2390a70c9f0f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,76 +1,94 @@
|
|
1
|
+
# Face Control
|
2
|
+
|
1
3
|
[](https://rubygems.org/gems/face_control)
|
2
4
|
[](https://codeclimate.com/github/vassilevsky/face_control/code)
|
3
5
|
[](https://ci.vexor.io/ui/projects/126da196-c8e6-46f0-8bc7-b5f8f4b49732/builds)
|
4
6
|
[](https://coveralls.io/github/vassilevsky/face_control)
|
5
7
|
[](https://www.versioneye.com/ruby/face_control)
|
6
8
|
|
7
|
-
|
9
|
+
Run static analysis of pull requests in [Bitbucket Server][] (formerly Stash)
|
10
|
+
and comment on problems in added lines.
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
(Currently supports [RuboCop][] and [CoffeeLint][].)
|
12
|
+
Currently supports [RuboCop][] and [CoffeeLint][] and also checks for
|
13
|
+
TODOs and FIXMEs.
|
12
14
|
|
13
15
|
Inspired by [Hound][].
|
14
16
|
|
15
17
|
## Installation
|
16
18
|
|
17
|
-
|
19
|
+
```bash
|
20
|
+
gem install face_control
|
21
|
+
```
|
22
|
+
|
23
|
+
You also need to have CoffeeLint installed and available in `PATH`.
|
18
24
|
|
19
25
|
## Usage
|
20
26
|
|
21
|
-
|
27
|
+
```bash
|
28
|
+
face-control <project> <repository> <pull_request_id>
|
29
|
+
```
|
30
|
+
|
31
|
+
It's natural to run this on a continuous integration server (see “[Example](#example)” below).
|
32
|
+
|
33
|
+
If you don't want to receive RuboCop comments with certain severity level,
|
34
|
+
pass the severity in the `--skip-severity` option like so:
|
35
|
+
|
36
|
+
```bash
|
37
|
+
face-control --skip-severity convention <project> <repository> <pull_request_id>
|
38
|
+
```
|
22
39
|
|
23
|
-
|
24
|
-
For example, here's a [Jenkins][] project setup:
|
40
|
+
Instead of `--skip-severity` you can use just `-S`.
|
25
41
|
|
26
|
-
|
27
|
-
* Git
|
28
|
-
* Repositories
|
29
|
-
* Refspec:
|
42
|
+
You can also pass multiple severity levels as a comma-separated list:
|
30
43
|
|
31
|
-
|
44
|
+
```bash
|
45
|
+
face-control -S convention,refactor <project> <repository> <pull_request_id>
|
46
|
+
```
|
32
47
|
|
33
|
-
|
48
|
+
`face-control` uses the same configuration file (`~/.stashconfig.yml`)
|
49
|
+
as the official [Bitbucket Server Command Line Tools][]
|
50
|
+
to connect to your Stash instance.
|
34
51
|
|
35
|
-
|
36
|
-
* Branch Specifier:
|
52
|
+
## Example
|
37
53
|
|
38
|
-
|
54
|
+
Here's a [Jenkins][] project setup as an example:
|
39
55
|
|
40
|
-
|
56
|
+
_Source Code Management → Git → Repositories → Refspec:_
|
41
57
|
|
42
|
-
|
43
|
-
|
44
|
-
|
58
|
+
```
|
59
|
+
+refs/pull-requests/*:refs/remotes/origin/pull-requests/*
|
60
|
+
```
|
45
61
|
|
46
|
-
|
62
|
+
It makes Jenkins fetch otherwise ignored Stash-created branches.
|
47
63
|
|
48
|
-
|
49
|
-
npm install -g coffeelint
|
64
|
+
_Source Code Management → Git → Branches to build → Branch Specifier:_
|
50
65
|
|
51
|
-
|
66
|
+
```
|
67
|
+
origin/pull-requests/*/merge
|
68
|
+
```
|
52
69
|
|
53
|
-
|
54
|
-
pass the severity in the `--skip-severity` option like so:
|
70
|
+
Merge results of open non-conflicting pull requests.
|
55
71
|
|
56
|
-
|
72
|
+
_Build → Execute shell → Command:_
|
57
73
|
|
58
|
-
|
59
|
-
|
74
|
+
```bash
|
75
|
+
export PULL_REQUEST_ID=`echo $GIT_BRANCH | cut -d / -f 3`
|
60
76
|
|
61
|
-
|
77
|
+
gem install rubocop face_control
|
78
|
+
npm install -g coffeelint
|
62
79
|
|
63
|
-
|
64
|
-
|
65
|
-
to connect to your Stash instance.
|
80
|
+
face-control <project> <repository> $PULL_REQUEST_ID
|
81
|
+
```
|
66
82
|
|
67
83
|
## Etymology
|
68
84
|
|
69
|
-
[Face control][] in Wikipedia
|
85
|
+
[Face control][] in Wikipedia.
|
86
|
+
|
87
|
+
[](https://funbox.ru)
|
70
88
|
|
71
89
|
[Hound]: https://houndci.com
|
72
|
-
[
|
73
|
-
[
|
90
|
+
[Bitbucket Server]: https://www.atlassian.com/software/bitbucket/server
|
91
|
+
[Bitbucket Server Command Line Tools]: https://bitbucket.org/atlassian/bitbucket-server-cli
|
74
92
|
[RuboCop]: http://batsov.com/rubocop/
|
75
93
|
[CoffeeLint]: http://www.coffeelint.org
|
76
94
|
[Jenkins]: http://jenkins-ci.org
|
data/Rakefile
CHANGED
data/face_control.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'face_control'
|
3
|
-
spec.version = '0.8.
|
3
|
+
spec.version = '0.8.6'
|
4
4
|
spec.authors = ['Ilya Vassilevsky']
|
5
5
|
spec.email = ['vassilevsky@gmail.com']
|
6
6
|
|
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.add_runtime_dependency 'rubocop'
|
17
17
|
spec.add_runtime_dependency 'httparty'
|
18
18
|
|
19
|
-
spec.add_development_dependency 'bundler', '~> 1.8'
|
20
19
|
spec.add_development_dependency 'rake', '~> 10.0'
|
21
20
|
spec.add_development_dependency 'minitest', '~> 5.8'
|
22
21
|
spec.add_development_dependency 'minitest-reporters', '~> 1.0'
|
@@ -52,21 +52,13 @@ module FaceControl
|
|
52
52
|
text << " — [Guide](#{link})"
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
text << " (Run `rubocop -a #{file['path']}` to fix.)"
|
57
|
-
end
|
58
|
-
|
59
|
-
text
|
55
|
+
text << " — #{offense['cop_name']}"
|
60
56
|
end
|
61
57
|
|
62
58
|
def style_guide_url(offense)
|
63
59
|
cop_name = offense['cop_name']
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
def can_be_autocorrected?(offense)
|
69
|
-
!offense['corrected'].nil?
|
60
|
+
config = ::RuboCop::ConfigLoader.default_configuration
|
61
|
+
::RuboCop::Cop::MessageAnnotator.new(config, cop_name, config.for_cop(cop_name), {}).urls.first
|
70
62
|
end
|
71
63
|
end
|
72
64
|
end
|
data/lib/stash/server.rb
CHANGED
@@ -3,6 +3,8 @@ require 'stash/repository'
|
|
3
3
|
|
4
4
|
module Stash
|
5
5
|
class Server
|
6
|
+
class CommunicationError < StandardError; end
|
7
|
+
|
6
8
|
attr_accessor :root_uri, :user, :password, :logger
|
7
9
|
|
8
10
|
def initialize(root_uri, user, password, logger = nil)
|
@@ -19,14 +21,18 @@ module Stash
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def get(path)
|
22
|
-
|
23
|
-
|
24
|
+
with_error_handling do
|
25
|
+
logged('Response') do
|
26
|
+
HTTParty.get(endpoint + path, auth.merge(logging))
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
27
31
|
def post(path, data)
|
28
|
-
|
29
|
-
|
32
|
+
with_error_handling do
|
33
|
+
logged('Response') do
|
34
|
+
HTTParty.post(endpoint + path, auth.merge(content_type).merge(body: data.to_json).merge(logging))
|
35
|
+
end
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
@@ -73,5 +79,13 @@ module Stash
|
|
73
79
|
{}
|
74
80
|
end
|
75
81
|
end
|
82
|
+
|
83
|
+
def with_error_handling
|
84
|
+
yield.tap do |response|
|
85
|
+
unless response.success?
|
86
|
+
fail CommunicationError, 'Stash responded with an error'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
76
90
|
end
|
77
91
|
end
|
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.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Vassilevsky
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.8'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.8'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +122,7 @@ dependencies:
|
|
136
122
|
- - "~>"
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0.8'
|
139
|
-
description:
|
125
|
+
description:
|
140
126
|
email:
|
141
127
|
- vassilevsky@gmail.com
|
142
128
|
executables:
|
@@ -174,7 +160,7 @@ files:
|
|
174
160
|
homepage: https://github.com/vassilevsky/face_control
|
175
161
|
licenses: []
|
176
162
|
metadata: {}
|
177
|
-
post_install_message:
|
163
|
+
post_install_message:
|
178
164
|
rdoc_options: []
|
179
165
|
require_paths:
|
180
166
|
- lib
|
@@ -189,9 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
175
|
- !ruby/object:Gem::Version
|
190
176
|
version: '0'
|
191
177
|
requirements: []
|
192
|
-
|
193
|
-
|
194
|
-
signing_key:
|
178
|
+
rubygems_version: 3.0.3
|
179
|
+
signing_key:
|
195
180
|
specification_version: 4
|
196
181
|
summary: Checks Atlassian Stash pull requests and comments on issues in added code
|
197
182
|
test_files: []
|