grokify/lita-zendesk

View on GitHub

Showing 93 of 93 total issues

Line is too long. [171/80]
Open

      route(/^(?:zd|zendesk)\s+list\s+(all|total)\s+tickets?\s*$/i, :total_tickets_list, command: true, help: { 'zd list all tickets' => 'returns a list of all tickets' })
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Freeze mutable objects assigned to constants.
Open

      WEB_TICKETS_URL_PATH = 'tickets'
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Use empty? instead of length < 1.
Open

          if parts.length < 1 || user.email != user.name
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

This cop checks for numeric comparisons that can be replaced by a predicate method, such as receiver.length == 0, receiver.length > 0, receiver.length != 0, receiver.length < 1 and receiver.size == 0 that can be replaced by receiver.empty? and !receiver.empty.

Example:

# bad
[1, 2, 3].length == 0
0 == "foobar".length
array.length < 1
{a: 1, b: 2}.length != 0
string.length > 0
hash.size > 0

# good
[1, 2, 3].empty?
"foobar".empty?
array.empty?
!{a: 1, b: 2}.empty?
!string.empty?
!hash.empty?

Line is too long. [164/80]
Open

      route(/^(?:zd|zendesk)\s+search\s+tickets?\s+(\S.*?)\s*$/i, :search_tickets, command: true, help: { 'zd search tickets <QUERY>' => 'returns search results' })
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Line is too long. [164/80]
Open

      route(/^(?:zd|zendesk)\s+new\s+tickets?\s*$/i, :new_tickets, command: true, help: { 'zd new tickets' => 'returns the count of all new (unassigned) tickets' })
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Use next to skip iteration.
Open

          if (comment = audit.events.detect {|e| e.type.downcase == 'comment'})
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Use next to skip iteration instead of a condition at the end.

Example: EnforcedStyle: skipmodifierifs (default)

# bad
[1, 2].each do |a|
  if a == 1
    puts a
  end
end

# good
[1, 2].each do |a|
  next unless a == 1
  puts a
end

# good
[1, 2].each do |o|
  puts o unless o == 1
end

Example: EnforcedStyle: always

# With `always` all conditions at the end of an iteration needs to be
# replaced by next - with `skip_modifier_ifs` the modifier if like
# this one are ignored: `[1, 2].each { |a| return 'yes' if a == 1 }`

# bad
[1, 2].each do |o|
  puts o unless o == 1
end

# bad
[1, 2].each do |a|
  if a == 1
    puts a
  end
end

# good
[1, 2].each do |a|
  next unless a == 1
  puts a
end

Use !empty? instead of length > 0.
Open

        if user.email.to_s.length > 0
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

This cop checks for numeric comparisons that can be replaced by a predicate method, such as receiver.length == 0, receiver.length > 0, receiver.length != 0, receiver.length < 1 and receiver.size == 0 that can be replaced by receiver.empty? and !receiver.empty.

Example:

# bad
[1, 2, 3].length == 0
0 == "foobar".length
array.length < 1
{a: 1, b: 2}.length != 0
string.length > 0
hash.size > 0

# good
[1, 2, 3].empty?
"foobar".empty?
array.empty?
!{a: 1, b: 2}.empty?
!string.empty?
!hash.empty?

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require "lita-zendesk"
Severity: Minor
Found in spec/spec_helper.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

The name of this source file (lita-zendesk.rb) should use snake_case.
Open

require 'lita'
Severity: Minor
Found in lib/lita-zendesk.rb by rubocop

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

Example:

# bad
lib/layoutManager.rb

anything/usingCamelCase

# good
lib/layout_manager.rb

anything/using_snake_case.rake

Line is too long. [155/80]
Open

      route(/^(?:zd|zendesk)\s+open\s+tickets?\s*$/i, :open_tickets, command: true, help: { 'zd open tickets' => 'returns the count of all open tickets' })
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Line is too long. [111/80]
Open

        response.reply "Listing #{serp_count} of #{tickets.count} #{ticket_desc}#{ticket_word(tickets.count)}."
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require "bundler/gem_tasks"
Severity: Minor
Found in Rakefile by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [168/80]
Open

      route(/^(?:zd|zendesk)\s+on\s*hold\s+tickets?\s*$/i, :onhold_tickets, command: true, help: { 'zd on hold tickets' => 'returns the count of all on hold tickets' })
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Freeze mutable objects assigned to constants.
Open

      QUERY_TICKETS_UNSOLVED = 'type:ticket status<solved'
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Redundant return detected.
Open

        return comments_text.reverse.join("\n")
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

%q-literals should be delimited by ( and ).
Open

  spec.description   = %q{A Zendesk handler for Lita.}
Severity: Minor
Found in lita-zendesk.gemspec by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Use %q only for strings that contain both single quotes and double quotes.
Open

  spec.description   = %q{A Zendesk handler for Lita.}
Severity: Minor
Found in lita-zendesk.gemspec by rubocop

Line is too long. [90/80]
Open

        Lita.logger.info "#{logger_prefix}Connecting Zendesk Client to #{api_version_url}"
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Line is too long. [178/80]
Open

      route(/^(?:zd|zendesk)\s+ticket\s+(\d+)\s*$/i, :ticket_details_with_comments, command: true, help: { 'zd ticket <ID>' => 'returns information about the specified ticket' })
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop

Line is too long. [95/80]
Open

        Lita.logger.info "#{logger_prefix}Processing Zendesk ticket details for [#{ticket.id}]"
Severity: Minor
Found in lib/lita/handlers/zendesk.rb by rubocop
Severity
Category
Status
Source
Language