Allow Danger::OutdatedTodo to fail in Lefthook
What does this MR do and why?
This MR enables Danger::OutdatedTodo
to fail when executed from lefthook. It also makes danger
command more reliable in lefthook. During testing I noticed that it doesn't run the command when it should without files
set in lefthook.yml
.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Click to expand
❯ rm app/workers/redis_migration_worker.rb
❯ git commit -a -m "Remove a file"
Alias tip: git cm -a -m "Remove a file"
╭──────────────────────────────────────╮
│ 🥊 lefthook v1.5.2 hook: pre-commit │
╰──────────────────────────────────────╯
│ fastener (skip) settings
│ secrets-detection (skip) no files for inspection
│ eslint (skip) no files for inspection
│ rubocop (skip) no files for inspection
│ docs_non_standard_spaces (skip) no files for inspection
────────────────────────────────────
summary: (skip) empty
[lefthook-outdated-todos a28db3342d76] Remove a file
1 file changed, 40 deletions(-)
delete mode 100644 app/workers/redis_migration_worker.rb
❯ lefthook run pre-push --commands danger
╭────────────────────────────────────╮
│ 🥊 lefthook v1.5.2 hook: pre-push │
╰────────────────────────────────────╯
│ merge_conflicts (skip) settings
┃ security_harness ❯
┃ danger ❯
Results:
Errors:
- [ ] `app/workers/redis_migration_worker.rb` was removed but is mentioned in:
- `.rubocop_todo/gitlab/namespaced_class.yml:800`
Warnings:
- [ ] e1d3561047561918ba938b310a761346646bcdba: Commits that change 30 or more lines across at least 3 files should describe these changes in the commit body. For more information, take a look at our [Commit message guidelines](https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#commit-messages-guidelines).
Messages:
- [ ] **[CHANGELOG missing](https://docs.gitlab.com/ee/development/changelog.html)**:
If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.
Markdown:
────────────────────────────────────
summary: (done in 8.89 seconds)
✔️ security_harness
🥊 danger
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Checkout this branch
- Remove a file that's listed in one of the rubocop todos (for example,
.rubocop_todo/gitlab/namespaced_class.yml
)rm app/workers/redis_migration_worker.rb git commit -a -m "Remove a file" lefthook run pre-push --commands danger
- Ensure that it fails
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Dmitry Gruzd