face_control 0.8.5 → 0.8.6

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
- SHA1:
3
- metadata.gz: c3d2f48370bafab2fa06775866f106d9a03dfe8f
4
- data.tar.gz: 4e60c9742597486b72e946036db07aaf10714ae4
2
+ SHA256:
3
+ metadata.gz: 325aba4c4fdce156c0dae24d9c5cf10b2993b4b70e0fcf184d3645cea22f5563
4
+ data.tar.gz: 700af54ea35e67f76d9245acb0fc5e63dfaa766295b357d27d71cf5e0a7de3a2
5
5
  SHA512:
6
- metadata.gz: c915bd12dd864727f4cf80b72c235fa8b29cceba254e09671416b272ab481c389613a2e0f0bcc461f24fc1b99782e45a3e15303c35cdb5dff764107ff230956c
7
- data.tar.gz: d716c1f70a7c173c370c39c8abdcea26be832a54b20bcf45977a6336f180adcbc7848e507644fedbb4906d24affced837c5372ea7c3ef6d62e4b6f595cc6e5de
6
+ metadata.gz: d5df85b4788e83c52f3cb051fee19d5137794b3ae9096e2bcc626b0585783515bb1479d52bf9c1cc2fab1d0cd829cbbc69120ccdf48f95e9e686144e4a047163
7
+ data.tar.gz: 308cb4a0b3d91dc19b1da72b537ed7dbd17f327554bbbc091e7ef16cd895f4828391490843ae3e63c554e0c73d4ce7935bb86131120d176b094f2390a70c9f0f
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ doc/
8
8
  pkg/
9
9
  spec/reports/
10
10
  tmp/
11
+ .idea
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
+ # Face Control
2
+
1
3
  [![Gem Version](https://img.shields.io/gem/v/face_control.svg)](https://rubygems.org/gems/face_control)
2
4
  [![Code Climate](https://img.shields.io/codeclimate/github/vassilevsky/face_control.svg)](https://codeclimate.com/github/vassilevsky/face_control/code)
3
5
  [![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)
4
6
  [![Coveralls](https://img.shields.io/coveralls/vassilevsky/face_control.svg)](https://coveralls.io/github/vassilevsky/face_control)
5
7
  [![VersionEye](https://img.shields.io/versioneye/d/ruby/face_control.svg)](https://www.versioneye.com/ruby/face_control)
6
8
 
7
- # Face Control
8
-
9
9
  Run static analysis of pull requests in [Bitbucket Server][] (formerly Stash)
10
10
  and comment on problems in added lines.
11
11
 
@@ -16,61 +16,75 @@ Inspired by [Hound][].
16
16
 
17
17
  ## Installation
18
18
 
19
- gem install face_control
19
+ ```bash
20
+ gem install face_control
21
+ ```
20
22
 
21
- You also need to have CoffeeLint installed and available in PATH.
23
+ You also need to have CoffeeLint installed and available in `PATH`.
22
24
 
23
25
  ## Usage
24
26
 
25
- face-control <project> <repository> <pull_request_id>
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).
26
32
 
27
- It's natural to run this on a continuous integration server.
28
- For example, here's a [Jenkins][] project setup:
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
+ ```
29
39
 
30
- * Source Code Management
31
- * Git
32
- * Repositories
33
- * Refspec:
40
+ Instead of `--skip-severity` you can use just `-S`.
41
+
42
+ You can also pass multiple severity levels as a comma-separated list:
34
43
 
35
- +refs/pull-requests/*:refs/remotes/origin/pull-requests/*
44
+ ```bash
45
+ face-control -S convention,refactor <project> <repository> <pull_request_id>
46
+ ```
36
47
 
37
- (make Jenkins fetch otherwise ignored Stash-created branches)
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.
38
51
 
39
- * Branches to build
40
- * Branch Specifier:
52
+ ## Example
41
53
 
42
- origin/pull-requests/*/merge
54
+ Here's a [Jenkins][] project setup as an example:
43
55
 
44
- (merge results of open non-conflicting pull requests)
56
+ _Source Code Management Git Repositories → Refspec:_
45
57
 
46
- * Build
47
- * Execute shell
48
- * Command
58
+ ```
59
+ +refs/pull-requests/*:refs/remotes/origin/pull-requests/*
60
+ ```
49
61
 
50
- export PULL_REQUEST_ID=`echo $GIT_BRANCH | cut -d / -f 3`
62
+ It makes Jenkins fetch otherwise ignored Stash-created branches.
51
63
 
52
- gem install rubocop face_control
53
- npm install -g coffeelint
64
+ _Source Code Management → Git → Branches to build → Branch Specifier:_
54
65
 
55
- face-control <project> <repository> $PULL_REQUEST_ID
66
+ ```
67
+ origin/pull-requests/*/merge
68
+ ```
56
69
 
57
- If you don't want to receive RuboCop comments with certain severity level,
58
- pass the severity in the `--skip-severity` option like so:
70
+ Merge results of open non-conflicting pull requests.
59
71
 
60
- face-control --skip-severity convention <project> <repository> <pull_request_id>
72
+ _Build Execute shell Command:_
61
73
 
62
- You can use just `-S`.
63
- You can also pass multiple severity levels as a comma-separated list:
74
+ ```bash
75
+ export PULL_REQUEST_ID=`echo $GIT_BRANCH | cut -d / -f 3`
64
76
 
65
- face-control -S convention,refactor <project> <repository> <pull_request_id>
77
+ gem install rubocop face_control
78
+ npm install -g coffeelint
66
79
 
67
- `face-control` uses the same configuration file (`~/.stashconfig.yml`)
68
- as the official [Bitbucket Server Command Line Tools][]
69
- to connect to your Stash instance.
80
+ face-control <project> <repository> $PULL_REQUEST_ID
81
+ ```
70
82
 
71
83
  ## Etymology
72
84
 
73
- [Face control][] in Wikipedia
85
+ [Face control][] in Wikipedia.
86
+
87
+ [![Sponsored by FunBox](https://funbox.ru/badges/sponsored_by_funbox_centered.svg)](https://funbox.ru)
74
88
 
75
89
  [Hound]: https://houndci.com
76
90
  [Bitbucket Server]: https://www.atlassian.com/software/bitbucket/server
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'bundler/gem_tasks'
2
1
  require 'rake/testtask'
3
2
 
4
3
  Rake::TestTask.new(:test) do |t|
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'face_control'
3
- spec.version = '0.8.5'
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
- if can_be_autocorrected?(offense)
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
60
  config = ::RuboCop::ConfigLoader.default_configuration
65
- ::RuboCop::Cop::MessageAnnotator.new(config, config.for_cop(cop_name), {}).urls.first
66
- end
67
-
68
- def can_be_autocorrected?(offense)
69
- !offense['corrected'].nil?
61
+ ::RuboCop::Cop::MessageAnnotator.new(config, cop_name, config.for_cop(cop_name), {}).urls.first
70
62
  end
71
63
  end
72
64
  end
@@ -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
- logged('Response') do
23
- HTTParty.get(endpoint + path, auth.merge(logging))
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
- logged('Response') do
29
- HTTParty.post(endpoint + path, auth.merge(content_type).merge(body: data.to_json).merge(logging))
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.5
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: 2017-04-03 00:00:00.000000000 Z
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
- rubyforge_project:
193
- rubygems_version: 2.5.1
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: []