Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.

Commit c553070

Browse files
authored
Merge pull request #10 from blocknotes/github_actions_improvements
Add linters workflow
2 parents 4e74d29 + d1b0140 commit c553070

12 files changed

Lines changed: 195 additions & 4 deletions

File tree

.fasterer.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
exclude_paths:
3+
- bin/*
4+
- db/schema.rb
5+
- spec/dummy/**/*
6+
- vendor/**/*

.github/workflows/linters.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Linters
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
reviewdog:
12+
name: reviewdog
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '2.7'
23+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
24+
25+
- uses: reviewdog/action-setup@v1
26+
with:
27+
reviewdog_version: latest
28+
29+
- name: Run reviewdog
30+
env:
31+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
reviewdog -fail-on-error -reporter=github-pr-review -runners=brakeman,fasterer,reek,rubocop
34+
35+
# NOTE: check with: reviewdog -fail-on-error -reporter=github-pr-review -runners=fasterer -diff="git diff" -tee

.github/workflows/specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Specs
23

34
on:

.reek.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
exclude_paths:
3+
- bin/*
4+
- db/schema.rb
5+
- spec/dummy/**/*
6+
- vendor/**/*

.reviewdog.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
runner:
3+
brakeman:
4+
cmd: bin/brakeman
5+
level: info
6+
fasterer:
7+
cmd: bin/fasterer
8+
level: info
9+
reek:
10+
cmd: bin/reek
11+
level: info
12+
rubocop:
13+
cmd: bin/rubocop
14+
level: info

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
---
12
inherit_from:
23
- https://relaxed.ruby.style/rubocop.yml
34

45
AllCops:
56
Exclude:
67
- bin/*
8+
- db/schema.rb
79
- spec/dummy/**/*
10+
- vendor/**/*
811
NewCops: enable
912

1013
Gemspec/RequiredRubyVersion:

Gemfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,22 @@ group :development, :test do
88
gem 'activestorage', '~> 6.0'
99
gem 'capybara', '~> 3.33'
1010
gem 'puma', '~> 4.3'
11-
gem 'rspec-rails', '~> 4.0'
1211
gem 'rspec_junit_formatter', '~> 0.4'
13-
gem 'rubocop', '~> 1.0'
12+
gem 'rspec-rails', '~> 4.0'
1413
gem 'selenium-webdriver', '~> 3.142'
1514
gem 'sprockets-rails', '~> 3.2'
1615
gem 'sqlite3', '~> 1.4'
1716

17+
# Linters
18+
gem 'brakeman'
19+
gem 'fasterer'
20+
gem 'reek'
21+
gem 'rubocop'
22+
gem 'rubocop-packaging'
23+
gem 'rubocop-performance'
24+
gem 'rubocop-rails'
25+
gem 'rubocop-rspec'
26+
27+
# Tools
1828
gem 'pry-rails'
1929
end

bin/brakeman

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'brakeman' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("brakeman", "brakeman")

bin/code_climate_reek

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'code_climate_reek' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("reek", "code_climate_reek")

bin/fasterer

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'fasterer' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("fasterer", "fasterer")

0 commit comments

Comments
 (0)