Skip to content

Commit

Permalink
Merge pull request #133 from SonicGarden/0.8.5
Browse files Browse the repository at this point in the history
[review] 0.8.5
  • Loading branch information
aki77 authored Apr 5, 2023
2 parents 7f1af48 + 5c79c1c commit 8804ac1
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 17 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "weekly"
26 changes: 26 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ruby

on:
push:
branches: [master]
pull_request:

jobs:
rspec:
runs-on: ubuntu-latest
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2"]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run rspec
run: bundle exec rspec
2 changes: 1 addition & 1 deletion lib/sgcop/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Sgcop
VERSION = '0.8.4'.freeze
VERSION = '0.8.5'.freeze
end
6 changes: 6 additions & 0 deletions ruby/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ Style/DirEmpty: # new in 1.48
# https://docs.rubocop.org/rubocop/cops_style.html#stylefileempty
Style/FileEmpty: # new in 1.48
Enabled: true
# https://docs.rubocop.org/rubocop/cops_style.html#styledatainheritance
Style/DataInheritance: # new in 1.49
Enabled: true
# https://docs.rubocop.org/rubocop/cops_style.html#styleredundantlinecontinuation
Style/RedundantLineContinuation: # new in 1.49
Enabled: true

# ============================================================
# Lint
Expand Down
2 changes: 1 addition & 1 deletion sgcop.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_dependency 'rubocop', '~> 1.48.0'
spec.add_dependency 'rubocop', '~> 1.49.0'
spec.add_dependency 'rubocop-capybara', '~> 2.17.0'
spec.add_dependency 'rubocop-performance', '~> 1.16.0'
spec.add_dependency 'rubocop-rails', '~> 2.18.0'
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/sgcop/capybara/sleep_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
it do
click_on 'button'
sleep 10
^^^^^ Do not use `sleep` in spec.
^^^^^ Sgcop/Capybara/Sleep: Do not use `sleep` in spec.
end
RUBY
end
Expand All @@ -18,7 +18,7 @@
it do
click_on 'button'
Kernel.sleep 10
^^^^^ Do not use `sleep` in spec.
^^^^^ Sgcop/Capybara/Sleep: Do not use `sleep` in spec.
end
RUBY
end
Expand Down
4 changes: 2 additions & 2 deletions spec/rubocop/cop/sgcop/link_to_ujs_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
it 'methodオプションは警告' do
expect_offense(<<~RUBY)
link_to 'title', url, method: :delete
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Deprecated: Rails UJS Attributes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/UjsOptions: Deprecated: Rails UJS Attributes.
RUBY
end

it 'remoteオプションは警告' do
expect_offense(<<~RUBY)
link_to 'title', url, remote: true
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Deprecated: Rails UJS Attributes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/UjsOptions: Deprecated: Rails UJS Attributes.
RUBY
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/sgcop/request_remote_ip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
expect_offense(<<~RUBY)
def log
logger.info request.remote_addr
^^^^^^^^^^^^^^^^^^^ Use `request.remote_ip` instead of `request.remote_addr`.
^^^^^^^^^^^^^^^^^^^ Sgcop/RequestRemoteIp: Use `request.remote_ip` instead of `request.remote_addr`.
end
RUBY
end
Expand Down
6 changes: 3 additions & 3 deletions spec/rubocop/cop/sgcop/simple_form_association_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
expect_offense(<<~RUBY)
simple_form_for user do |f|
f.association :group
^^^^^^^^^^^^^^^^^^^^ Specify the `collection` option
^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormAssociation: Specify the `collection` option
end
RUBY
end
Expand All @@ -35,7 +35,7 @@
expect_offense(<<~RUBY)
simple_nested_form_for user do |f|
f.association :group
^^^^^^^^^^^^^^^^^^^^ Specify the `collection` option
^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormAssociation: Specify the `collection` option
end
RUBY
end
Expand Down Expand Up @@ -63,7 +63,7 @@
simple_form_for user do |f|
f.simple_fields_for :posts do |ff|
ff.association :category
^^^^^^^^^^^^^^^^^^^^^^^^ Specify the `collection` option
^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormAssociation: Specify the `collection` option
end
end
RUBY
Expand Down
10 changes: 5 additions & 5 deletions spec/rubocop/cop/sgcop/simple_format_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
expect_offense(<<~RUBY)
def html_format(text)
simple_format(text)
^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
end
RUBY
end
Expand All @@ -16,7 +16,7 @@ def html_format(text)
expect_offense(<<~RUBY)
def html_format(object)
simple_format(object.body)
^^^^^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
end
RUBY
end
Expand All @@ -30,21 +30,21 @@ def html_format(object)
it 'simple_formatにエスケープメソッド以外の結果が渡されていたら警告' do
expect_offense(<<~RUBY)
simple_format(t(text))
^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
RUBY
end

it 'simple_formatにインスタンス変数が渡されていたら警告' do
expect_offense(<<~RUBY)
simple_format(@object)
^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
RUBY
end

it 'simple_formatにインスタンス変数のメソッドが渡されていたら警告' do
expect_offense(<<~RUBY)
simple_format(@object.body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^ simple_format does not escape HTML tags.
^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sgcop/SimpleFormat: simple_format does not escape HTML tags.
RUBY
end
end
2 changes: 1 addition & 1 deletion spec/rubocop/cop/sgcop/unscoped_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class BooksController < ApplicationController
def index
@books = books.unscoped.default_order
^^^^^^^^^^^^^^ Do not use `unscoped`
^^^^^^^^^^^^^^ Sgcop/Unscoped: Do not use `unscoped`
end
end
RUBY
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/sgcop/whenever_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set :chronic_options, hours24: true
every 1.day, at: '7:10 am' do
^^^^^^^^^^^^^ Use 24-hour clock to avoid errors.
^^^^^^^^^^^^^ Sgcop/Whenever: Use 24-hour clock to avoid errors.
rake 'sgcop'
end
RUBY
Expand Down

0 comments on commit 8804ac1

Please sign in to comment.