irphilli/tracker_api

View on GitHub

Showing 22 of 22 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module Endpoints
class Epic
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/epic.rb and 1 other location - About 3 hrs to fix
lib/tracker_api/endpoints/story.rb on lines 2..35

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module Endpoints
class Story
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/story.rb and 1 other location - About 3 hrs to fix
lib/tracker_api/endpoints/epic.rb on lines 2..35

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module Endpoints
class Memberships
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/memberships.rb and 1 other location - About 1 hr to fix
lib/tracker_api/endpoints/labels.rb on lines 2..22

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module Endpoints
class Labels
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/labels.rb and 1 other location - About 1 hr to fix
lib/tracker_api/endpoints/memberships.rb on lines 2..22

Method paginate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def paginate(path, options = {}, &block)
opts = parse_query_and_convenience_headers path, options.dup
auto_paginate = opts[:params].delete(:auto_paginate) { |k| @auto_paginate }
@last_response = request :get, opts
data = @last_response.body
Severity: Minor
Found in lib/tracker_api/client.rb - About 55 mins to fix

Similar blocks of code found in 3 locations. Consider refactoring.
Open

module Endpoints
class Webhooks
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/webhooks.rb and 2 other locations - About 55 mins to fix
lib/tracker_api/endpoints/iterations.rb on lines 2..15
lib/tracker_api/endpoints/releases.rb on lines 2..15

Similar blocks of code found in 3 locations. Consider refactoring.
Open

module Endpoints
class Releases
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/releases.rb and 2 other locations - About 55 mins to fix
lib/tracker_api/endpoints/iterations.rb on lines 2..15
lib/tracker_api/endpoints/webhooks.rb on lines 2..15

Similar blocks of code found in 3 locations. Consider refactoring.
Open

module Endpoints
class Iterations
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/iterations.rb and 2 other locations - About 55 mins to fix
lib/tracker_api/endpoints/releases.rb on lines 2..15
lib/tracker_api/endpoints/webhooks.rb on lines 2..15

Similar blocks of code found in 3 locations. Consider refactoring.
Open

module Endpoints
class Projects
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/projects.rb and 2 other locations - About 45 mins to fix
lib/tracker_api/endpoints/notifications.rb on lines 2..15
lib/tracker_api/endpoints/workspaces.rb on lines 2..14

Similar blocks of code found in 3 locations. Consider refactoring.
Open

module Endpoints
class Workspaces
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/workspaces.rb and 2 other locations - About 45 mins to fix
lib/tracker_api/endpoints/notifications.rb on lines 2..15
lib/tracker_api/endpoints/projects.rb on lines 2..14

Similar blocks of code found in 3 locations. Consider refactoring.
Open

module Endpoints
class Notifications
attr_accessor :client
 
def initialize(client)
Severity: Major
Found in lib/tracker_api/endpoints/notifications.rb and 2 other locations - About 45 mins to fix
lib/tracker_api/endpoints/projects.rb on lines 2..14
lib/tracker_api/endpoints/workspaces.rb on lines 2..14

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def update(task, params={})
raise ArgumentError, 'Valid task required to update.' unless task.instance_of?(Resources::Task)
 
data = client.put("/projects/#{task.project_id}/stories/#{task.story_id}/tasks/#{task.id}",
params: params).body
Severity: Minor
Found in lib/tracker_api/endpoints/task.rb and 1 other location - About 40 mins to fix
lib/tracker_api/endpoints/review.rb on lines 10..17

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def update(review, params = {})
raise ArgumentError, 'Valid review required to update.' unless review.instance_of?(Resources::Review)
 
data = client.put("/projects/#{review.project_id}/stories/#{review.story_id}/reviews/#{review.id}", params: params).body
 
 
Severity: Minor
Found in lib/tracker_api/endpoints/review.rb and 1 other location - About 40 mins to fix
lib/tracker_api/endpoints/task.rb on lines 15..23

Method add_owner has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def add_owner(owner)
owner_id = if owner.kind_of?(Integer)
owner_id = owner
else
raise ArgumentError, 'Valid Person expected.' unless owner.instance_of?(Resources::Person)
Severity: Minor
Found in lib/tracker_api/resources/story.rb - About 35 mins to fix

Method request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def request(method, options = {})
url = options.fetch(:url)
params = options[:params] || {}
body = options[:body]
headers = options[:headers]
Severity: Minor
Found in lib/tracker_api/client.rb - About 35 mins to fix

Method update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def update(comment, params={})
raise ArgumentError, 'Valid comment required to update.' unless comment.instance_of?(Resources::Comment)
 
comment_target_slug = !comment.story_id.nil? ? "stories/#{comment.story_id}" : "epics/#{comment.epic_id}"
 
 
Severity: Minor
Found in lib/tracker_api/endpoints/comment.rb - About 25 mins to fix

Method get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get(project_id, story_id: nil, epic_id: nil, params: {})
raise ArgumentError, 'One of story id or epic id must be provided.' if story_id.nil? && epic_id.nil?
 
comment_target_slug = !story_id.nil? ? "stories/#{story_id}" : "epics/#{epic_id}"
 
 
Severity: Minor
Found in lib/tracker_api/endpoints/comments.rb - About 25 mins to fix

Method iterations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def iterations(params={})
if params.include?(:number)
number = params[:number].to_i
raise ArgumentError, ':number must be > 0' unless number > 0
 
 
Severity: Minor
Found in lib/tracker_api/resources/project.rb - About 25 mins to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def create_comment(params)
files = params.delete(:files)
comment = Endpoints::Comment.new(client).create(project_id, epic_id: id, params: params)
comment.create_attachments(files: files) if files.present?
comment
Severity: Minor
Found in lib/tracker_api/resources/epic.rb and 1 other location - About 20 mins to fix
lib/tracker_api/resources/story.rb on lines 195..199

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def create_comment(params)
files = params.delete(:files)
comment = Endpoints::Comment.new(client).create(project_id, story_id: id, params: params)
comment.create_attachments(files: files) if files.present?
comment
Severity: Minor
Found in lib/tracker_api/resources/story.rb and 1 other location - About 20 mins to fix
lib/tracker_api/resources/epic.rb on lines 50..54
Severity
Category
Status
Source
Language