linterbot 0.2.1 → 0.2.2
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 +4 -4
- data/README.md +4 -2
- data/exe/linterbot +9 -1
- data/lib/linterbot/runner_configuration.rb +12 -0
- data/lib/linterbot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abcda56ecd4fea3e725995d9de4133e317ed45c4
|
4
|
+
data.tar.gz: 1bf1db02125fb034dceffd0ef74f84dbaa5e438c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2b799eec7600fac75d9a963c88542a156d7155308613d4de492cbca436e910fe89e730b6643463858d9e4ec5eed3ccd2a8d716a73c509fabd8b4776f02eff22
|
7
|
+
data.tar.gz: 8a82dd0167db2fba31b3d2affa9cac0546ccda44f0392cec028d0f8900c2c369e59fc16b08d3d52952c40d7d98ca91560b200f74f8a0c419671c8008c46aeff8
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ If you want to run it in TravisCI for every pull request triggered build you can
|
|
42
42
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]
|
43
43
|
then
|
44
44
|
swiftlint --reporter json > switlint-report.json || false
|
45
|
-
linterbot $TRAVIS_REPO_SLUG $TRAVIS_PULL_REQUEST < swiftlint-report
|
45
|
+
linterbot $TRAVIS_REPO_SLUG $TRAVIS_PULL_REQUEST < swiftlint-report.json
|
46
46
|
fi
|
47
47
|
```
|
48
48
|
*`|| false` avoids a build fail if there are severe lint error*
|
@@ -75,7 +75,9 @@ linterbot help run
|
|
75
75
|
|
76
76
|
### GitHub access
|
77
77
|
|
78
|
-
In order for linterbot to be able to comment on your pull request it needs write access to the specified repository.
|
78
|
+
In order for linterbot to be able to comment on your pull request it needs write access to the specified repository. Remember to add the `repo` scope when you create the GitHub access token. If you don't lintebot won't be able to run. For more information on how to create an access token check [this](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) tutorial. If you want to know more about GitHub's OAuth scopes check [this](https://developer.github.com/v3/oauth/#scopes) section in their documentation.
|
79
|
+
|
80
|
+
You can provided an access token by either using the environmental variable `GITHUB_ACCESS_TOKEN` or using the `.linterbot.yml` (which should not be committed to your git repository).
|
79
81
|
|
80
82
|
### Configuration file
|
81
83
|
|
data/exe/linterbot
CHANGED
@@ -46,7 +46,15 @@ command :run do |c|
|
|
46
46
|
puts "Linterbot has successfully reviewed your PR ;-)"
|
47
47
|
rescue Linterbot::RunnerConfiguration::MissingAttribute => exception
|
48
48
|
STDERR.puts "Missing configuration attribute '#{exception.attribute_name}'"
|
49
|
-
STDERR.puts "#{exception.fix_description}"
|
49
|
+
STDERR.puts "#{exception.fix_description}\n"
|
50
|
+
exit 1
|
51
|
+
rescue Linterbot::RunnerConfiguration::InvalidGitHubCredentials => exception
|
52
|
+
STDERR.puts "Invalid GitHub credentials"
|
53
|
+
STDERR.puts "The given access token does not have the 'repo' scope"
|
54
|
+
STDERR.puts "\nFor more info on how to create an access token check:"
|
55
|
+
STDERR.puts "https://help.github.com/articles/creating-an-access-token-for-command-line-use/"
|
56
|
+
STDERR.puts "\nIf you want to know more about GitHub's OAuth scopes check:"
|
57
|
+
STDERR.puts "https://developer.github.com/v3/oauth/#scopes\n"
|
50
58
|
exit 1
|
51
59
|
end
|
52
60
|
end
|
@@ -21,6 +21,9 @@ module Linterbot
|
|
21
21
|
|
22
22
|
end
|
23
23
|
|
24
|
+
class InvalidGitHubCredentials < Exception
|
25
|
+
end
|
26
|
+
|
24
27
|
DEFAULT_PROJECT_BASE_PATH = './'
|
25
28
|
DEFAULT_CONFIG_FILE_PATH = './.linterbot.yml'
|
26
29
|
|
@@ -70,6 +73,7 @@ module Linterbot
|
|
70
73
|
github_access_token = ENV["GITHUB_ACCESS_TOKEN"] || base_config[:github_access_token]
|
71
74
|
raise missing_github_access_token unless github_access_token
|
72
75
|
github_client = Octokit::Client.new(access_token: github_access_token)
|
76
|
+
validate_github_access!(github_client)
|
73
77
|
|
74
78
|
configuration = new(github_client, base_config)
|
75
79
|
configuration.project_base_path = options.project_base_path if options.project_base_path
|
@@ -83,6 +87,14 @@ module Linterbot
|
|
83
87
|
configuration
|
84
88
|
end
|
85
89
|
|
90
|
+
def validate_github_access!(github_client)
|
91
|
+
raise InvalidGitHubCredentials.new unless full_repo_access?(github_client)
|
92
|
+
end
|
93
|
+
|
94
|
+
def full_repo_access?(github_client)
|
95
|
+
github_client.scopes.include?("repo")
|
96
|
+
end
|
97
|
+
|
86
98
|
end
|
87
99
|
|
88
100
|
def initialize(github_client, options)
|
data/lib/linterbot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linterbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guido Marucci Blas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|