Skip to content

Commit

Permalink
Fix up some Rubocop warts
Browse files Browse the repository at this point in the history
  • Loading branch information
esigler committed Feb 26, 2016
1 parent 5f291c7 commit dc0ccb9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 26 deletions.
7 changes: 0 additions & 7 deletions .rubocop.yml
Expand Up @@ -4,10 +4,3 @@ FileName:

LineLength:
Max: 190

Style/IndentArray:
EnforcedStyle: consistent
SupportedStyles:
- special_inside_parentheses
- consistent

18 changes: 6 additions & 12 deletions lib/jirahelper/issue.rb
Expand Up @@ -2,15 +2,12 @@
module JiraHelper
# Issues
module Issue
# NOTE: Prefer this syntax here as it's cleaner
# rubocop:disable Style/RescueEnsureAlignment
def fetch_issue(key, expected = true)
client.Issue.find(key)
rescue
log.error('JIRA HTTPError') if expected
nil
rescue
log.error('JIRA HTTPError') if expected
nil
end
# rubocop:enable Style/RescueEnsureAlignment

# Leverage the jira-ruby Issue.jql search feature
#
Expand All @@ -20,15 +17,12 @@ def fetch_issues(jql)
client.Issue.jql(jql)
end

# NOTE: Prefer this syntax here as it's cleaner
# rubocop:disable Style/RescueEnsureAlignment
def fetch_project(key)
client.Project.find(key)
rescue
log.error('JIRA HTTPError')
nil
rescue
log.error('JIRA HTTPError')
nil
end
# rubocop:enable Style/RescueEnsureAlignment

# NOTE: Not breaking this function out just yet.
# rubocop:disable Metrics/AbcSize
Expand Down
6 changes: 3 additions & 3 deletions lib/lita/handlers/jira.rb
Expand Up @@ -109,9 +109,9 @@ def myissues(response)
response.reply(t('error.request'))
return
end
# rubocop:disable Style/ZeroLengthPredicate
return response.reply(t('myissues.empty')) unless issues.size > 0
# rubocop:enable Style/ZeroLengthPredicate

return response.reply(t('myissues.empty')) if issues.empty?

response.reply(format_issues(issues))
end

Expand Down
8 changes: 4 additions & 4 deletions spec/lita/handlers/jira_spec.rb
Expand Up @@ -284,10 +284,10 @@ def send_room_message(body, room)
grab_request(valid_client)
send_command('jira myissues')
expect(replies[-3..-1]).to eq([
'Here are issues currently assigned to you:',
"[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987",
"[XYZ-988] Some summary text 2\nStatus: In Progress 2, assigned to: A Person 2, fixVersion: none, priority: P1\nhttp://jira.local/browse/XYZ-988"
])
'Here are issues currently assigned to you:',
"[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987",
"[XYZ-988] Some summary text 2\nStatus: In Progress 2, assigned to: A Person 2, fixVersion: none, priority: P1\nhttp://jira.local/browse/XYZ-988"
])
end

it 'shows an error when the search fails' do
Expand Down

0 comments on commit dc0ccb9

Please sign in to comment.