Skip to content

Commit

Permalink
Move from StandardRB to Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
yosiat committed Nov 2, 2024
1 parent 79bc0b3 commit 159b00d
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Lint ruby
run: |
bundle exec rake standard
bundle exec rake rubocop
- name: Lint C
uses: jidicula/[email protected]
Expand Down
50 changes: 29 additions & 21 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
AllCops:
TargetRubyVersion: 2.5
DisplayCopNames: true
StyleGuideCopsOnly: false
# We want Exclude directives from different
# config files to get merged, not overwritten
inherit_mode:
merge:
- Exclude

require:
- standard
- rubocop-performance
- standard-performance
- rubocop-rspec

inherit_gem:
standard: config/base.yml
standard-performance: config/base.yml

Metrics/LineLength:
Max: 120
AllCops:
TargetRubyVersion: 3.1
SuggestExtensions: false
NewCops: disable
Exclude:
- ext/**/*
- gemfiles/**/*

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
SafeAutoCorrect: true

Layout/TrailingBlankLines:
Enabled: true

Layout/TrailingWhitespace:
Enabled: true
# TODO: need to work on specs.
RSpec:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: true

Style/RedundantFreeze:
Enabled: true

Performance/UnfreezeString:
Enabled: true
Lint/ConstantDefinitionInBlock:
Exclude:
- spec/**/*
5 changes: 0 additions & 5 deletions .standard.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

appraise "7.0.0" do
gem "sqlite3", "~> 1.4"
gem "activesupport", "~> 7.0.0"
Expand Down
11 changes: 10 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ source "https://rubygems.org"
gemspec

group :benchmarks do
gem "vernier"
gem "stackprof"
gem "pg"

gem "benchmark-ips"
Expand All @@ -24,4 +26,11 @@ group :development do
gem "rake-compiler"
end

gem "standard", group: [:development, :test]
group :development, :test do
gem "rubocop"

gem "standard"
gem "standard-performance"
gem "rubocop-performance"
gem "rubocop-rspec"
end
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require "json"
require "terminal-table"
require "rake/extensiontask"
require "pty"
require "standard/rake"
require "rubocop/rake_task"

gem = Gem::Specification.load(File.dirname(__FILE__) + "/panko_serializer.gemspec")

Expand All @@ -24,6 +24,8 @@ Rake::Task[:compile].prerequisites << :clean

task default: :spec

RuboCop::RakeTask.new

def print_and_flush(str)
print str
$stdout.flush
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/allocs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class PostFastSerializer < Panko::Serializer
attributes :id, :body, :title, :author_id
end

def count_allocs(&block)
memory_report = MemoryProfiler.report(&block)
def count_allocs(&)
memory_report = MemoryProfiler.report(&)
puts memory_report.pretty_print
end

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/bm_serialization_descriptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require "panko_serializer"

def generate_attributes(count)
(1..count).map { |i| "attr_#{i}".to_sym }
(1..count).map { |i| :"attr_#{i}" }
end

class LeafASerializer < Panko::Serializer
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def request(method, path)
response
end

def memory(&block)
mem = MemoryProfiler.report(&block)
def memory(&)
mem = MemoryProfiler.report(&)
mem.pretty_print
end

Expand Down
11 changes: 10 additions & 1 deletion gemfiles/7.0.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

source "https://rubygems.org"

gem "standard", group: [:development, :test]
gem "sqlite3", "~> 1.4"
gem "activesupport", "~> 7.0.0"
gem "activemodel", "~> 7.0.0"
gem "activerecord", "~> 7.0.0", group: :test

group :benchmarks do
gem "vernier"
gem "stackprof"
gem "pg"
gem "benchmark-ips"
gem "active_model_serializers", "~> 0.10"
Expand All @@ -27,4 +28,12 @@ group :development do
gem "rake-compiler"
end

group :development, :test do
gem "rubocop"
gem "standard"
gem "standard-performance"
gem "rubocop-performance"
gem "rubocop-rspec"
end

