--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.

Assessment

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

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.

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.

Dominant language
Ruby
Stars
2.5k
Forks
649
Avg merge
4m
Merged PRs (30d)
5

Getting set up

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.

More from ruby/rake

All issues in ruby/rake

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.