Skip to content

Commit

Permalink
Merge pull request #65 from nevinera/calculate-changed-files-for-exec…
Browse files Browse the repository at this point in the history
…utor

Calculate changed files for executor
  • Loading branch information
nevinera authored May 23, 2023
2 parents bcfc253 + a86de5f commit bb4038d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/dogfood.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up ruby
uses: ruby/setup-ruby@v1
Expand All @@ -25,4 +27,4 @@ jobs:
run: bundle install --jobs 4 --retry 3

- name: Run QuietQuality
run: bundle exec bin/qq standardrb rubocop rspec --all-files --unfiltered --annotate github_stdout
run: bundle exec bin/qq standardrb rubocop rspec --all-files --unfiltered --annotate github_stdout --comparison-branch origin/main
12 changes: 11 additions & 1 deletion lib/quiet_quality/cli/entrypoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,18 @@ def options
@_options = builder.options
end

def changed_files
return @_changed_files if defined?(@_changed_files)
@_changed_files = VersionControlSystems::Git.new.changed_files(
base: options.comparison_branch,
sha: "HEAD",
include_uncommitted: true,
include_untracked: true
)
end

def executor
@_executor ||= options.executor.new(tools: options.tools)
@_executor ||= options.executor.new(tools: options.tools, changed_files: changed_files)
end

def executed
Expand Down
2 changes: 1 addition & 1 deletion lib/quiet_quality/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module QuietQuality
VERSION = "1.0.0"
VERSION = "1.0.1"
end
4 changes: 4 additions & 0 deletions spec/quiet_quality/cli/entrypoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
let!(:executor) { instance_double(QuietQuality::Executors::ConcurrentExecutor, execute!: nil, messages: messages, outcomes: outcomes, any_failure?: any_failure?) }
before { allow(QuietQuality::Executors::ConcurrentExecutor).to receive(:new).and_return(executor) }

let(:changed_files) { instance_double(QuietQuality::ChangedFiles) }
let(:git) { instance_double(QuietQuality::VersionControlSystems::Git, changed_files: changed_files) }
before { allow(QuietQuality::VersionControlSystems::Git).to receive(:new).and_return(git) }

describe "#execute" do
subject(:execute) { entrypoint.execute }

Expand Down

0 comments on commit bb4038d

Please sign in to comment.