summaryrefslogtreecommitdiff
path: root/lib/bitbucket/representation
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
committerToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
commit62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch)
treec3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /lib/bitbucket/representation
parentf6453eca992a9c142268e78ac782cef98110d183 (diff)
downloadgitlab-ce-tc-standard-gem.tar.gz
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I decided to try https://github.com/testdouble/standard on our codebase. It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'lib/bitbucket/representation')
-rw-r--r--lib/bitbucket/representation/comment.rb10
-rw-r--r--lib/bitbucket/representation/issue.rb22
-rw-r--r--lib/bitbucket/representation/pull_request.rb34
-rw-r--r--lib/bitbucket/representation/pull_request_comment.rb16
-rw-r--r--lib/bitbucket/representation/repo.rb18
-rw-r--r--lib/bitbucket/representation/user.rb2
6 files changed, 51 insertions, 51 deletions
diff --git a/lib/bitbucket/representation/comment.rb b/lib/bitbucket/representation/comment.rb
index 1b8dc27793a..9c1848738ba 100644
--- a/lib/bitbucket/representation/comment.rb
+++ b/lib/bitbucket/representation/comment.rb
@@ -4,25 +4,25 @@ module Bitbucket
module Representation
class Comment < Representation::Base
def author
- user['username']
+ user["username"]
end
def note
- raw.fetch('content', {}).fetch('raw', nil)
+ raw.fetch("content", {}).fetch("raw", nil)
end
def created_at
- raw['created_on']
+ raw["created_on"]
end
def updated_at
- raw['updated_on'] || raw['created_on']
+ raw["updated_on"] || raw["created_on"]
end
private
def user
- raw.fetch('user', {})
+ raw.fetch("user", {})
end
end
end
diff --git a/lib/bitbucket/representation/issue.rb b/lib/bitbucket/representation/issue.rb
index a88797cdab9..7c7a586f3bf 100644
--- a/lib/bitbucket/representation/issue.rb
+++ b/lib/bitbucket/representation/issue.rb
@@ -3,42 +3,42 @@
module Bitbucket
module Representation
class Issue < Representation::Base
- CLOSED_STATUS = %w(resolved invalid duplicate wontfix closed).freeze
+ CLOSED_STATUS = %w[resolved invalid duplicate wontfix closed].freeze
def iid
- raw['id']
+ raw["id"]
end
def kind
- raw['kind']
+ raw["kind"]
end
def author
- raw.dig('reporter', 'username')
+ raw.dig("reporter", "username")
end
def description
- raw.fetch('content', {}).fetch('raw', nil)
+ raw.fetch("content", {}).fetch("raw", nil)
end
def state
- closed? ? 'closed' : 'opened'
+ closed? ? "closed" : "opened"
end
def title
- raw['title']
+ raw["title"]
end
def milestone
- raw['milestone']['name'] if raw['milestone'].present?
+ raw["milestone"]["name"] if raw["milestone"].present?
end
def created_at
- raw['created_on']
+ raw["created_on"]
end
def updated_at
- raw['edited_on']
+ raw["edited_on"]
end
def to_s
@@ -48,7 +48,7 @@ module Bitbucket
private
def closed?
- CLOSED_STATUS.include?(raw['state'])
+ CLOSED_STATUS.include?(raw["state"])
end
end
end
diff --git a/lib/bitbucket/representation/pull_request.rb b/lib/bitbucket/representation/pull_request.rb
index 6a0e8b354bf..ecb8746da8d 100644
--- a/lib/bitbucket/representation/pull_request.rb
+++ b/lib/bitbucket/representation/pull_request.rb
@@ -4,63 +4,63 @@ module Bitbucket
module Representation
class PullRequest < Representation::Base
def author
- raw.fetch('author', {}).fetch('username', nil)
+ raw.fetch("author", {}).fetch("username", nil)
end
def description
- raw['description']
+ raw["description"]
end
def iid
- raw['id']
+ raw["id"]
end
def state
- if raw['state'] == 'MERGED'
- 'merged'
- elsif raw['state'] == 'DECLINED'
- 'closed'
+ if raw["state"] == "MERGED"
+ "merged"
+ elsif raw["state"] == "DECLINED"
+ "closed"
else
- 'opened'
+ "opened"
end
end
def created_at
- raw['created_on']
+ raw["created_on"]
end
def updated_at
- raw['updated_on']
+ raw["updated_on"]
end
def title
- raw['title']
+ raw["title"]
end
def source_branch_name
- source_branch.fetch('branch', {}).fetch('name', nil)
+ source_branch.fetch("branch", {}).fetch("name", nil)
end
def source_branch_sha
- source_branch.fetch('commit', {}).fetch('hash', nil)
+ source_branch.fetch("commit", {}).fetch("hash", nil)
end
def target_branch_name
- target_branch.fetch('branch', {}).fetch('name', nil)
+ target_branch.fetch("branch", {}).fetch("name", nil)
end
def target_branch_sha
- target_branch.fetch('commit', {}).fetch('hash', nil)
+ target_branch.fetch("commit", {}).fetch("hash", nil)
end
private
def source_branch
- raw['source']
+ raw["source"]
end
def target_branch
- raw['destination']
+ raw["destination"]
end
end
end
diff --git a/lib/bitbucket/representation/pull_request_comment.rb b/lib/bitbucket/representation/pull_request_comment.rb
index 34dbf9ad22d..7eb8ef6803f 100644
--- a/lib/bitbucket/representation/pull_request_comment.rb
+++ b/lib/bitbucket/representation/pull_request_comment.rb
@@ -4,37 +4,37 @@ module Bitbucket
module Representation
class PullRequestComment < Comment
def iid
- raw['id']
+ raw["id"]
end
def file_path
- inline.fetch('path')
+ inline.fetch("path")
end
def old_pos
- inline.fetch('from')
+ inline.fetch("from")
end
def new_pos
- inline.fetch('to')
+ inline.fetch("to")
end
def parent_id
- raw.fetch('parent', {}).fetch('id', nil)
+ raw.fetch("parent", {}).fetch("id", nil)
end
def inline?
- raw.key?('inline')
+ raw.key?("inline")
end
def has_parent?
- raw.key?('parent')
+ raw.key?("parent")
end
private
def inline
- raw.fetch('inline', {})
+ raw.fetch("inline", {})
end
end
end
diff --git a/lib/bitbucket/representation/repo.rb b/lib/bitbucket/representation/repo.rb
index c5bfc91e43d..78dcca4883d 100644
--- a/lib/bitbucket/representation/repo.rb
+++ b/lib/bitbucket/representation/repo.rb
@@ -10,7 +10,7 @@ module Bitbucket
end
def owner_and_slug
- @owner_and_slug ||= full_name.split('/', 2)
+ @owner_and_slug ||= full_name.split("/", 2)
end
def owner
@@ -22,7 +22,7 @@ module Bitbucket
end
def clone_url(token = nil)
- url = raw['links']['clone'].find { |link| link['name'] == 'https' }.fetch('href')
+ url = raw["links"]["clone"].find { |link| link["name"] == "https" }.fetch("href")
if token.present?
clone_url = URI.parse(url)
@@ -34,31 +34,31 @@ module Bitbucket
end
def description
- raw['description']
+ raw["description"]
end
def full_name
- raw['full_name']
+ raw["full_name"]
end
def issues_enabled?
- raw['has_issues']
+ raw["has_issues"]
end
def name
- raw['name']
+ raw["name"]
end
def valid?
- raw['scm'] == 'git'
+ raw["scm"] == "git"
end
def has_wiki?
- raw['has_wiki']
+ raw["has_wiki"]
end
def visibility_level
- if raw['is_private']
+ if raw["is_private"]
Gitlab::VisibilityLevel::PRIVATE
else
Gitlab::VisibilityLevel::PUBLIC
diff --git a/lib/bitbucket/representation/user.rb b/lib/bitbucket/representation/user.rb
index 2b45d751e70..23d7008de92 100644
--- a/lib/bitbucket/representation/user.rb
+++ b/lib/bitbucket/representation/user.rb
@@ -4,7 +4,7 @@ module Bitbucket
module Representation
class User < Representation::Base
def username
- raw['username']
+ raw["username"]
end
end
end