ruby / ruby/rake

--dry-run (or -n) doesn't seem to trigger `when_writing`

Open
#691 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.5k
Forks
650
Avg merge
6m
Merged PRs (30d)
3

Description

Given the following rakefile

  task "git_diff_rails_credentials:fix" do
    when_writing "set local git-config diff.rails_credentials" do
      sh "git config diff.rails_credentials.textconv 'bin/rails credentials:diff'"
    end
  end

When I run rake -n git_diff_rails_credentials:fix

I expect to see DRYRUN: set local git-config diff.rails_credentials in the output. But instead I see:

$ rake -n doctor:git_diff_rails_credentials:fix
** Invoke doctor:git_diff_rails_credentials:fix (first_time)
** Execute (dry run) doctor:git_diff_rails_credentials:fix

I assume this is related to #361 but there isn't any resolution there to indicate what the expectations are.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the when_writing entry point and the --dry-run execution path described in the issue. Reproduce the rake command and compare its output with the expected DRYRUN: set local git-config diff.rails_credentials line; done means the dry run reports the when_writing action without applying it.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.