Skip to content

Commit 9158c2d

Browse files
authored
Standard (#17)
* Add standard gem * Standard * Standard * Standard * Standard
1 parent 8813387 commit 9158c2d

File tree

8 files changed

+163
-115
lines changed

8 files changed

+163
-115
lines changed

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44

55
gemspec
66

77
gem "simplecov", require: false
8+
gem "standard"

Gemfile.lock

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ GEM
2222
tzinfo (~> 2.0, >= 2.0.5)
2323
addressable (2.8.7)
2424
public_suffix (>= 2.0.2, < 7.0)
25+
ast (2.4.3)
2526
base64 (0.2.0)
2627
benchmark (0.4.0)
2728
bigdecimal (3.1.9)
@@ -40,15 +41,25 @@ GEM
4041
i18n (1.14.7)
4142
concurrent-ruby (~> 1.0)
4243
json (2.10.2)
44+
language_server-protocol (3.17.0.4)
45+
lint_roller (1.1.0)
4346
logger (1.7.0)
4447
minitest (5.25.5)
4548
net-http (0.6.0)
4649
uri
4750
octokit (9.2.0)
4851
faraday (>= 1, < 3)
4952
sawyer (~> 0.9)
53+
parallel (1.26.3)
54+
parser (3.3.7.4)
55+
ast (~> 2.4.1)
56+
racc
57+
prism (1.4.0)
5058
public_suffix (6.0.1)
59+
racc (1.8.1)
60+
rainbow (3.1.1)
5161
rake (13.2.1)
62+
regexp_parser (2.10.0)
5263
rspec (3.13.0)
5364
rspec-core (~> 3.13.0)
5465
rspec-expectations (~> 3.13.0)
@@ -62,6 +73,25 @@ GEM
6273
diff-lcs (>= 1.2.0, < 2.0)
6374
rspec-support (~> 3.13.0)
6475
rspec-support (3.13.2)
76+
rubocop (1.75.2)
77+
json (~> 2.3)
78+
language_server-protocol (~> 3.17.0.2)
79+
lint_roller (~> 1.1.0)
80+
parallel (~> 1.10)
81+
parser (>= 3.3.0.2)
82+
rainbow (>= 2.2.2, < 4.0)
83+
regexp_parser (>= 2.9.3, < 3.0)
84+
rubocop-ast (>= 1.44.0, < 2.0)
85+
ruby-progressbar (~> 1.7)
86+
unicode-display_width (>= 2.4.0, < 4.0)
87+
rubocop-ast (1.44.0)
88+
parser (>= 3.3.7.2)
89+
prism (~> 1.4)
90+
rubocop-performance (1.25.0)
91+
lint_roller (~> 1.1)
92+
rubocop (>= 1.75.0, < 2.0)
93+
rubocop-ast (>= 1.38.0, < 2.0)
94+
ruby-progressbar (1.13.0)
6595
sawyer (0.9.2)
6696
addressable (>= 2.3.5)
6797
faraday (>= 0.17.3, < 3)
@@ -72,8 +102,23 @@ GEM
72102
simplecov_json_formatter (~> 0.1)
73103
simplecov-html (0.13.1)
74104
simplecov_json_formatter (0.1.4)
105+
standard (1.49.0)
106+
language_server-protocol (~> 3.17.0.2)
107+
lint_roller (~> 1.0)
108+
rubocop (~> 1.75.2)
109+
standard-custom (~> 1.0.0)
110+
standard-performance (~> 1.8)
111+
standard-custom (1.0.2)
112+
lint_roller (~> 1.0)
113+
rubocop (~> 1.50)
114+
standard-performance (1.8.0)
115+
lint_roller (~> 1.1)
116+
rubocop-performance (~> 1.25.0)
75117
tzinfo (2.0.6)
76118
concurrent-ruby (~> 1.0)
119+
unicode-display_width (3.1.4)
120+
unicode-emoji (~> 4.0, >= 4.0.4)
121+
unicode-emoji (4.0.4)
77122
uri (1.0.3)
78123

79124
PLATFORMS
@@ -95,6 +140,7 @@ DEPENDENCIES
95140
rake
96141
rspec
97142
simplecov
143+
standard
98144

99145
BUNDLED WITH
100146
2.6.7

errbit_github_plugin.gemspec

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
# frozen_string_literal: true
22

3-
lib = File.expand_path('../lib', __FILE__)
3+
lib = File.expand_path("../lib", __FILE__)
44
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5-
require 'errbit_github_plugin/version'
5+
require "errbit_github_plugin/version"
66

77
Gem::Specification.new do |spec|
8-
spec.name = 'errbit_github_plugin'
9-
spec.version = ErrbitGithubPlugin::VERSION
10-
spec.authors = ['Stephen Crosby']
11-
spec.email = ['[email protected]']
8+
spec.name = "errbit_github_plugin"
9+
spec.version = ErrbitGithubPlugin::VERSION
10+
spec.authors = ["Stephen Crosby"]
11+
spec.email = ["[email protected]"]
1212

13-
spec.description = %q{GitHub integration for Errbit}
14-
spec.summary = %q{GitHub integration for Errbit}
15-
spec.homepage = 'https://github.com/errbit/errbit_github_plugin'
16-
spec.license = 'MIT'
13+
spec.description = "GitHub integration for Errbit"
14+
spec.summary = "GitHub integration for Errbit"
15+
spec.homepage = "https://github.com/errbit/errbit_github_plugin"
16+
spec.license = "MIT"
1717

18-
spec.files = `git ls-files`.split($/)
19-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21-
spec.require_paths = ['lib']
18+
spec.files = `git ls-files`.split($/)
19+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20+
spec.require_paths = ["lib"]
2221

23-
spec.add_dependency 'errbit_plugin'
24-
spec.add_dependency 'octokit'
22+
spec.add_dependency "errbit_plugin"
23+
spec.add_dependency "octokit"
2524

26-
spec.add_development_dependency 'rspec'
27-
spec.add_development_dependency 'rake'
28-
spec.add_development_dependency 'activesupport'
25+
spec.add_development_dependency "rspec"
26+
spec.add_development_dependency "rake"
27+
spec.add_development_dependency "activesupport"
2928
end

lib/errbit_github_plugin.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# frozen_string_literal: true
22

33
require "errbit_github_plugin/version"
4-
require 'errbit_github_plugin/error'
5-
require 'errbit_github_plugin/issue_tracker'
4+
require "errbit_github_plugin/error"
5+
require "errbit_github_plugin/issue_tracker"
66

77
module ErrbitGithubPlugin
88
def self.root
9-
File.expand_path '../..', __FILE__
9+
File.expand_path "../..", __FILE__
1010
end
1111

1212
def self.read_static_file(file)
13-
File.read(File.join(self.root, 'static', file))
13+
File.read(File.join(root, "static", file))
1414
end
1515
end
1616

lib/errbit_github_plugin/issue_tracker.rb

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# frozen_string_literal: true
22

3-
require 'octokit'
3+
require "octokit"
44

55
module ErrbitGithubPlugin
66
class IssueTracker < ErrbitPlugin::IssueTracker
7+
LABEL = "github"
78

8-
LABEL = 'github'
9-
10-
NOTE = 'Please configure your github repository in the <strong>GITHUB ' \
11-
'REPO</strong> field above.<br/> Instead of providing your ' \
12-
'username & password, you can link your Github account to your ' \
13-
'user profile, and allow Errbit to create issues using your ' \
14-
'OAuth token.'
9+
NOTE = "Please configure your github repository in the <strong>GITHUB " \
10+
"REPO</strong> field above.<br/> Instead of providing your " \
11+
"username & password, you can link your Github account to your " \
12+
"user profile, and allow Errbit to create issues using your " \
13+
"OAuth token."
1514

1615
FIELDS = {
1716
username: {
@@ -37,13 +36,13 @@ def self.fields
3736
def self.icons
3837
@icons ||= {
3938
create: [
40-
'image/png', ErrbitGithubPlugin.read_static_file('github_create.png')
39+
"image/png", ErrbitGithubPlugin.read_static_file("github_create.png")
4140
],
4241
goto: [
43-
'image/png', ErrbitGithubPlugin.read_static_file('github_goto.png'),
42+
"image/png", ErrbitGithubPlugin.read_static_file("github_goto.png")
4443
],
4544
inactive: [
46-
'image/png', ErrbitGithubPlugin.read_static_file('github_inactive.png'),
45+
"image/png", ErrbitGithubPlugin.read_static_file("github_inactive.png")
4746
]
4847
}
4948
end
@@ -58,11 +57,11 @@ def url
5857

5958
def errors
6059
errors = []
61-
if self.class.fields.detect {|f| options[f[0]].blank? }
62-
errors << [:base, 'You must specify your GitHub username and password']
60+
if self.class.fields.detect { |f| options[f[0]].blank? }
61+
errors << [:base, "You must specify your GitHub username and password"]
6362
end
6463
if repo.blank?
65-
errors << [:base, 'You must specify your GitHub repository url.']
64+
errors << [:base, "You must specify your GitHub repository url."]
6665
end
6766
errors
6867
end
@@ -72,12 +71,14 @@ def repo
7271
end
7372

7473
def create_issue(title, body, user: {})
75-
if user['github_login'] && user['github_oauth_token']
76-
github_client = Octokit::Client.new(
77-
login: user['github_login'], access_token: user['github_oauth_token'])
74+
github_client = if user["github_login"] && user["github_oauth_token"]
75+
Octokit::Client.new(
76+
login: user["github_login"], access_token: user["github_oauth_token"]
77+
)
7878
else
79-
github_client = Octokit::Client.new(
80-
login: options['username'], password: options['password'])
79+
Octokit::Client.new(
80+
login: options["username"], password: options["password"]
81+
)
8182
end
8283
issue = github_client.create_issue(repo, title, body)
8384
issue.html_url
@@ -86,12 +87,14 @@ def create_issue(title, body, user: {})
8687
end
8788

8889
def close_issue(url, user: {})
89-
if user['github_login'] && user['github_oauth_token']
90-
github_client = Octokit::Client.new(
91-
login: user['github_login'], access_token: user['github_oauth_token'])
90+
github_client = if user["github_login"] && user["github_oauth_token"]
91+
Octokit::Client.new(
92+
login: user["github_login"], access_token: user["github_oauth_token"]
93+
)
9294
else
93-
github_client = Octokit::Client.new(
94-
login: options['username'], password: options['password'])
95+
Octokit::Client.new(
96+
login: options["username"], password: options["password"]
97+
)
9598
end
9699
# It would be better to get the number from issue.number when we create the issue,
97100
# however, since we only have the url, get the number from it.

lib/errbit_github_plugin/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module ErrbitGithubPlugin
4-
VERSION = '0.4.0'
4+
VERSION = "0.4.0"
55
end

0 commit comments

Comments
 (0)