Skip to content

Commit

Permalink
Merge pull request #2 from prysmex/v0.4.1
Browse files Browse the repository at this point in the history
add rubocop, github actions
  • Loading branch information
patodevilla authored Mar 20, 2024
2 parents 7ea1c0d + cbf50c1 commit 6772674
Show file tree
Hide file tree
Showing 15 changed files with 393 additions and 230 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test

on: [pull_request]

# permissions:
# contents: read

jobs:
lint:
runs-on: ubuntu-latest
# env:
# BUNDLE_ONLY: rubocop

steps:
- uses: actions/checkout@v4

- name: Set up Ruby 3.2.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true

- name: Run Tests
run: bundle exec rake
# run: bundle exec rubocop --parallel
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
/spec/reports/
/tmp/
Gemfile.lock
.byebug_history
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
11 changes: 11 additions & 0 deletions .rubocop-rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
###########################################################
#################### Rubocop Rspec ########################
###########################################################

# You can find all configuration options for rubocop-rspec here: https://docs.rubocop.org/rubocop-rspec/cops.html

# RSpec/PendingWithoutReason:
# Enabled: false

# RSpec/FilePath:
# Enabled: false
77 changes: 77 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# see example at https://gist.github.com/jhass/a5ae80d87f18e53e7b56

# <% unless ENV['BYPASS_RUBOCOP_TODO'] %>
# inherit_from:
# <% else %>
# inherit_from:
# - '.rubocop-todo.yml'
# <% end %>

inherit_from:
- .rubocop_todo.yml
- .rubocop-rspec.yml

require:
- rubocop-rspec
- rubocop-rake
- rubocop-performance

AllCops:
NewCops: enable
# TargetRubyVersion: 2.7.8
# TargetRailsVersion: 6.1.4
# Exclude:
# - 'Gemfile.lock'

Naming/VariableNumber:
Enabled: false

Layout/SpaceInsideHashLiteralBraces:
Enabled: false

Layout/EmptyLinesAroundModuleBody:
EnforcedStyle: empty_lines_special
Enabled: false

Layout/TrailingEmptyLines:
Enabled: false
EnforcedStyle: final_blank_line

Layout/EmptyLinesAroundClassBody:
Enabled: false

Style/RaiseArgs:
EnforcedStyle: compact

Naming/MethodParameterName:
Enabled: false

Naming/VariableName:
Enabled: false

Layout/FirstHashElementIndentation:
Enabled: false

Layout/CaseIndentation:
EnforcedStyle: end

Metrics/ParameterLists:
Enabled: false

Style/Lambda:
EnforcedStyle: literal

Layout/IndentationWidth:
Enabled: false

Layout/EndAlignment:
Enabled: false

Layout/ElseAlignment:
Enabled: false

Style/TrivialAccessors:
Enabled: false

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
42 changes: 42 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-03-20 19:14:10 UTC using RuboCop version 1.62.1.
# 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
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 19

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 115

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 15

# Offense count: 1
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 7

# Offense count: 3
RSpec/MultipleExpectations:
Max: 2

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# AllowedMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'spec/string_replacer/replacer_spec.rb'
17 changes: 15 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
source "https://rubygems.org"
# frozen_string_literal: true

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
source 'https://rubygems.org'

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in string_replacer.gemspec
gemspec

# gem 'bundler', '2.4.22'
gem 'debug', '>= 1.0.0'
gem 'rake', '~> 13.1'
gem 'rspec', '~> 3.9'

# rubocop
gem 'rubocop', '~> 1.62'
gem 'rubocop-performance', '~> 1.20'
gem 'rubocop-rake', '~> 0.6'
gem 'rubocop-rspec', '~> 2.27.1'
13 changes: 11 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
require "bundler/gem_tasks"
task :default => :spec
# frozen_string_literal: true

require 'bundler/gem_tasks'

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

require 'rubocop/rake_task'
RuboCop::RakeTask.new

task default: %i[spec rubocop]
7 changes: 4 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "string_replacer"
require 'bundler/setup'
require 'string_replacer'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -10,5 +11,5 @@ require "string_replacer"
# require "pry"
# Pry.start

require "irb"
require 'irb'
IRB.start(__FILE__)
Loading

0 comments on commit 6772674

Please sign in to comment.