Skip to content

Commit

Permalink
Add rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermef committed Jan 28, 2022
1 parent 5469415 commit cde949f
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ jobs:
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
reporter: github-pr-check
15 changes: 15 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Naming/FileName:
Style/Documentation:
Enabled: false

Gemspec/RequiredRubyVersion:
Enabled: false

Metrics/ClassLength:
Max: 130

Expand All @@ -12,3 +15,15 @@ Layout/LineLength:

Metrics/BlockLength:
Max: 255

Metrics/AbcSize:
Max: 74

Metrics/CyclomaticComplexity:
Max: 26

Metrics/MethodLength:
Max: 44

Metrics/PerceivedComplexity:
Max: 26
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@
source 'https://rubygems.org'

gemspec

gem 'simplecov', require: false
gem 'simplecov-lcov', require: false
6 changes: 0 additions & 6 deletions lib/thumbor/crypto_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@

module Thumbor
class CryptoURL
attr_writer :computed_key

def initialize(key = nil)
@key = key
end

def computed_key
(@key * 16)[0..15]
end

def calculate_width_and_height(url_parts, options)
width = options[:width]
height = options[:height]
Expand Down
3 changes: 3 additions & 0 deletions ruby-thumbor.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ Gem::Specification.new do |s|

s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'rspec', '~> 3.10'
s.add_development_dependency 'rubocop-rspec', '~> 2.8.0'
s.add_development_dependency 'simplecov', '~> 0.21.2'
s.add_development_dependency 'simplecov-lcov', '~> 0.8.0'
end
6 changes: 0 additions & 6 deletions spec/thumbor/cascade_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@

subject { Thumbor::Cascade.new key, image_url }

describe '#new' do
it 'should create a new instance passing key and keep it' do
expect(subject.computed_key).to eq 'my-security-keym'
end
end

it 'should raise an error' do
expect { subject.god_of_war_crop }.to raise_error(NoMethodError)
end
Expand Down
7 changes: 2 additions & 5 deletions tasks/rspec.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# frozen_string_literal: true

begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

0 comments on commit cde949f

Please sign in to comment.