Skip to content

Commit

Permalink
Upgraded to Ruby 2.7.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Jan 16, 2023
1 parent 3fcb959 commit 62ee320
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6.5"
ruby-version: "2.7.7"
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6.5"
ruby-version: "2.7.7"
bundler-cache: true
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
Expand Down
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
AllCops:
NewCops: enable

Style/FrozenStringLiteralComment:
Enabled: false

Expand Down
34 changes: 31 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-08-20 15:04:12 UTC using RuboCop version 0.89.1.
# on 2023-01-16 18:38:55 UTC using RuboCop version 0.89.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -13,11 +13,13 @@ Lint/NonDeterministicRequireOrder:
- 'slack-arena.rb'
- 'spec/spec_helper.rb'

# Offense count: 1
# Offense count: 3
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'repro/issue-39.rb'
- 'repro/issue-40.rb'
- 'slack-arena.rb'

# Offense count: 4
Expand All @@ -37,6 +39,18 @@ Naming/MethodParameterName:
- 'slack-arena/app.rb'
- 'slack-arena/models/team.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/HashTransformKeys:
Exclude:
- 'slack-arena/api/helpers/error_helpers.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/HashTransformValues:
Exclude:
- 'slack-arena/api/helpers/error_helpers.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/NestedTernaryOperator:
Expand All @@ -52,7 +66,21 @@ Style/NumericPredicate:
- 'spec/**/*'
- 'slack-arena/app.rb'

# Offense count: 54
# Offense count: 1
# Cop supports --auto-correct.
Style/SlicingWithRange:
Exclude:
- 'slack-arena/api/helpers/sort_helpers.rb'

# Offense count: 3
# Cop supports --auto-correct.
Style/StringConcatenation:
Exclude:
- 'slack-arena.rb'
- 'slack-arena/api/helpers/error_helpers.rb'
- 'slack-arena/models/team.rb'

# Offense count: 56
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Changelog

* 2023/01/16: Upgraded to Ruby 2.7.7 - [@dblock](https://github.com/dblock).
* 2022/01/07: Corrected blank display names when searching for users - [@dblock](https://github.com/dblock).
* 2018/05/29: Added `/arena search` - [@dblock](https://github.com/dblock).
* 2018/05/28: Added `/arena channels` - [@dblock](https://github.com/dblock).
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'http://rubygems.org'

ruby '2.6.5'
ruby '2.7.7'

gem 'arena'
gem 'grape'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ DEPENDENCIES
webmock

RUBY VERSION
ruby 2.6.5p114
ruby 2.7.7p221

BUNDLED WITH
1.17.2
2.3.26
3 changes: 1 addition & 2 deletions slack-arena/api/helpers/sort_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def sort_order(options = {})
error!("Invalid sort order: #{sort_order}, must be#{supported_sort_orders.count == 1 ? '' : ' one of'} '#{supported_sort_orders.join('\', \'')}'", 400)
end
end
sort_order = sort_order.split(',').map do |sort_entry|
sort_order.split(',').map do |sort_entry|
sort_order = {}
if sort_entry[0] == '-'
sort_order[:direction] = :desc
Expand All @@ -27,7 +27,6 @@ def sort_order(options = {})
error!("Invalid sort: #{sort_entry}", 400) if sort_order[:column].blank?
sort_order
end
sort_order
end

def route_sort
Expand Down
4 changes: 2 additions & 2 deletions slack-arena/api/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Middleware
def self.logger
@logger ||= begin
$stdout.sync = true
Logger.new(STDOUT)
Logger.new($stdout)
end
end

Expand All @@ -18,7 +18,7 @@ def self.instance

# rewrite HAL links to make them clickable in a browser
use Rack::Rewrite do
r302 %r{(\/[\w\/]*\/)(%7B|\{)?(.*)(%7D|\})}, '$1'
r302 %r{(/[\w/]*/)(%7B|\{)?(.*)(%7D|\})}, '$1'
end

use Rack::Robotz, 'User-Agent' => '*', 'Disallow' => '/api'
Expand Down
15 changes: 7 additions & 8 deletions slack-arena/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def connect_to_arena_to_slack(channel_id)
url = connect_to_arena_url(channel_id)
{
text: 'Please connect your Are.na account.', attachments: [
fallback: "Please connect your Are.na account at #{url}.",
actions: [
type: 'button',
text: 'Click Here',
url: url
]
{ fallback: "Please connect your Are.na account at #{url}.",
actions: [
{ type: 'button',
text: 'Click Here',
url: url }
] }
]
}
end
Expand Down Expand Up @@ -101,8 +101,7 @@ def self.find_by_slack_mention!(team, user_name)

def self.find_create_or_update_by_team_and_slack_id!(team_id, user_id)
team = Team.where(team_id: team_id).first || raise("Cannot find team ID #{team_id}")
user = User.where(team: team, user_id: user_id).first || User.create!(team: team, user_id: user_id)
user
User.where(team: team, user_id: user_id).first || User.create!(team: team, user_id: user_id)
end

# Find an existing record, update the username if necessary, otherwise create a user record.
Expand Down
2 changes: 1 addition & 1 deletion spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
response = client.send(model_ps, cursor_params.merge(size: 2))
expect(response._links.self._url).to eq "http://example.org/api/#{model_ps}?#{cursor_params.merge(size: 2).to_query}"
expect(response._links.next._url).to start_with "http://example.org/api/#{model_ps}?"
expect(response._links.next._url).to match(/cursor\=.*%3A\h*/)
expect(response._links.next._url).to match(/cursor=.*%3A\h*/)
end

it 'paginates over the entire collection' do
Expand Down

0 comments on commit 62ee320

Please sign in to comment.