danger / swift

⚠️ Stop saying "you forgot to …" in code review
https://danger.systems/swift/
MIT License
1.04k stars 135 forks source link

Documentation not updated on danger-swift commands #612

Open DntPullALockett opened 2 weeks ago

DntPullALockett commented 2 weeks ago

Danger Swift Version: 3.18.1

I am trying to run danger-swift in a normal Xcode project that does not rely on a Swift Package. I added the Swift Package in another folder called "DangerPackage"

I have to run danger-swift from this folder but all of my source is not inside this folder or added to the package.

The docs of danger-swift state the following:

Current working directory

Many people prefer using Danger within a Swift Package via SPM, because is more performant.

When doing so, however, having a Package.swift in the root folder can be annoying, especially now that Xcode (since Xcode 11) doesn't show a xcproj (or xcworkspace) on the Open Recents menu when there is a Package.swift in the same folder.

With the --cwd parameter you can specify a working directory. This allows you to have your Package.swift in another directory and still run danger-swift as it was executed from your project root directory.

swift run danger-swift command --cwd path/to/working-directory Note that to do this, you must run danger-swift from the directory where the Package.swift is located, and pass the top-level directory relative to this directory to the --cwd command-line switch. For example, if you create a folder named Danger in the top level of your repo for these files, you would need to cd Danger and then run the command [swift run] danger-swift cmd --cwd .. to tell Danger that it should look at the directory above where the command was executed to correctly invoke the tool.

This does not work as it outputs the error

Runner/main.swift:51: Fatal error: Danger Swift does not support this argument, it only handles ci, local, pr & edit'

Ultimately I am getting it to run, but it thinks my source files are inside the package Sources folder when they are not.