gemspec path: "../"
10 changes: 10 additions & 0 deletions gemfiles/7.0.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ GEM
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.1.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
sqlite3 (1.7.3-arm64-darwin)
stackprof (0.2.26)
standard (1.41.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
Expand All @@ -139,6 +142,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
vernier (1.2.1)

PLATFORMS
arm64-darwin-23
Expand All @@ -158,9 +162,15 @@ DEPENDENCIES
rake
rake-compiler
rspec (~> 3.0)
rubocop
rubocop-performance
rubocop-rspec
sqlite3 (~> 1.4)
stackprof
standard
standard-performance
terminal-table
vernier

BUNDLED WITH
2.4.6
11 changes: 10 additions & 1 deletion gemfiles/7.1.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

source "https://rubygems.org"

gem "standard", group: [:development, :test]
gem "sqlite3", "~> 1.4"
gem "activesupport", "~> 7.1.0"
gem "activemodel", "~> 7.1.0"
gem "activerecord", "~> 7.1.0", group: :test

group :benchmarks do
gem "vernier"
gem "stackprof"
gem "pg"
gem "benchmark-ips"
gem "active_model_serializers", "~> 0.10"
Expand All @@ -27,4 +28,12 @@ group :development do
gem "rake-compiler"
end

group :development, :test do
gem "rubocop"
gem "standard"
gem "standard-performance"
gem "rubocop-performance"
gem "rubocop-rspec"
end

gemspec path: "../"
10 changes: 10 additions & 0 deletions gemfiles/7.1.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ GEM
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.1.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
sqlite3 (1.7.3-arm64-darwin)
stackprof (0.2.26)
standard (1.41.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
Expand All @@ -155,6 +158,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
vernier (1.2.1)

PLATFORMS
arm64-darwin-23
Expand All @@ -174,9 +178,15 @@ DEPENDENCIES
rake
rake-compiler
rspec (~> 3.0)
rubocop
rubocop-performance
rubocop-rspec
sqlite3 (~> 1.4)
stackprof
standard
standard-performance
terminal-table
vernier

BUNDLED WITH
2.4.6
11 changes: 10 additions & 1 deletion gemfiles/7.2.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

source "https://rubygems.org"

gem "standard", group: [:development, :test]
gem "sqlite3", "~> 1.4"
gem "activesupport", "~> 7.2.0"
gem "activemodel", "~> 7.2.0"
gem "activerecord", "~> 7.2.0", group: :test

group :benchmarks do
gem "vernier"
gem "stackprof"
gem "pg"
gem "benchmark-ips"
gem "active_model_serializers", "~> 0.10"
Expand All @@ -27,4 +28,12 @@ group :development do
gem "rake-compiler"
end

group :development, :test do
gem "rubocop"
gem "standard"
gem "standard-performance"
gem "rubocop-performance"
gem "rubocop-rspec"
end

gemspec path: "../"
10 changes: 10 additions & 0 deletions gemfiles/7.2.0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ GEM
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.1.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
securerandom (0.3.1)
sqlite3 (1.7.3-arm64-darwin)
stackprof (0.2.26)
standard (1.41.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
Expand All @@ -159,6 +162,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
useragent (0.16.10)
vernier (1.2.1)

PLATFORMS
arm64-darwin
Expand All @@ -178,9 +182,15 @@ DEPENDENCIES
rake
rake-compiler
rspec (~> 3.0)
rubocop
rubocop-performance
rubocop-rspec
sqlite3 (~> 1.4)
stackprof
standard
standard-performance
terminal-table
vernier

BUNDLED WITH
2.5.21
11 changes: 10 additions & 1 deletion gemfiles/8.0.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

source "https://rubygems.org"

gem "standard", group: [:development, :test]
gem "sqlite3", ">= 2.1"
gem "activesupport", "~> 8.0.0.rc1"
gem "activemodel", "~> 8.0.0.rc1"
gem "activerecord", "~> 8.0.0.rc1", group: :test

group :benchmarks do
gem "vernier"
gem "stackprof"
gem "pg"
gem "benchmark-ips"
gem "active_model_serializers", "~> 0.10"
Expand All @@ -27,4 +28,12 @@ group :development do
gem "rake-compiler"
end

group :development, :test do
gem "rubocop"
gem "standard"
gem "standard-performance"
gem "rubocop-performance"
gem "rubocop-rspec"
end

gemspec path: "../"
Loading

0 comments on commit 159b00d

Please sign in to comment.