Skip to content

Commit

Permalink
Fixes #37096 - Add rubocop to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dosas committed Jan 25, 2024
1 parent fa2e3cb commit c66d782
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ruby_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Ruby Tests
on: pull_request

jobs:
rubocop:
uses: theforeman/actions/.github/workflows/rubocop.yml@v0
with:
command: bundle exec rubocop --parallel --format github
Test_ruby:
runs-on: ubuntu-latest
strategy:
Expand Down
10 changes: 8 additions & 2 deletions lib/foreman_maintain/utils/command_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ class CommandRunner
attr_reader :logger, :command

def initialize(logger, command, options)
options.validate_options!(:stdin, :hidden_patterns, :interactive, :valid_exit_statuses)
options.validate_options!(:stdin, :hidden_patterns, :interactive, :valid_exit_statuses,
:discard_stderr)
options[:valid_exit_statuses] ||= [0]
@logger = logger
@command = command
@stdin = options[:stdin]
@hidden_patterns = Array(options[:hidden_patterns]).compact
@interactive = options[:interactive]
@discard_stderr = options[:discard_stderr] || false
@options = options
@valid_exit_statuses = options[:valid_exit_statuses]
raise ArgumentError, 'Can not pass stdin for interactive command' if @interactive && @stdin
Expand Down Expand Up @@ -92,7 +94,11 @@ def run_non_interactively
end

def full_command
"#{@command} 2>&1"
if @discard_stderr
@command.to_s
else
"#{@command} 2>&1"
end
end

def hide_strings(string)
Expand Down

0 comments on commit c66d782

Please sign in to comment.