Skip to content

Commit

Permalink
Introduce RuboCop
Browse files Browse the repository at this point in the history
Also:
- Fix offenses in non-production code
- Add RuboCop GitHub action
  • Loading branch information
tagliala committed Apr 20, 2024
1 parent c58e085 commit cded806
Show file tree
Hide file tree
Showing 9 changed files with 335 additions and 200 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: RuboCop

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
test:
name: RuboCop
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
rubygems: latest
bundler-cache: true
- name: RuboCop
run: bundle exec rubocop
47 changes: 47 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
inherit_from: .rubocop_todo.yml

# inherit_from: .rubocop_todo.yml

require:
- rubocop-packaging
- rubocop-performance
- rubocop-rails
- rubocop-rake
- rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 2.3
Exclude:
- .git/**/*
- .github/**/*
- bin/**/*
- gemfiles/**/*
- node_modules/**/*
- tmp/**/*
- vendor/**/*
- lib/**/*

Layout/LineLength:
Enabled: false

Rails/TimeZone:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

RSpec/MultipleMemoizedHelpers:
Max: 10

RSpec/NestedGroups:
Enabled: false

Style/ArgumentsForwarding:
Enabled: false

Style/OpenStructUse:
Enabled: false
11 changes: 11 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp`
# using RuboCop version 1.63.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.

RSpec/AnyInstance:
Exclude:
- 'spec/lib/sharepoint/client_methods_spec.rb'
19 changes: 19 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

gem 'byebug'
gem 'dotenv'
gem 'rake'
gem 'rspec'
gem 'ruby-filemagic'
gem 'simplecov'
gem 'webmock'

if RUBY_VERSION >= '2.7'
gem 'rubocop', require: false
gem 'rubocop-packaging', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
gem 'rubocop-rake', require: false
gem 'rubocop-rspec', require: false
end
11 changes: 6 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
end
# frozen_string_literal: true

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

task default: :spec
26 changes: 11 additions & 15 deletions sharepoint.gemspec
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# frozen_string_literal: true

Gem::Specification.new do |gem|
gem.name = 'sharepoint'
gem.version = '0.1.0'
gem.authors = [ 'Antonio Delfin' ]
gem.email = [ '[email protected]' ]
gem.description = %q(Ruby client to consume Sharepoint services)
gem.summary = %q(Ruby client to consume Sharepoint services)
gem.homepage = "https://github.com/ifad/sharepoint"
gem.authors = ['Antonio Delfin']
gem.email = ['[email protected]']
gem.description = 'Ruby client to consume Sharepoint services'
gem.summary = 'Ruby client to consume Sharepoint services'
gem.homepage = 'https://github.com/ifad/sharepoint'

gem.files = `git ls-files`.split("\n")
gem.require_paths = ["lib"]
gem.files = Dir.glob('{LICENSE,README.md,lib/**/*.rb}', File::FNM_DOTMATCH)
gem.require_paths = ['lib']

gem.required_ruby_version = '>= 2.3'

gem.add_dependency 'ethon'
gem.add_dependency 'activesupport', '>= 4.0'
gem.add_dependency 'ethon'

gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'dotenv'
gem.add_development_dependency 'webmock'
gem.add_development_dependency 'byebug'
gem.add_development_dependency 'ruby-filemagic'
gem.add_development_dependency 'simplecov'
gem.metadata['rubygems_mfa_required'] = 'true'
end
Loading

0 comments on commit cded806

Please sign in to comment.