Skip to content

Commit

Permalink
rubocop: added rubocop-packaging plugin; expanded inclusion of files
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Apr 19, 2021
1 parent 487eb70 commit 8c4ccfc
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .rubocop.yml
@@ -1,12 +1,15 @@
require:
- rubocop-minitest
- rubocop-packaging
- rubocop-performance
- rubocop-rake
- rubocop-minitest

# trying to be good O:)
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
Exclude:
- ___*/**/* # '___' prefixed dirs are excluded

# No, thank you!
Layout:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -17,6 +17,7 @@ group :test do
gem 'minitest-reporters'
gem 'rubocop', '~> 1.11', require: false
gem 'rubocop-minitest', require: false
gem 'rubocop-packaging', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rake', require: false
gem 'simplecov', require: false
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -56,6 +56,8 @@ GEM
parser (>= 2.7.1.5)
rubocop-minitest (0.10.3)
rubocop (>= 0.87, < 2.0)
rubocop-packaging (0.5.1)
rubocop (>= 0.89, < 2.0)
rubocop-performance (1.10.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0)
Expand Down Expand Up @@ -103,6 +105,7 @@ DEPENDENCIES
rake
rubocop (~> 1.11)
rubocop-minitest
rubocop-packaging
rubocop-performance
rubocop-rake
ruby-debug-ide
Expand Down
4 changes: 1 addition & 3 deletions Rakefile
Expand Up @@ -43,9 +43,7 @@ task test: [*test_tasks.keys, :test_others]

task default: ( if ENV['RUN_RUBOCOP'] == 'true'
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |t|
t.options = `git ls-files | grep -E '\\.rb$'`.split("\n") # limit rubocop to the files in the repo
end
RuboCop::RakeTask.new(:rubocop)
%i[test rubocop]
else
[:test]
Expand Down
12 changes: 7 additions & 5 deletions apps/basic_app.ru
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Basec self-contained rack/sinatra app
# edit or duplicate this app to experiment with the pagy features

Expand All @@ -17,20 +19,20 @@ require 'pagy/extras/trim' if ENV['ENABLE_TRIM']
require 'oj' if ENV['ENABLE_OJ'] == 'true'

# sinatra setup
require "sinatra/base"
require "sinatra/reloader"
require 'sinatra/base'
require 'sinatra/reloader'


# simple array-based collection that acts as standard DB collection
class MockCollection < Array

def initialize(arr=Array(1..1000))
super
@collection = self.clone
@collection = clone
end

def offset(value)
@collection = self[value..-1]
@collection = self[value..]
self
end

Expand Down Expand Up @@ -69,7 +71,7 @@ class PagyApp < Sinatra::Base

get '/helpers' do
collection = MockCollection.new
@pagy, _ = pagy(collection)
@pagy, = pagy(collection)
erb :helpers
end

Expand Down
3 changes: 2 additions & 1 deletion ci-gemfiles/ruby-3.0
Expand Up @@ -8,9 +8,10 @@ gem 'minitest'
gem 'oj', require: false # false is for testing with or without it

gem 'rubocop', '~> 1.11', require: false
gem 'rubocop-minitest', require: false
gem 'rubocop-packaging', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rake', require: false
gem 'rubocop-minitest', require: false

gem 'simplecov', require: false
gem 'codecov', require: false
2 changes: 1 addition & 1 deletion pagy.gemspec
Expand Up @@ -13,6 +13,6 @@ Gem::Specification.new do |s|
s.description = 'Agnostic pagination in plain ruby: it works with any framework, ORM and DB type, with all kinds of collections, even pre-paginated, scopes, Arrays, JSON data... Easy, powerful, fast and light.'
s.homepage = 'https://github.com/ddnexus/pagy'
s.license = 'MIT'
s.files = `git ls-files -z`.split("\x0").select{|f| f.start_with?('lib', 'pagy.gemspec', 'LICENSE') }
s.files = `git ls-files -z`.split("\x0").select{|f| f.start_with?('lib', 'pagy.gemspec', 'LICENSE') } # rubocop:disable Packaging/GemspecGit # TODO (#297)
s.required_ruby_version = '>= 3.0'
end
1 change: 0 additions & 1 deletion test/test_helper.rb
Expand Up @@ -2,7 +2,6 @@

$VERBOSE = {'false' => false, 'true' => true}[ENV['VERBOSE']] if ENV['VERBOSE']

require 'bundler/setup'
require 'simplecov'

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
Expand Down

0 comments on commit 8c4ccfc

Please sign in to comment.