Rubocop unstable 0.87 (#373)

This commit is contained in:
Luca Guidi 2020-07-07 08:51:14 +02:00 committed by GitHub
parent 9de4ddcce3
commit 08e83cb67b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 18 additions and 220 deletions

View File

@ -4,31 +4,6 @@
#
version: 2
jobs:
"ruby-2.5":
docker:
- image: hanami/ruby-2.5
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
"ruby-2.6":
docker:
- image: hanami/ruby-2.6
@ -79,63 +54,9 @@ jobs:
name: run tests
command: |
./script/ci
"jruby-9.1":
docker:
- image: hanami/jruby-9.1
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
"jruby-9.2":
docker:
- image: hanami/jruby-9.2
working_directory: ~/hanami-utils
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
# run tests!
- run:
name: run tests
command: |
./script/ci
workflows:
version: 2
build:
jobs:
- "ruby-2.5"
- "ruby-2.6"
- "ruby-2.7"
- "jruby-9.1"
- "jruby-9.2"

View File

@ -93,94 +93,6 @@ volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: ruby-2-5
group: build
steps:
- name: install
image: ruby:2.5
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: ruby:2.5
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: isolation
image: ruby:2.5
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ./script/test isolation
- name: quality
image: ruby:2.5
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: jruby-9-2
group: build
steps:
- name: install
image: hanami/jruby-9.2
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- ruby -v
- gem install bundler
- bundle install --jobs=3 --retry=3
- name: unit
image: hanami/jruby-9.2
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- COVERAGE=true bundle exec rake spec:unit
- name: quality
image: hanami/jruby-9.2
environment:
CODECOV_TOKEN:
from_secret: codecov
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bundle exec rubocop
- CI=true bundle exec rake codecov:upload
volumes:
- name: bundle
temp: {}
---
kind: pipeline
name: slack
@ -190,7 +102,7 @@ clone:
disable: true
depends_on:
- jruby-9-2
- ruby-2-6
steps:
- name: slack

View File

@ -1 +0,0 @@
language: ruby

View File

@ -2,10 +2,6 @@
# alphabetically
inherit_from:
- https://raw.githubusercontent.com/hanami/devtools/master/.rubocop-unstable.yml
AllCops:
Exclude:
- "tmp/**/*"
- "vendor/**/*"
Naming/HeredocDelimiterNaming:
Exclude:
- "spec/**/*"

View File

@ -1,30 +0,0 @@
language: ruby
sudo: false
cache: bundler
before_install:
- travis_retry gem update --system || travis_retry gem update --system 2.7.8
- travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
before_script:
- gem update --system
script: ./script/ci
rvm:
- 2.5
- 2.6
- 2.7
- jruby-9.2
- ruby-head
- jruby-head
matrix:
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
- rvm: jruby-9.2
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/fde2367248d53de4fe70
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always

View File

@ -14,5 +14,4 @@ end
gem "gson", ">= 0.6", require: false, platforms: :jruby
gem "rubocop", "~> 0.79.0", require: false
gem "codecov", require: false, group: :test

View File

@ -22,7 +22,7 @@ Ruby core extensions and class utilities for [Hanami](http://hanamirb.org)
## Rubies
__Hanami::Utils__ supports Ruby (MRI) 2.5+
__Hanami::Utils__ supports Ruby (MRI) 2.6+
## Installation

View File

@ -18,12 +18,13 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.required_ruby_version = ">= 2.5.0"
spec.required_ruby_version = ">= 2.6.0"
spec.add_dependency "transproc", "~> 1.0"
spec.add_dependency "concurrent-ruby", "~> 1.0"
spec.add_development_dependency "bundler", ">= 1.6", "< 3"
spec.add_development_dependency "rake", "~> 13"
spec.add_development_dependency "rspec", "~> 3.7"
spec.add_development_dependency "rspec", "~> 3.9"
spec.add_development_dependency "rubocop", "~> 0.87"
end

View File

@ -71,7 +71,7 @@ module Hanami
# @since 1.0.0
# @api private
def self.for_each_file_in(directory, &blk)
directory = directory.to_s.gsub(%r{(\/|\\)}, File::SEPARATOR)
directory = directory.to_s.gsub(%r{(/|\\)}, File::SEPARATOR)
directory = Pathname.new(Dir.pwd).join(directory).to_s
directory = File.join(directory, "**", "*.rb") unless directory =~ /(\*\*)/

View File

@ -314,7 +314,7 @@ module Hanami
line = content[starting]
size = line[/\A[[:space:]]*/].bytesize
closing = (" " * size) + (/{/.match?(target) ? "}" : "end")
ending = starting + index(content[starting..-1], path, closing)
ending = starting + index(content[starting..], path, closing)
content.slice!(starting..ending)
write(path, content)

View File

@ -144,13 +144,13 @@ module Hanami
# input
# # => {"a"=>{"b"=>{"c"=>[1,2,3,4]}}}
def self.deep_dup(input)
input.each_with_object({}) do |(k, v), result|
result[k] = case v
when ::Hash
deep_dup(v)
else
v.dup
end
input.transform_values do |v|
case v
when ::Hash
deep_dup(v)
else
v.dup
end
end
end

View File

@ -28,7 +28,7 @@ module Hanami
# @api private
#
# @see Hanami::Utils::Kernel.Integer
NUMERIC_MATCHER = %r{\A([\d\/\.\+iE]+|NaN|Infinity)\z}.freeze
NUMERIC_MATCHER = %r{\A([\d/.+iE]+|NaN|Infinity)\z}.freeze
# @since 0.8.0
# @api private
@ -1057,7 +1057,7 @@ module Hanami
end
class << self
private :inspect_type_error # rubocop:disable Style/AccessModifierDeclarations
private :inspect_type_error
end
end
end

View File

@ -254,7 +254,7 @@ module Hanami
string.gsub!(NAMESPACE_SEPARATOR, UNDERSCORE_SEPARATOR)
string.gsub!(/([A-Z\d]+)([A-Z][a-z])/, UNDERSCORE_DIVISION_TARGET)
string.gsub!(/([a-z\d])([A-Z])/, UNDERSCORE_DIVISION_TARGET)
string.gsub!(/[[:space:]]|\-/, UNDERSCORE_DIVISION_TARGET)
string.gsub!(/[[:space:]]|-/, UNDERSCORE_DIVISION_TARGET)
string.downcase
end
@ -447,7 +447,7 @@ module Hanami
new_string = gsub(NAMESPACE_SEPARATOR, UNDERSCORE_SEPARATOR)
new_string.gsub!(/([A-Z\d]+)([A-Z][a-z])/, UNDERSCORE_DIVISION_TARGET)
new_string.gsub!(/([a-z\d])([A-Z])/, UNDERSCORE_DIVISION_TARGET)
new_string.gsub!(/[[:space:]]|\-/, UNDERSCORE_DIVISION_TARGET)
new_string.gsub!(/[[:space:]]|-/, UNDERSCORE_DIVISION_TARGET)
new_string.downcase!
self.class.new new_string
end