danger-js icon indicating copy to clipboard operation
danger-js copied to clipboard

Paths are relative to git folder

Open sk- opened this issue 5 years ago • 1 comments

When running danger local the list of modified and created files is relative to the git folder. Which makes it hard to actually read the contents of the files (need to detect what the path of the git repo is) or even execute other commands if you are not executing danger from the top level folder.

Either adding a new field to the git section with the path of the repo, or making the paths relative to the current directory would solve the issue.

For example, in my repo, when running danger local from the foo directory I get the following output:

{
  git: {
    fileMatch: [Function],
    modified_files: [ 'package-lock.json', 'package.json' ],
    created_files: [ 'README', 'dangerfile.local.ts', 'foo/dangerfile.local.ts' ],
    deleted_files: [],
    commits: [ [Object] ],
    diffForFile: [Function: diffForFile],
    structuredDiffForFile: [Function: structuredDiffForFile],
    JSONPatchForFile: [Function: JSONPatchForFile],
    JSONDiffForFile: [Function: JSONDiffForFile],
    linesOfCode: [Function: linesOfCode]
  },
  github: null,
  bitbucket_server: ,
  bitbucket_cloud: ,
  gitlab: undefined,
  utils: { sentence: [Function: sentence], href: [Function: href] }
}

sk- avatar Jan 13 '20 12:01 sk-

This is to match how it works in danger pr - I don't think I want this changing, but adding a root field to the git obj which works with both feels reasonable to me 👍

orta avatar Jan 14 '20 09:01 orta