Skip to content

Commit

Permalink
Add binstubs for rubocop and brakeman
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Jun 12, 2024
1 parent 19f1c08 commit 29e2bd0
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
uses: r7kamura/rubocop-problem-matchers-action@v1

- name: Run rubocop
run: bundle exec rubocop
run: bin/rubocop

- name: Run brakeman
if: always() # Run both checks, even if the first failed
run: bundle exec brakeman
run: bin/brakeman
27 changes: 27 additions & 0 deletions bin/brakeman
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'brakeman' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("brakeman", "brakeman")
27 changes: 27 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rubocop' is installed as part of a gem, and
# this file is here to facilitate running it.
#

ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rubocop", "rubocop")
3 changes: 1 addition & 2 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const config = {
'*': 'prettier --ignore-unknown --write',
'Capfile|Gemfile|*.{rb,ruby,ru,rake}':
'bundle exec rubocop --force-exclusion -a',
'Capfile|Gemfile|*.{rb,ruby,ru,rake}': 'bin/rubocop --force-exclusion -a',
'*.{js,jsx,ts,tsx}': 'eslint --fix',
'*.{css,scss}': 'stylelint --fix',
'*.haml': 'bundle exec haml-lint -a',
Expand Down

0 comments on commit 29e2bd0

Please sign in to comment.