### Local Development Setup Source: https://github.com/danger/swift/blob/master/README.md Clone the repository, build the project, install komondor, generate Xcode project, and open it for development. ```sh git clone https://github.com/danger/danger-swift.git cd danger-swift swift build swift run komondor install swift package generate-xcodeproj open danger-swift.xcodeproj ``` -------------------------------- ### Install and Run danger-js Source: https://github.com/danger/swift/blob/master/README.md Install danger-js globally using npm and run it with the `danger-swift ci` command. ```bash npm install -g danger danger-swift ci ``` -------------------------------- ### Swift Danger Setup and Conditional File Generation Source: https://github.com/danger/swift/blob/master/Tests/RunnerLibTests/__Snapshots__/DangerFileGeneratorTests/testItGeneratesTheCorrectFileWhenThereIsAreImportsWithIndent.1.txt Demonstrates the basic setup of the Danger Swift library and conditional logic for generating different file contents based on a flag. ```swift import Danger import Foundation let danger = Danger() if flag { file2Content ⚠️ } else { file3Content 👩‍👩‍👦‍👦 secondLine really really really really really really really really really really really really really really really really really really really really really really long text } ``` -------------------------------- ### Install Danger Swift from Source (Linux) Source: https://github.com/danger/swift/blob/master/README.md Instructions for installing danger-swift on Linux by cloning the repository and using make. This method is suitable when pre-compiled binaries are not available or preferred. ```bash # Install danger-swift git clone https://github.com/danger/danger-swift.git cd danger-swift make install ``` -------------------------------- ### Basic Danger Swift Setup Source: https://github.com/danger/swift/blob/master/Tests/RunnerLibTests/__Snapshots__/DangerFileGeneratorTests/testItGeneratesTheCorrectFileWhenThereIsASingleImport.1.txt This snippet demonstrates the basic structure of a Danger Swift file, including the import statement and initialization of the Danger object. ```swift import Danger let danger = Danger() ``` -------------------------------- ### Configure Swift Package Manager for Danger and Plugins Source: https://github.com/danger/swift/blob/master/README.md Example of how to add `danger-swift` and custom plugins as development dependencies in your Swift Package Manager's Package.swift file. This setup is recommended for better performance and dependency management. ```swift let package = Package( ... products: [ ... .library(name: "DangerDeps[Product name (optional)]", type: .dynamic, targets: ["DangerDependencies"]), // dev ... ], dependencies: [ ... .package(url: "https://github.com/danger/swift.git", from: "3.0.0"), // dev // Danger Plugins .package(url: "https://github.com/username/DangerPlugin.git", from: "0.1.0") // dev ... ], targets: [ .target(name: "DangerDependencies", dependencies: ["Danger", "DangerPlugin"]), // dev ... ] ) ``` -------------------------------- ### Configure Package.swift for Plugin Usage Source: https://github.com/danger/swift/blob/master/Documentation/usage/extending_danger.html.md When writing your plugin, import Danger directly in `Package.swift` and define library products. This setup facilitates testing and ensures proper dependency management. ```swift let package = Package( ... products: [ ... .library(name: "DangerPlugin", targets: ["DangerPlugin"]), .library(name: "DangerDeps", type: .dynamic, targets: ["DangerPlugin"]), // dev ... ], dependencies: [ ... .package(url: "https://github.com/danger/swift.git", from: "1.0.0"), ], targets: [ .target(name: "DangerPlugin", dependencies: ["Danger"]), ... ] ) ``` -------------------------------- ### Install Danger Swift using Homebrew (macOS) Source: https://github.com/danger/swift/blob/master/README.md Command to install danger-swift and a bundled danger-js locally on macOS using Homebrew. After installation, you can run danger-swift commands. ```bash # Install danger-swift, and a bundled danger-js locally brew install danger/tap/danger-swift # Run danger danger-swift ci ``` -------------------------------- ### DiffRefs Start SHA Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitLab_MergeRequest_DiffRefs.md Represents the start SHA of the merge request diff. This is a required string property. ```swift let startSha:​ String ``` -------------------------------- ### Initialize Danger DSL Source: https://context7.com/danger/swift/llms.txt Call the `Danger()` function at the top of your `Dangerfile.swift` to get the `DangerDSL` instance. This instance provides access to all PR metadata, file change information, and utility functions. ```swift import Danger let danger = Danger() // Access basic PR info on GitHub print(danger.github.pullRequest.title) print(danger.github.pullRequest.additions ?? 0) print(danger.github.pullRequest.changedFiles ?? 0) ``` -------------------------------- ### Create Dangerfile.swift Source: https://github.com/danger/swift/blob/master/Documentation/tutorials/migrating_from_ruby_danger.html.md Translate Ruby Danger rules to Swift for your `Dangerfile.swift`. This example shows common translations for checking PR titles, bodies, file changes, and running SwiftLint. ```diff - has_changelog_entry = !git.modified_files.include?("CHANGELOG.md") + let hasChangelogEntry = danger.git.modifiedFiles.contains("CHANGELOG.md") - warn "PR is classed as Work in Progress" if bitbucket_server.pr_title.include? "[WIP]" + if danger.bitbucketServer.pullRequest.title.contains("WIP") { + warn("PR is classed as Work in Progress") + } # Mainly to encourage writing up some reasoning about the PR, rather than - if github.pr_body.length < 5 - fail "Please provide a summary in the Pull Request description" - end + if danger.github.pullRequest.body.count < 5 { + fail("Please provide a summary in the Pull Request description") + } # If these are all empty something has gone wrong, better to raise it in a comment - if git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty? - fail "This PR has no changes at all, this is likely an issue during development." - end + if danger.git.modifiedFiles.isEmpty && danger.git.createdFiles.isEmpty && danger.git.deletedFiles.isEmpty { - # Leave a warning if Podfile changes - podfile_updated = !git.modified_files.grep(/Podfile/).empty? - warn "The `Podfile` was updated" if podfile_updated + if danger.git.modifiedFiles.contains("Podfile") { + warn("The `Podfile` was updated") + } # This lints all Swift files and leave comments in PR if # there is any issue with linting - swiftlint.lint_files inline_mode: true + SwiftLint.lint(inline: true) - has_app_changes = !git.modified_files.grep(/ProjectName/).empty? + let hasAppChanges = !danger.git.modifiedFiles.filter({ $0.contains("ProjectName") }).isEmpty - has_test_changes = !git.modified_files.grep(/ProjectNameTests/).empty? + let hasTestChanges = !danger.git.modifiedFiles.filter({ $0.contains("ProjectNameTests") }).isEmpty # If changes are more than 10 lines of code, tests need to be updated too - if has_app_changes && !has_test_changes && git.lines_of_code > 10 - fail "Tests were not updated" - end + if hasAppChanges && !hasTestChanges { + fail("Tests were not updated") + } ``` -------------------------------- ### Install Danger JS globally Source: https://github.com/danger/swift/blob/master/README.md Command to install the Danger JavaScript tool globally using npm. This is a prerequisite for certain Danger workflows, especially when integrating with CI systems that might expect Danger JS. ```bash $npm install -g danger ``` -------------------------------- ### Write Unit Tests for Danger Rule Source: https://github.com/danger/swift/blob/master/Documentation/usage/extending_danger_two.html.md Write unit tests for your Danger Swift rule using DangerFixtures to create a mock Danger DSL. This example demonstrates testing for warnings when copyright headers are present and ensuring no warnings are issued otherwise. ```swift import XCTest @testable import DangerNoCopyrights @testable import Danger @testable import DangerFixtures final class DangerNoCopyrightsTests: XCTestCase { func testWarnsWhenThereAreCreatedAtPrefixes() { // Arrange a custom Danger DSL to run against let danger = githubWithFilesDSL(created: ["file.swift"], fileMap: ["file.swift": "// Created by Orta"]) // Act against running our check checkForCopyrightHeaders(danger: danger) // Assert the number of warnings has increased XCTAssertEqual(danger.warnings.count, 1) } func testDoesNotWarnWhenNoCreatedAt() { let danger = githubWithFilesDSL(created: ["file.swift"], fileMap: ["file.swift": "{}"]) checkForCopyrightHeaders(danger: danger) XCTAssertEqual(danger.warnings.count, 0) } static var allTests = [ ("testWarnsWhenThereAreCreatedAtPrefixes", testWarnsWhenThereAreCreatedAtPrefixes), ("testDoesNotWarnWhenNoCreatedAt", testDoesNotWarnWhenNoCreatedAt) ] } ``` -------------------------------- ### Write a Dangerfile in Swift Source: https://github.com/danger/swift/blob/master/README.md Example of a Dangerfile that checks for CHANGELOG.md updates and warns if no changes are detected for modified source files. It also demonstrates how to use message, warn, fail, and markdown functions for feedback. ```swift import Danger let danger = Danger() let allSourceFiles = danger.git.modifiedFiles + danger.git.createdFiles let changelogChanged = allSourceFiles.contains("CHANGELOG.md") let sourceChanges = allSourceFiles.first(where: { $0.hasPrefix("Sources") }) if !changelogChanged && sourceChanges != nil { warn("No CHANGELOG entry added.") } // You can use these functions to send feedback: message("Highlight something in the table") warn("Something pretty bad, but not important enough to fail the build") fail("Something that must be changed") markdown("Free-form markdown that goes under the table, so you can do whatever.") ``` -------------------------------- ### Milestone startDate Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitLab_MergeRequest_Milestone.md The optional start date for the milestone. ```swift let startDate:​ Date? ``` -------------------------------- ### Get File Diff Source: https://github.com/danger/swift/blob/master/Documentation/reference/DangerUtils.md Retrieves the diff for a specific file against a source branch. ```swift public func diff(forFile file:​ String, sourceBranch:​ String) -> Result ``` -------------------------------- ### Define a Danger Plugin in Swift Source: https://github.com/danger/swift/blob/master/README.md A basic structure for a Danger plugin written in Swift. This example shows how to define a public struct with a static function that can be called from a Dangerfile. ```swift // DangerPlugin.swift import Danger public struct DangerPlugin { let danger = Danger() public static func doYourThing() { // Code goes here } } ``` -------------------------------- ### Remove Ruby Danger Gem Source: https://github.com/danger/swift/blob/master/Documentation/tutorials/migrating_from_ruby_danger.html.md Remove the Danger gem from your Gemfile to uninstall it from your local setup. Run `bundle install` afterwards. ```diff group :test do - gem 'danger' # Stop saying 'you forgot to...' in CI ``` -------------------------------- ### lint(_:inline:configFile:strict:quiet:swiftlintPath:) Source: https://github.com/danger/swift/blob/master/Documentation/reference/SwiftLint.md This is the main entry point for linting Swift in PRs. When the swiftlintPath is not specified, it uses by default `swift run swiftlint` if the Package.swift in your root folder contains swiftlint as dependency, otherwise calls directly the swiftlint command. ```APIDOC ## lint(_:inline:configFile:strict:quiet:swiftlintPath:) ### Description This is the main entry point for linting Swift in PRs. When the swiftlintPath is not specified, it uses by default `swift run swiftlint` if the Package.swift in your root folder contains swiftlint as dependency, otherwise calls directly the swiftlint command. ### Method `public static func lint(_ lintStyle: LintStyle = .modifiedAndCreatedFiles(directory: nil), inline: Bool = false, configFile: String? = nil, strict: Bool = false, quiet: Bool = true, swiftlintPath: SwiftlintPath? = nil) -> [SwiftLintViolation]` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **[SwiftLintViolation]** - An array of SwiftLintViolation objects. #### Response Example None ``` -------------------------------- ### Initialize Swift Package Source: https://github.com/danger/swift/blob/master/Documentation/usage/extending_danger.html.md Use the `swift package init --type library` command to create a new Swift Package Manager library. This sets up the basic file structure for your plugin. ```sh mkdir DangerNoCopyrights/ cd DangerNoCopyrights/ swift package init --type library ``` -------------------------------- ### `Danger()` — Entry Point Source: https://context7.com/danger/swift/llms.txt Initializes the Danger Swift environment and returns the `DangerDSL` instance. This instance provides access to all pull request metadata, file change information, and utility functions. It must be called at the beginning of every `Dangerfile.swift`. ```APIDOC ## `Danger()` — Entry Point Returns the `DangerDSL` instance that provides access to all PR metadata, file change information, and utility functions. Must be called at the top of every `Dangerfile.swift`. ```swift import Danger let danger = Danger() // Access basic PR info on GitHub print(danger.github.pullRequest.title) print(danger.github.pullRequest.additions ?? 0) print(danger.github.pullRequest.changedFiles ?? 0) ``` ``` -------------------------------- ### Initialize Danger Instance Source: https://github.com/danger/swift/blob/master/Tests/RunnerLibTests/__Snapshots__/DangerFileGeneratorTests/testItGeneratesTheCorrectFileWhenThereIsAreMultipleImports.1.txt Shows the basic initialization of the Danger object, which is the entry point for Danger's functionalities. ```swift let danger = Danger() ``` -------------------------------- ### spawn(_:arguments:) Source: https://github.com/danger/swift/blob/master/Documentation/reference/DangerUtils.md Executes a command, returns its standard output, and exposes command errors. ```APIDOC ## spawn(_:arguments:) ### Description Gives you the ability to cheaply run a command and read the output without having to mess around too much, and exposes command errors in a pretty elegant way. ### Method func spawn(_ command: String, arguments: [String] = []) throws -> String ### Parameters #### Path Parameters - **command** (String) - Required - The first part of the command - **arguments** ([String]) - Optional - An optional array of arguements to pass in extra ### Returns the stdout from the command ``` -------------------------------- ### Spawn Command with Error Handling Source: https://github.com/danger/swift/blob/master/Documentation/reference/DangerUtils.md Runs a command, returns its standard output, and exposes command errors. ```swift public func spawn(_ command:​ String, arguments:​ [String] = []) throws -> String ``` -------------------------------- ### Get Default DateFormatter Source: https://github.com/danger/swift/blob/master/Documentation/reference/DateFormatter.md Access the default DateFormatter instance for general use. ```swift public static var defaultDateFormatter: DateFormatter ``` -------------------------------- ### Danger() Source: https://github.com/danger/swift/blob/master/Documentation/reference/Home.md Initializes the Danger environment. ```APIDOC ## Danger() ### Description Initializes the Danger environment. ### Method N/A (Initialization function) ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### Get Date-Only DateFormatter Source: https://github.com/danger/swift/blob/master/Documentation/reference/DateFormatter.md Access a DateFormatter instance configured to format dates without time components. ```swift public static var onlyDateDateFormatter: DateFormatter ``` -------------------------------- ### Configure Bitbucket Server Host and Credentials Source: https://context7.com/danger/swift/llms.txt Set DANGER_BITBUCKETSERVER_HOST, DANGER_BITBUCKETSERVER_USERNAME, and DANGER_BITBUCKETSERVER_PASSWORD for Bitbucket Server integration. ```bash export DANGER_BITBUCKETSERVER_HOST="https://bitbucket.mycompany.com" export DANGER_BITBUCKETSERVER_USERNAME="ci-user" export DANGER_BITBUCKETSERVER_PASSWORD="secret" ``` -------------------------------- ### Get File Extension Source: https://github.com/danger/swift/blob/master/Documentation/reference/FileType.md Retrieves the file extension string associated with a FileType case. This property is crucial for operations involving file paths. ```swift var `extension`:​ String ``` -------------------------------- ### SwiftLint configuration options Source: https://github.com/danger/swift/blob/master/Documentation/tutorials/ios_app.html.md Provides various configuration options for SwiftLint integration, including inline comments, specific directories, linting all files, and custom SwiftLint paths. Requires the Danger framework and SwiftLint. ```swift // Instead of making a markdown table in the main message // sprinkle those comments inline, this can be a bit noisy // but it definitely feels magical. SwiftLint.lint(inline: true) ``` ```swift // Have different runs of SwiftLint against different sub-folders SwiftLint.lint(directory: "Sources", configFile: ".swiftlint.yml") SwiftLint.lint(directory: "Tests", configFile: "Tests/HarveyTests/.swiftlint.yml") ``` ```swift // The equivalent to running `swiftlint` in the root of the folder SwiftLint.lint(lintAllFiles: true) ``` ```swift // Use a different path for SwiftLint SwiftLint.lint(swiftlintPath: "Pods/SwiftLint/swiftlint") ``` -------------------------------- ### Hunk Properties Source: https://github.com/danger/swift/blob/master/Documentation/reference/FileDiff_Hunk.md Declares the properties of the Hunk struct, including the starting line and span for both the old and new versions of the file, and the array of Line objects representing the changes. ```swift let oldLineStart: Int ``` ```swift let oldLineSpan: Int ``` ```swift let newLineStart: Int ``` ```swift let newLineSpan: Int ``` ```swift let lines: [Line] ``` ```swift var description: String ``` -------------------------------- ### Execute Command Source: https://github.com/danger/swift/blob/master/Documentation/reference/DangerUtils.md Runs a command and returns its standard output. Assumes the command will pass. ```swift public func exec(_ command:​ String, arguments:​ [String] = []) -> String ``` -------------------------------- ### Configure Bitbucket Server Token Authentication Source: https://context7.com/danger/swift/llms.txt Alternatively, use DANGER_BITBUCKETSERVER_TOKEN for token-based authentication with Bitbucket Server. ```bash # or token-based: export DANGER_BITBUCKETSERVER_TOKEN="xxxxxxxxxxxx" ``` -------------------------------- ### Get File Diff with danger.utils.diff Source: https://context7.com/danger/swift/llms.txt Returns a parsed `FileDiff` for a single file, providing structured access to changes. Handles success and failure cases for diff operations. ```swift import Danger let danger = Danger() for file in danger.git.modifiedFiles where file.fileType == .swift { switch danger.utils.diff(forFile: file, sourceBranch: "main") { case .success(let diff): switch diff.changes { case .modified(let hunks): let addedLines = hunks.flatMap { $0.lines }.filter { $0.description.hasPrefix("+") } if addedLines.count > 200 { warn("Large change detected in \(file): \(addedLines.count) added lines in one file.") } default: break } case .failure(let error): warn("Could not diff \(file): \(error)") } } ``` -------------------------------- ### Running danger-swift with Swift Run Source: https://github.com/danger/swift/blob/master/README.md Execute danger-swift using `swift run` with a specific command and URL. ```sh swift run danger-swift pr https://github.com/danger/swift/pull/95 ``` -------------------------------- ### Emulating DangerJS process with JSON Input Source: https://github.com/danger/swift/blob/master/README.md Build the project and pipe JSON input to the danger-swift executable to emulate DangerJS's `process` functionality. ```sh swift build && cat Fixtures/eidolon_609.json | ./.build/debug/danger-swift ``` -------------------------------- ### Configure Local Testing Repository and PR Source: https://context7.com/danger/swift/llms.txt Use DANGER_TEST_REPO and DANGER_TEST_PR environment variables to specify the repository and PR for local Danger Swift testing. ```bash export DANGER_TEST_REPO="myorg/myrepo" export DANGER_TEST_PR="42" ``` -------------------------------- ### Environment Initializer Source: https://github.com/danger/swift/blob/master/Documentation/reference/DangerUtils_Environment.md Initializes an Environment instance. It can optionally take a closure to provide environment variables, defaulting to ProcessInfo.processInfo.environment. ```APIDOC ## init(env:​) ### Description Initializes an Environment instance with a closure that provides environment variables. ### Parameters #### Path Parameters - **env** (() -> [String: String]) - Required - A closure that returns a dictionary of environment variables. Defaults to `ProcessInfo.processInfo.environment`. ``` -------------------------------- ### Environment Initializer Source: https://github.com/danger/swift/blob/master/Documentation/reference/DangerUtils_Environment.md Initializes the Environment with a closure to retrieve environment variables. Defaults to using ProcessInfo.processInfo.environment. ```swift init(env:​ @escaping () -> [String:​ String] = { ProcessInfo.processInfo.environment }) ``` -------------------------------- ### BitBucketServer.Comment.CodingKeys: action Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_CodingKeys.md Represents the action associated with the comment. ```swift case action ``` -------------------------------- ### Basic SwiftLint integration Source: https://github.com/danger/swift/blob/master/Documentation/tutorials/ios_app.html.md Integrates SwiftLint to lint created and modified files in a pull request. Requires the Danger framework and SwiftLint. ```swift import Danger let danger = Danger() SwiftLint.lint() ``` -------------------------------- ### `danger.utils.exec(_:arguments:)` Source: https://context7.com/danger/swift/llms.txt Executes a shell command and returns its standard output as a string. Assumes success; use `spawn` when you need error handling. ```APIDOC ## `danger.utils.exec(_:arguments:)` — Run a Shell Command ### Description Executes a shell command and returns its standard output as a string. Assumes success; use `spawn` when you need error handling. ### Usage Example ```swift import Danger let danger = Danger() // Run a custom script and inspect output let testCoverage = danger.utils.exec("swift", arguments: ["test", "--show-codecov-path"]) message("Code coverage report at: \(testCoverage.trimmingCharacters(in: .whitespacesAndNewlines))") // Check for uncommitted files let status = danger.utils.exec("git", arguments: ["status", "--porcelain"]) if !status.isEmpty { warn("There are uncommitted changes: \(status)") } ``` ``` -------------------------------- ### BitBucket Server DSL Overview Source: https://github.com/danger/swift/blob/master/Documentation/usage/bitbucket.html.md Provides a TypeScript overview of the available properties within the `danger.bitbucketServer` object for BitBucket Server integration. ```typescript danger.bitbucketServer. /** The pull request and repository metadata */ metadata: RepoMetaData /** The PR metadata */ pullRequest: BitBucketServerPR /** The commits associated with the pull request */ commits: [BitBucketServerCommit] /** The comments on the pull request */ comments: [BitBucketServerPRActivity] /** The activities such as OPENING, CLOSING, MERGING or UPDATING a pull request */ activities: [BitBucketServerPRActivity] ``` -------------------------------- ### Bin Path Case Source: https://github.com/danger/swift/blob/master/Documentation/reference/SwiftLint_SwiftlintPath.md Represents a SwiftLint path located in a binary directory. ```swift case bin(:​ String) ``` -------------------------------- ### Deploying Danger Swift Source: https://github.com/danger/swift/blob/master/README.md Deploy Danger Swift by running the `swift run rocket $VERSION` command on the master branch. ```sh swift run rocket $VERSION ``` -------------------------------- ### Import Danger Plugins via Marathon Syntax Source: https://context7.com/danger/swift/llms.txt Import Swift PM packages inline within Dangerfile.swift using the '// package:' comment suffix for automatic runtime resolution and compilation. ```swift // Dangerfile.swift import Danger import DangerXCodeSummary // package: https://github.com/f-meloni/danger-swift-xcodesummary.git let danger = Danger() // Use the plugin XCodeSummary.report("build/output.json") ``` -------------------------------- ### Run Shell Command with danger.utils.exec Source: https://context7.com/danger/swift/llms.txt Executes a shell command and returns its standard output. Assumes the command will succeed. Use `spawn` for error handling. ```swift import Danger let danger = Danger() // Run a custom script and inspect output let testCoverage = danger.utils.exec("swift", arguments: ["test", "--show-codecov-path"]) message("Code coverage report at: \(testCoverage.trimmingCharacters(in: .whitespacesAndNewlines))") // Check for uncommitted files let status = danger.utils.exec("git", arguments: ["status", "--porcelain"]) if !status.isEmpty { warn("There are uncommitted changes: \(status)") } ``` -------------------------------- ### Set BitBucket Server Credentials (Username/Password) Source: https://github.com/danger/swift/blob/master/Documentation/guides/about_the_dangerfile.html.md Configure BitBucket Server access using host, username, and password for authenticated requests. ```sh export DANGER_BITBUCKETSERVER_HOST='xxxx' DANGER_BITBUCKETSERVER_USERNAME='yyyy' DANGER_BITBUCKETSERVER_PASSWORD='zzzz' ``` -------------------------------- ### exec(_:arguments:) Source: https://github.com/danger/swift/blob/master/Documentation/reference/DangerUtils.md Executes a command and returns its standard output. Assumes the command will succeed. ```APIDOC ## exec(_:arguments:) ### Description Gives you the ability to cheaply run a command and read the output without having to mess around. It generally assumes that the command will pass, as you only get a string of the STDOUT. If you think your command could/should fail then you want to use `spawn` instead. ### Method func exec(_ command: String, arguments: [String] = []) -> String ### Parameters #### Path Parameters - **command** (String) - Required - The first part of the command - **arguments** ([String]) - Optional - An optional array of arguements to pass in extra ### Returns the stdout from the command ``` -------------------------------- ### Set BitBucket Server Credentials (Username/Token) Source: https://github.com/danger/swift/blob/master/Documentation/guides/about_the_dangerfile.html.md Configure BitBucket Server access using host, username, and a personal access token for authenticated requests. ```sh export DANGER_BITBUCKETSERVER_HOST='xxxx' DANGER_BITBUCKETSERVER_USERNAME='yyyy' DANGER_BITBUCKETSERVER_TOKEN='zzzz' ``` -------------------------------- ### Pipeline Status: Running Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitLab_MergeRequest_Pipeline_Status.md Represents a pipeline that is currently executing. ```swift case running ``` -------------------------------- ### parseDangerDSL(with:) / Fixture DSLs — Testing Utilities (`DangerFixtures`) Source: https://context7.com/danger/swift/llms.txt The `DangerFixtures` library provides pre-built fixture DSLs for unit-testing Dangerfile logic without running against a real PR. Use `githubWithFilesDSL` to inject custom file lists and file content maps. ```APIDOC ## `parseDangerDSL(with:)` / Fixture DSLs — Testing Utilities (`DangerFixtures`) The `DangerFixtures` library provides pre-built fixture DSLs for unit-testing Dangerfile logic without running against a real PR. Use `githubWithFilesDSL` to inject custom file lists and file content maps. ```swift import Danger import DangerFixtures import XCTest // Test a function that should warn on large PRs func checkLargePR(_ danger: DangerDSL) { let total = danger.git.createdFiles.count + danger.git.modifiedFiles.count if total > 50 { warn("Large PR with \(total) files changed.") } } class DangerfileTests: XCTestCase { override func setUp() { super.setUp() // Clear any accumulated Danger results between tests resetDangerResults() } func testWarnsOnLargePR() { // Build a DSL with 60 modified files let largeFiles = (0..<60).map { "Sources/File\($0).swift" } let dsl = githubWithFilesDSL(modified: largeFiles) checkLargePR(dsl) XCTAssertEqual(warnings.count, 1) XCTAssertTrue(warnings[0].message.contains("Large PR")) } func testNoWarningOnSmallPR() { let dsl = githubWithFilesDSL(modified: ["Sources/ViewController.swift"]) checkLargePR(dsl) XCTAssertEqual(warnings.count, 0) } func testReadFileContent() { let fileMap = ["Sources/Foo.swift": "// TODO: fix this\nclass Foo {}"] let dsl = githubWithFilesDSL( modified: ["Sources/Foo.swift"], fileMap: fileMap ) let content = dsl.utils.readFile("Sources/Foo.swift") XCTAssertTrue(content.contains("TODO")) } } ``` ``` -------------------------------- ### Configure Proxy for Debugging BitBucket Server Requests Source: https://github.com/danger/swift/blob/master/Documentation/usage/bitbucket.html.md Sets environment variables to configure an HTTP or HTTPS proxy for debugging requests to BitBucket Server. Useful for intercepting traffic. ```bash export NODE_TLS_REJECT_UNAUTHORIZED=0 # Avoid certificate error export http_proxy=http://127.0.0.1:8080 or export https_proxy=https://127.0.0.1:8080 ``` -------------------------------- ### Created Case Source: https://github.com/danger/swift/blob/master/Documentation/reference/FileDiff_Changes.md Represents a newly created file, storing an array of added lines. ```swift case created(addedLines:​ [String]) ``` -------------------------------- ### GitHub Actions with Docker Image Source: https://github.com/danger/swift/blob/master/README.md Use a pre-built Danger Swift Docker image in your GitHub Actions. The `docker://` prefix specifies the image source. ```yaml jobs: build: runs-on: ubuntu-latest name: "Run Danger" steps: - uses: actions/checkout@v1 - name: Danger uses: docker://ghcr.io/danger/danger-swift:3.15.0 with: args: --failOnErrors --no-publish-check env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` -------------------------------- ### Specifying Working Directory with --cwd Source: https://github.com/danger/swift/blob/master/README.md Use the `--cwd` parameter to specify a working directory, useful when your Package.swift is not in the root folder. ```swift swift run danger-swift command --cwd path/to/working-directory ``` -------------------------------- ### Define BitBucketServer.Project Struct Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Project.md Defines the Project struct which conforms to Decodable and Equatable. ```swift struct Project:​ Decodable, Equatable ``` -------------------------------- ### Fake CI Mode for Local Testing with Danger Swift Source: https://context7.com/danger/swift/llms.txt Configure DANGER_FAKE_CI, DANGER_TEST_REPO, and DANGER_TEST_PR environment variables to simulate a CI environment for local testing of Danger Swift. ```bash export DANGER_FAKE_CI="YEP" export DANGER_TEST_REPO="myorg/myrepo" DANGER_TEST_PR="42" danger-swift ci ``` -------------------------------- ### DSL Structure Source: https://github.com/danger/swift/blob/master/Documentation/reference/DSL.md The `DSL` struct is the main entry point for the Danger Swift DSL. It conforms to `Decodable` and contains properties that represent the Danger environment. ```APIDOC ## Struct DSL ### Description The `DSL` struct represents the core Domain Specific Language for Danger Swift. It is `Decodable` and provides access to various aspects of the Danger environment. ### Properties #### `danger` - **Type**: `DangerDSL` - **Description**: Provides access to the root Danger import, allowing interaction with Danger's features and data. ### Example Usage ```swift // Assuming 'danger' is an instance of DSL let dangerDSL = danger.danger ``` ``` -------------------------------- ### Run danger-swift CLI Commands Source: https://context7.com/danger/swift/llms.txt Execute `danger-swift` from your CI or local environment to manage your Danger workflow. Commands include running Danger on CI, against a specific PR URL, locally against master, editing the Dangerfile interactively, and specifying custom binary paths or working directories for monorepos. ```bash # Run on CI — reads PR data from the CI environment danger-swift ci # Run locally against a specific PR URL (does NOT post comments) danger-swift pr https://github.com/danger/swift/pull/95 # Run against local changes since master danger-swift local # Open an Xcode project for editing the Dangerfile interactively danger-swift edit # Specify a custom danger-js binary location danger-swift ci --danger-js-path /usr/local/bin/danger # Change the working directory (for monorepos) danger-swift runner --cwd path/to/subproject ``` -------------------------------- ### Run Danger Swift Locally Source: https://github.com/danger/swift/blob/master/Documentation/tutorials/migrating_from_ruby_danger.html.md Use this command to test your Dangerfile locally by running Danger Swift against a specific pull request URL. ```sh [swift run] danger-swift pr [a_pr_url_from_your_repo] ``` ```sh [swift run] danger-swift pr https://github.com/danger/swift/pull/155 ``` -------------------------------- ### `danger.utils.spawn(_:arguments:)` Source: https://context7.com/danger/swift/llms.txt Throwable variant of `exec` that surfaces command failures as Swift errors. Use when the command is expected to succeed and failure should halt evaluation. ```APIDOC ## `danger.utils.spawn(_:arguments:)` — Run a Shell Command with Error Propagation ### Description Throwable variant of `exec` that surfaces command failures as Swift errors. Use when the command is expected to succeed and failure should halt evaluation. ### Usage Example ```swift import Danger let danger = Danger() do { let swiftVersion = try danger.utils.spawn("swift", arguments: ["--version"]) message("Swift version in use: \(swiftVersion.components(separatedBy: "\n").first ?? "")") } catch { fail("Could not determine Swift version: \(error)") } ``` ``` -------------------------------- ### Import Danger and Foundation Source: https://github.com/danger/swift/blob/master/Tests/RunnerLibTests/__Snapshots__/DangerFileGeneratorTests/testItGeneratesTheCorrectFileWhenThereIsAreMultipleImports.1.txt Standard imports required for Danger Swift projects. ```swift import Danger import Foundation ``` -------------------------------- ### Run Shell Command with Error Propagation using danger.utils.spawn Source: https://context7.com/danger/swift/llms.txt A throwable variant of `exec` that surfaces command failures as Swift errors. Use this when command success is critical and failure should halt evaluation. ```swift import Danger let danger = Danger() do { let swiftVersion = try danger.utils.spawn("swift", arguments: ["--version"]) message("Swift version in use: \(swiftVersion.components(separatedBy: "\n").first ?? "")") } catch { fail("Could not determine Swift version: \(error)") } ``` -------------------------------- ### CodingKeys Case: htmlURL Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_Repo_CodingKeys.md Represents the 'html_url' key for a GitHub repository. ```swift case htmlURL ``` -------------------------------- ### Fake CI Environment for Danger Source: https://github.com/danger/swift/blob/master/Documentation/guides/about_the_dangerfile.html.md Set environment variables to simulate a CI environment for testing Danger locally. This will post comments on the PR. ```bash export DANGER_FAKE_CI="YEP" export DANGER_TEST_REPO='username/reponame' ``` -------------------------------- ### CodingKeys Enum Case: version Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_Detail_CodingKeys.md Represents the 'version' key for BitBucketServer comment details. ```swift case version ``` -------------------------------- ### SwiftLint.lint(_:inline:configFile:strict:quiet:swiftlintPath:) Source: https://context7.com/danger/swift/llms.txt Runs SwiftLint to lint Swift files, posting violations as a Markdown table or inline comments. It automatically detects whether to use `swift run swiftlint` (SPM) or the system binary. ```APIDOC ## `SwiftLint.lint(_:inline:configFile:strict:quiet:swiftlintPath:)` — Run SwiftLint The built-in SwiftLint plugin lints Swift files in the PR and posts violations as a Markdown table or as inline PR comments. Automatically detects whether to use `swift run swiftlint` (SPM) or the system binary. ```swift import Danger let danger = Danger() // Lint only modified/created files, posting inline warnings and errors SwiftLint.lint(.modifiedAndCreatedFiles(directory: nil), inline: true) // Lint all files in a specific directory using a custom config SwiftLint.lint( .all(directory: "Sources/"), inline: false, configFile: ".swiftlint-strict.yml", strict: true, quiet: true ) // Lint a manually filtered list of files let filesToLint = (danger.git.modifiedFiles + danger.git.createdFiles) .filter { !$0.contains("Tests/") && !$0.contains("Documentation/") } let violations = SwiftLint.lint(.files(filesToLint), inline: true) if violations.isEmpty { message("No SwiftLint violations found.") } else { // violations is [SwiftLintViolation], each has .ruleID, .reason, .line, .file, .severity let errors = violations.filter { $0.severity == .error } if !errors.isEmpty { fail("SwiftLint found \(errors.count) error(s). Please fix them before merging.") } } // Use a SwiftLint binary from an SPM dependency in the repo SwiftLint.lint( .modifiedAndCreatedFiles(directory: "Sources/"), swiftlintPath: .swiftPackage(".") ) // Use a specific binary path SwiftLint.lint( .modifiedAndCreatedFiles(directory: nil), swiftlintPath: .bin("/usr/local/bin/swiftlint") ) ``` ``` -------------------------------- ### CodingKeys Case: login Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_User_CodingKeys.md Represents the 'login' key for GitHub user data. ```swift case login ``` -------------------------------- ### CLI Commands — `danger-swift` Source: https://context7.com/danger/swift/llms.txt The `danger-swift` executable is invoked from CI scripts or locally and supports five subcommands for different phases of the Danger workflow. ```APIDOC ## CLI Commands — `danger-swift` The `danger-swift` executable is invoked from CI scripts or locally and supports five subcommands for different phases of the Danger workflow. ```bash # Run on CI — reads PR data from the CI environment danger-swift ci # Run locally against a specific PR URL (does NOT post comments) danger-swift pr https://github.com/danger/swift/pull/95 # Run against local changes since master danger-swift local # Open an Xcode project for editing the Dangerfile interactively danger-swift edit # Specify a custom danger-js binary location danger-swift ci --danger-js-path /usr/local/bin/danger # Change the working directory (for monorepos) danger-swift runner --cwd path/to/subproject ``` ``` -------------------------------- ### Run Danger Swift using Swift Package Manager Source: https://context7.com/danger/swift/llms.txt Execute Danger Swift CI commands directly using the 'swift run' command after integrating it via Swift Package Manager. ```bash # Run using SPM (recommended) swift run danger-swift ci ``` -------------------------------- ### CodingKeys Enum Case: properties Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_Detail_CodingKeys.md Represents the 'properties' key for BitBucketServer comment details. ```swift case properties ``` -------------------------------- ### BitBucketServer.Comment.CodingKeys: comment Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_CodingKeys.md Represents the textual content of the comment. ```swift case comment ``` -------------------------------- ### Repo Name Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketCloud_Repo.md Represents the name of the repository. ```swift let name: String ``` -------------------------------- ### Repo Description Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_Repo.md An optional textual description of the repository. ```swift let description: String? ``` -------------------------------- ### Fail if CHANGELOG entry is missing Source: https://github.com/danger/swift/blob/master/Documentation/tutorials/ios_app.html.md Fails the build if app files were edited but no CHANGELOG entry exists. Requires the Danger framework. ```swift if editedAppFiles.count > 0 && !hasChangelogEntry { fail("Please add a CHANGELOG entry") } ``` -------------------------------- ### Created Files Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/Git.md Represents an array of file paths that are newly created relative to the git root. ```swift let createdFiles:​ [File] ``` -------------------------------- ### Add Danger Swift and Plugins via Swift Package Manager Source: https://github.com/danger/swift/blob/master/Documentation/guides/about_the_dangerfile.html.md Configure your Package.swift to include danger-swift and custom plugins as development dependencies. ```swift let package = Package( ... products: [ ... // Library name must start with `DangerDeps` otherwise `Danger` won't be able to import it. .library(name: "DangerDeps", type: .dynamic, targets: ["DangerDependencies"]), // dev ... ], dependencies: [ ... .package(url: "https://github.com/danger/swift.git", from: "1.0.0"), // dev // Danger Plugins .package(url: "https://github.com/username/DangerPlugin.git", from: "0.1.0") // dev ... ], targets: [ .target(name: "DangerDependencies", dependencies: ["Danger", "DangerPlugin"]), // dev ... ] ) ``` -------------------------------- ### CodingKeys Case: isFork Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_Repo_CodingKeys.md Represents the 'fork' key for a GitHub repository. ```swift case isFork ``` -------------------------------- ### Main Lint Method Source: https://github.com/danger/swift/blob/master/Documentation/reference/SwiftLint.md The primary method for linting Swift code in pull requests. It defaults to 'swift run swiftlint' if swiftlint is a dependency in Package.swift, otherwise calls 'swiftlint' directly. ```swift @discardableResult public static func lint(_ lintStyle:​ LintStyle = .modifiedAndCreatedFiles(directory:​ nil), inline:​ Bool = false, configFile:​ String? = nil, strict:​ Bool = false, quiet:​ Bool = true, swiftlintPath:​ SwiftlintPath? = nil) -> [SwiftLintViolation] ``` -------------------------------- ### Swift Package Path Case Source: https://github.com/danger/swift/blob/master/Documentation/reference/SwiftLint_SwiftlintPath.md Represents a SwiftLint path located within a Swift Package. ```swift case swiftPackage(:​ String) ``` -------------------------------- ### BitBucketServer.Comment.CodingKeys: createdAt Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_CodingKeys.md Represents the timestamp when the comment was created. ```swift case createdAt ``` -------------------------------- ### Enable Debug Logging for Danger Swift Source: https://github.com/danger/swift/blob/master/Documentation/guides/faq.html.md Prefixing the Danger Swift command with DEBUG="*" enables verbose logging, providing detailed insights into its internal operations. This is helpful for diagnosing unexpected behavior. ```shell DEBUG="*" [swift run] danger-swift pr https://github.com/danger/swift/pull/95 ``` ```shell DEBUG="*" [swift run] danger-swift ci ``` -------------------------------- ### Project Key Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Project.md Represents the human-readable project key. ```swift let key:​ String ``` -------------------------------- ### LintStyle.modifiedAndCreatedFiles Source: https://github.com/danger/swift/blob/master/Documentation/reference/SwiftLint_LintStyle.md Only lints modified and created files with the .swift extension. ```APIDOC ## LintStyle.modifiedAndCreatedFiles ### Description Only lints the modified and created files with `.swift` extension. ### Method Enum Case ### Parameters #### Path Parameters - **directory** (String?) - Optional - The directory to execute linting at. ``` -------------------------------- ### Activity CreatedAt Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Activity.md Stores the creation timestamp of the activity as milliseconds since the Unix epoch. ```swift let createdAt:​ Int ``` -------------------------------- ### Pipeline Status: Success Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitLab_MergeRequest_Pipeline_Status.md Represents a pipeline that completed successfully. ```swift case success ``` -------------------------------- ### BitBucketServer Repo CodingKeys: project Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Repo_CodingKeys.md Represents the 'project' key for a BitBucketServer repository. ```swift case project ``` -------------------------------- ### Enable Verbose Logging with Danger Swift Source: https://context7.com/danger/swift/llms.txt Set the DEBUG environment variable to '*' to enable verbose logging for Danger Swift during CI operations. ```bash DEBUG="*" danger-swift ci ``` -------------------------------- ### LintStyle.all Source: https://github.com/danger/swift/blob/master/Documentation/reference/SwiftLint_LintStyle.md Lints all files in the specified directory or the current directory if none is provided. ```APIDOC ## LintStyle.all ### Description Lints all the files instead of only the modified and created files. ### Method Enum Case ### Parameters #### Path Parameters - **directory** (String?) - Optional - The directory to execute linting at. ``` -------------------------------- ### BitBucketServer.Activity.CodingKeys Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Activity_CodingKeys.md The CodingKeys enumeration defines the keys used for property mapping during the encoding and decoding of BitBucketServer activity objects. ```APIDOC ## Enumeration: BitBucketServer.Activity.CodingKeys ### Description This enumeration conforms to the `CodingKey` protocol and is used to map Swift property names to their corresponding JSON keys when serializing or deserializing BitBucketServer activity data. ### Cases - **`id`**: Represents the unique identifier of the activity. - **`createdAt`**: Represents the timestamp when the activity occurred. - **`user`**: Represents the user associated with the activity. - **`action`**: Represents the type of action performed. - **`commentAction`**: Represents the specific action related to a comment, if applicable. ``` -------------------------------- ### Repo Name Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Repo.md Represents the name of the repository. This property is optional. ```swift let name: String? ``` -------------------------------- ### CodingKey Case: labels Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_Issue_CodingKeys.md Represents the 'labels' field for a GitHub Issue. ```swift case labels ``` -------------------------------- ### Task State Property Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_Detail_Task.md Indicates the current status of the task, such as 'OPEN'. ```swift let state: String ``` -------------------------------- ### Using Local Compiled danger-js Source: https://github.com/danger/swift/blob/master/README.md Specify the path to a local compiled danger-js using the `--danger-js-path` argument. ```bash danger-swift command --danger-js-path path/to/danger-js ``` -------------------------------- ### CodingKey Case: body Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_Issue_CodingKeys.md Represents the 'body' field for a GitHub Issue. ```swift case body ``` -------------------------------- ### Run Danger Swift in CI Source: https://github.com/danger/swift/blob/master/Documentation/tutorials/migrating_from_ruby_danger.html.md Replace the Ruby Danger command with this command in your CI system to run Danger Swift. ```sh [swift run] danger-swift ci ``` -------------------------------- ### CodingKeys Enum Case: tasks Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_Detail_CodingKeys.md Represents the 'tasks' key for BitBucketServer comment details. ```swift case tasks ``` -------------------------------- ### Activity Struct Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Activity.md The Activity struct represents an event or action within BitBucket Server. It includes details about the event's ID, creation timestamp, the user involved, and the type of action performed. ```APIDOC ## Struct: Activity ### Description Represents an activity or event within BitBucket Server. ### Properties - **id** (Int) - The unique identifier for the activity. - **createdAt** (Int) - The timestamp when the activity was created, represented as milliseconds since the Unix epoch. - **user** (User) - The user object associated with the activity. - **action** (String) - The type of action performed (e.g., "COMMENTED"). - **commentAction** (String?) - An optional field that provides more specific details about the action if it was a comment (e.g., "CREATED"). ``` -------------------------------- ### CodingKeys Case: dueOn Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_Milestone_CodingKeys.md Represents the 'due_on' key for a GitHub Milestone. ```swift case dueOn ``` -------------------------------- ### `danger.utils.sync(_:)` Source: https://context7.com/danger/swift/llms.txt Bridges callback-based asynchronous APIs into synchronous execution. Required when using OctoKit or other async APIs inside a Dangerfile, which executes synchronously. ```APIDOC ## `danger.utils.sync(_:)` — Wrap Async Calls Synchronously ### Description Bridges callback-based asynchronous APIs into synchronous execution. Required when using OctoKit or other async APIs inside a Dangerfile, which executes synchronously. ### Usage Example ```swift import Danger let danger = Danger() guard danger.github != nil else { exit(0) } // Synchronously fetch a GitHub user profile via OctoKit let user = danger.utils.sync { danger.github.api.user(danger.github.pullRequest.user.login) { response in done(response) } } switch user { case .success(let profile): message("PR author has \(profile.publicRepos ?? 0) public repos.") case .failure(let error): warn("Could not fetch user info: \(error)") } ``` ``` -------------------------------- ### BitBucketServer.Comment.CodingKeys: commentAction Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_CodingKeys.md Represents the specific action taken on the comment itself (e.g., resolved, un-resolved). ```swift case commentAction ``` -------------------------------- ### Repo Struct Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_Repo.md Represents a GitHub repository with its core attributes. ```APIDOC ## Struct Repo ### Description Represents a GitHub repository. ### Properties - **id** (Int) - The unique identifier of the repository. - **name** (String) - The name of the repository. - **fullName** (String) - The full name of the repository, including the owner. - **owner** (User) - The owner of the repository. - **isPrivate** (Bool) - Indicates if the repository is private. - **description** (String?) - A textual description of the repository. - **isFork** (Bool) - Indicates if the repository is a fork. - **htmlURL** (String) - The URL to the repository's page on GitHub. ``` -------------------------------- ### BitBucketServer.Repo.CodingKeys Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Repo_CodingKeys.md The CodingKeys enum provides the keys used for encoding and decoding repository properties. ```APIDOC ## BitBucketServer.Repo.CodingKeys ### Description The `CodingKeys` enum is used to map Swift properties to their corresponding JSON keys when encoding or decoding `BitBucketServer.Repo` objects. ### Enumeration Cases - **name**: Represents the name of the repository. - **slug**: Represents the URL-friendly slug of the repository. - **scmId**: Represents the ID of the Source Code Management system. - **isPublic**: Indicates whether the repository is public. - **forkable**: Indicates whether the repository is forkable. - **project**: Represents the project the repository belongs to. ``` -------------------------------- ### Define BitBucketServer Comment Detail Task CodingKeys Source: https://github.com/danger/swift/blob/master/Documentation/reference/BitBucketServer_Comment_Detail_Task_CodingKeys.md Defines the enumeration cases for coding keys used in the BitBucketServer Comment Detail Task. These keys correspond to the properties of the task data. ```swift enum CodingKeys ``` ```swift case id ``` ```swift case createdAt ``` ```swift case text ``` ```swift case state ``` ```swift case author ``` -------------------------------- ### UserType Case: organization Source: https://github.com/danger/swift/blob/master/Documentation/reference/GitHub_User_UserType.md Represents a GitHub organization account. ```swift case organization ``` -------------------------------- ### File Type Cases Source: https://github.com/danger/swift/blob/master/Documentation/reference/FileType.md Represents different file types supported by the system. Each case corresponds to a specific file extension. ```swift case json ``` ```swift case swift ``` ```swift case yaml ``` ```swift case pbxproj ``` ```swift case mm ``` ```swift case plist ``` ```swift case storyboard ``` ```swift case m ``` ```swift case xcscheme ``` ```swift case yml ``` ```swift case markdown ``` ```swift case h ```