Skip to content

Commit

Permalink
Merge pull request #72 from pboling/bug/64-rakefile-bp
Browse files Browse the repository at this point in the history
Rakefile Best Practices (& RuboCop)
  • Loading branch information
pboling authored Dec 15, 2022
2 parents 00a361a + e7f06b7 commit 9fca0ce
Show file tree
Hide file tree
Showing 13 changed files with 479 additions and 388 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
inherit_from: .rubocop_todo.yml

inherit_gem:
rubocop-lts: rubocop-lts1_8.yml
54 changes: 54 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-12-11 23:40:03 +0700 using RuboCop version 0.41.2.
# 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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
Lint/ParenthesesAsGroupedExpression:
Exclude:
- 'spec/os_spec.rb'

# Offense count: 2
Metrics/AbcSize:
Max: 31

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 234

# Offense count: 2
Metrics/CyclomaticComplexity:
Max: 9

# Offense count: 22
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https
Metrics/LineLength:
Max: 144

# Offense count: 6
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 26

# Offense count: 3
Metrics/PerceivedComplexity:
Max: 10

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
Style/HashSyntax:
Exclude:
- 'Rakefile'

# Offense count: 2
Style/IfInsideElse:
Exclude:
- 'lib/os.rb'
- 'spec/os_spec.rb'
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source "http://rubygems.org"
# encoding: utf-8
source 'http://rubygems.org'

gemspec
20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PATH
GEM
remote: http://rubygems.org/
specs:
ast (2.4.2)
coderay (1.1.3)
diff-lcs (1.5.0)
ffi (1.15.5)
Expand Down Expand Up @@ -33,10 +34,15 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parser (2.4.0.2)
ast (~> 2.3)
power_assert (2.0.2)
powerpack (0.1.3)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (2.2.2)
rake
rake (10.5.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
Expand All @@ -54,10 +60,23 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (0.41.2)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-lts (2.0.5)
rubocop-ruby1_9 (~> 1.0.5)
rubocop-ruby1_9 (1.0.5)
parser (= 2.4.0.2)
rubocop (= 0.41.2)
ruby-progressbar (1.11.0)
shellany (0.0.1)
test-unit (3.5.5)
power_assert
thor (1.2.1)
unicode-display_width (1.8.0)

PLATFORMS
x86_64-darwin-19
Expand All @@ -67,6 +86,7 @@ DEPENDENCIES
os!
rake (~> 10.5)
rspec (~> 3.12)
rubocop-lts (~> 2.0)
test-unit (~> 3.5)

BUNDLED WITH
Expand Down
5 changes: 3 additions & 2 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# encoding: utf-8
# More info at https://github.com/guard/guard#readme

guard :rspec, cmd: "bundle exec rspec" do
require "guard/rspec/dsl"
guard :rspec, :cmd => 'bundle exec rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# Feel free to open issues for suggestions and improvements
Expand Down
34 changes: 30 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
require 'rubygems' if RUBY_VERSION < '1.9.0'
# encoding: utf-8
# frozen_string_literal: true

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
# !/usr/bin/env rake

require 'bundler/gem_tasks'

begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
desc 'spec task stub'
task :spec do
warn 'rspec is disabled'
end
end
desc 'alias test task to spec'
task :test => :spec

begin
require 'rubocop/rake_task'
RuboCop::RakeTask.new do |task|
task.options = ['-D'] # Display the name of the failing cops
end
rescue LoadError
desc 'rubocop task stub'
task :rubocop do
warn 'RuboCop is disabled'
end
end

task default: %i[test rubocop]
Loading

0 comments on commit 9fca0ce

Please sign in to comment.