summaryrefslogtreecommitdiff
path: root/lib/flowdock/git.rb
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-10-15 17:25:35 +0100
committerNick Thomas <nick@gitlab.com>2018-10-16 11:54:55 +0100
commit8d3222925eca278fc7641bdf319cc79c008a722a (patch)
treea0a5c0c66178f11531e7f0c1eec79455999a09de /lib/flowdock/git.rb
parent04aaf71932646efd99f2abd74fc59e3129fcbe1d (diff)
downloadgitlab-ce-8d3222925eca278fc7641bdf319cc79c008a722a.tar.gz
Rubocop improvements
Diffstat (limited to 'lib/flowdock/git.rb')
-rw-r--r--lib/flowdock/git.rb30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/flowdock/git.rb b/lib/flowdock/git.rb
index 43e729c27d7..d5e97dad3cf 100644
--- a/lib/flowdock/git.rb
+++ b/lib/flowdock/git.rb
@@ -1,4 +1,4 @@
-
+# frozen_string_literal: true
require "multi_json"
require "cgi"
require "flowdock"
@@ -6,7 +6,7 @@ require "flowdock/git/builder"
module Flowdock
class Git
- class TokenError < StandardError; end
+ TokenError = Class.new(StandardError)
class << self
def post(ref, from, to, options = {})
@@ -28,11 +28,12 @@ module Flowdock
@diff_url = options[:diff_url] || config["flowdock.diff-url-pattern"] || nil
@repo_url = options[:repo_url] || config["flowdock.repository-url"] || nil
@repo_name = options[:repo_name] || config["flowdock.repository-name"] || nil
- @permanent_refs = options[:permanent_refs] ||
- (config["flowdock.permanent-references"] || "refs/heads/master")
- .split(",")
- .map(&:strip)
- .map {|exp| Regexp.new(exp) }
+
+ refs = options[:permanent_refs] || config["flowdock.permanent-references"] || "refs/heads/master"
+ @permanent_refs = refs
+ .split(",")
+ .map(&:strip)
+ .map {|exp| Regexp.new(exp) }
end
# Send git push notification to Flowdock
@@ -80,13 +81,14 @@ module Flowdock
# Flowdock tags attached to the push notification
def tags
- if @options[:tags]
- @options[:tags]
- else
- config["flowdock.tags"].to_s.split(",").map(&:strip)
- end.map do |t|
- CGI.escape(t)
- end
+ tags =
+ if @options[:tags]
+ @options[:tags]
+ else
+ config["flowdock.tags"].to_s.split(",").map(&:strip)
+ end
+
+ tags.map { |t| CGI.escape(t) }
end
def config