Danger: Danger v5+ Is there support for pre/post rename files?

Created on 28 Apr 2017  路  4Comments  路  Source: danger/danger

Report

What did you do?

  • Ran danger against a PR

What did you expect to happen?

  • Reports violations back to PR as line comments.

What happened instead?

  • I might be missing something here, but I have a few use cases where we want to check the contents of files.
  • For example: All our images have to be under a certain size.
  • If a PR moves an image but otherwise doesn't touch it, the git.modified_files returns the original filename instead of the renamed file.
  • Now I understand that there are definitely use-cases for returning the original filename for things like making sure a file isn't accidentally moved etc. but is there any way I can get at both pre-moved and post-moved filenames?
  • In the image contents check, that fails because the original filename no longer exists on disk :(

Because the original name no longer exists on disk, it manifests as an issue in GH:

422 - Validation Failed
15:55:22 Error summary:
15:55:22   resource: PullRequestReviewComment
15:55:22   code: invalid
15:55:22   field: position // See: https://developer.github.com/enterprise/2.8/v3/pulls/comments/#create-a-comment

Your Environment

  • Which CI are you running on?
    Jenkins
  • Are you running the latest version of Danger?
    Yes, v5.1.1
DSL improvement Help Wanted You Can Do This

Most helpful comment

I think it makes sense to add a git.renamed_files DSL,something that would look like [{ :before => "/a/b", :after => "/a/c"}]. modified_files cannot really provide enough useful metadata from its current setup.

All 4 comments

I think it makes sense to add a git.renamed_files DSL,something that would look like [{ :before => "/a/b", :after => "/a/c"}]. modified_files cannot really provide enough useful metadata from its current setup.

@orta great idea!

@orta hi! Here PR to solve this.

Thanks! Shipped in 5.2.1

Was this page helpful?
0 / 5 - 0 ratings