Skip to content

Commit

Permalink
Add linter workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorntonMatthew committed Jan 11, 2024
1 parent 42df79f commit 1b9e93a
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 10 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ruby-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Ruby Linter

on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: ${{ github.ref }}-lint
cancel-in-progress: true

jobs:
ruby-linter:
env:
TZ: "US/Eastern"
FORCE_COLOR: "1"
# Tells bundler to not worry about any group except for our 'lint' group.
# This was used since BUNLDE_ONLY did not work.
BUNDLE_WITHOUT: "default:test:staging:ssh_forwarding:development:demo:production"

runs-on: ubuntu-latest
steps:
- name: Checkout Caseflow
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ruby/setup-ruby@v1
with:
# Ruby version is determined by the .ruby-version file
bundler-cache: true

- name: Get Changed Ruby Files
id: changed-ruby-files
uses: tj-actions/changed-files@v41
with:
files: |
**.rb
**.erb
- name: Rubocop
if: steps.changed-ruby-files.outputs.any_changed == 'true' && (success() || failure())
run: bundle exec rubocop ${{ steps.changed-ruby-files.outputs.all_changed_files }}

- name: Reek
if: steps.changed-ruby-files.outputs.any_changed == 'true' && (success() || failure())
run: bundle exec reek ${{ steps.changed-ruby-files.outputs.all_changed_files }}

- name: Fasterer
if: success() || failure()
run: bundle exec fasterer

# This gem is no longer maintained
- name: scss-lint
if: success() || failure()
run: bundle exec scss-lint --color
24 changes: 14 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,14 @@ end

group :test, :development, :demo do
# Security scanners
gem "brakeman"
gem "bullet"
gem "bundler-audit"
# Testing tools
gem "capybara"
gem "capybara-screenshot"
gem "danger", "~> 6.2.2"
gem "database_cleaner"
gem "factory_bot_rails", "~> 5.2"
gem "faker"
gem "guard-rspec"
gem "immigrant"
# Linters
gem "jshint", platforms: :ruby
gem "pluck_to_hash"
Expand All @@ -116,10 +112,6 @@ group :test, :development, :demo do
gem "rspec-rails"
# For CircleCI test metadata analysis
gem "rspec_junit_formatter"
gem "rubocop", "= 0.79", require: false
gem "rubocop-performance"
gem "rubocop-rails"
gem "scss_lint", require: false
gem "simplecov", git: "https://github.com/colszowka/simplecov.git", require: false
gem "single_cov"
gem "sniffybara", git: "https://github.com/department-of-veterans-affairs/sniffybara.git"
Expand All @@ -135,20 +127,32 @@ group :development do
gem "debase"
gem "derailed_benchmarks"
gem "dotenv-rails"
gem "fasterer", require: false
gem "foreman"
gem "meta_request"
gem "ruby-debug-ide"
gem "ruby-prof", "~> 1.4"
gem "solargraph"
end

group :lint do
gem "brakeman"
gem "bundler-audit"
gem "danger", "~> 6.2.2"
gem "fasterer", require: false
gem "immigrant"
gem "reek"
gem "rubocop", "= 0.79", require: false
gem "rubocop-performance"
gem "rubocop-rails"
gem "scss_lint", require: false
end

group :test do
gem "knapsack_pro", "~> 3.8"
# For retrying failed feature tests. Read more: https://github.com/NoRedInk/rspec-retry
gem "rspec-github", require: false
gem "rspec-retry"
gem "webmock"
gem "rspec-github", require: false
end
# rubocop:enable Metrics/LineLength

Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ GEM
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
kwalify (0.7.2)
launchy (2.4.3)
addressable (~> 2.3)
libv8 (3.16.14.19)
Expand Down Expand Up @@ -471,6 +472,7 @@ GEM
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
psych (3.3.4)
public_suffix (4.0.6)
puma (5.6.4)
nio4r (~> 2.0)
Expand Down Expand Up @@ -547,6 +549,11 @@ GEM
redis-store (>= 1.2, < 2)
redis-store (1.4.1)
redis (>= 2.2, < 5)
reek (6.0.2)
kwalify (~> 0.7.0)
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
psych (~> 3.1)
rainbow (>= 2.0, < 4.0)
ref (2.0.0)
regexp_parser (1.6.0)
request_store (1.4.1)
Expand Down Expand Up @@ -802,6 +809,7 @@ DEPENDENCIES
redis-mutex
redis-namespace
redis-rails (~> 5.0.2)
reek
request_store
roo (~> 2.7)
rspec
Expand Down
2 changes: 2 additions & 0 deletions app/models/hearing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class HearingDayFull < StandardError; end

attr_accessor :override_full_hearing_day_validation

this_is_a_really_long_line = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

scope :with_no_disposition, -> { where(disposition: nil) }
scope :not_scheduled_in_error,
lambda {
Expand Down

0 comments on commit 1b9e93a

Please sign in to comment.