Skip to content

Commit

Permalink
Enable rubocop on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Apr 7, 2022
1 parent 5e4deea commit c84f647
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,18 @@ jobs:
uses: ludeeus/action-shellcheck@1.1.0
with:
scandir: './bin'
jobs:
rubocop:
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
bundler-cache: true
- name: Run tests
run: bundle exec rake rubocop
11 changes: 11 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
require: rubocop-rails

AllCops:
TargetRubyVersion: 2.5
NewCops: enable
Include:
- '**/*.rb'
Exclude:
- vendor/**/*
- .vendor/**/*
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ group :test do
gem 'webdrivers'
end

group :linter do
gem 'rubocop'
gem 'rubocop-rails'
gem 'rubocop-rake'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Expand Down
42 changes: 42 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ GEM
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
bcrypt (3.1.17)
bindex (0.8.1)
breadcrumbs_on_rails (4.1.0)
Expand Down Expand Up @@ -136,10 +137,26 @@ GEM
nio4r (2.5.8)
nokogiri (1.12.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.12.5-x86_64-linux)
racc (~> 1.4)
optimist (3.0.1)
parallel (1.22.1)
parser (3.1.1.0)
ast (~> 2.4.1)
public_suffix (4.0.6)
puma (5.6.4)
nio4r (~> 2.0)
puppet (7.15.0)
concurrent-ruby (~> 1.0)
deep_merge (~> 1.0)
facter (> 2.0.1, < 5)
fast_gettext (>= 1.1, < 3)
hiera (>= 3.2.1, < 4)
locale (~> 2.1)
multi_json (~> 1.10)
puppet-resource_api (~> 1.5)
scanf (~> 1.0)
semantic_puppet (~> 1.0)
puppet (7.15.0-universal-darwin)
CFPropertyList (~> 2.2)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -188,12 +205,32 @@ GEM
method_source
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
rchardet (1.8.0)
regexp_parser (2.2.1)
rexml (3.2.5)
rubocop (1.26.1)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.16.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.16.0)
parser (>= 3.1.1.0)
rubocop-rails (2.13.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
rubyzip (2.3.2)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
Expand Down Expand Up @@ -232,6 +269,7 @@ GEM
turbolinks-source (5.2.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
web-console (4.2.0)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand All @@ -255,6 +293,7 @@ GEM

PLATFORMS
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
bcrypt (~> 3.1.7)
Expand All @@ -273,6 +312,9 @@ DEPENDENCIES
puppet
puppetdb-ruby
rails (~> 6.1.5, >= 6.1.0.0)
rubocop
rubocop-rails
rubocop-rake
sass-rails (>= 6)
selenium-webdriver
simplecov
Expand Down
16 changes: 14 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative 'config/application'
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |task|
# These make the rubocop experience maybe slightly less terrible
task.options = ['-D', '-S', '-E']

Rails.application.load_tasks
# Use Rubocop's Github Actions formatter if possible
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
end
# check if the rails configuration exists and load the tasks
if File.file?('config/hdm.yml')
require_relative 'config/application'
Rails.application.load_tasks
else
puts "Not loading Rails specific tasks because config/hdm.yml is missing!"
end

0 comments on commit c84f647

Please sign in to comment.