danger / danger/swift

Documentation not updated on danger-swift commands

Open
#612 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
1.1k
Forks
152
Avg merge
9h 54m
Merged PRs (30d)
2

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the documented Current working directory section and the command-line handling referenced by Runner/main.swift:51. Verify how --cwd is parsed and compare that behavior with the shown swift run danger-swift command. Done means the documentation no longer presents an invocation that produces the reported unsupported-argument error and explains the supported workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.