Skip to content

Error running SwiftFormat: (RuntimeError) #53

@EgaSetya

Description

@EgaSetya

Hi @garriguv, I encountered a runtime error like the following when attempting to integrate danger-swiftformat on GitLab.

Error

bundler: failed to load command: danger (/builds/technology/ios/project/.bundle/ruby/2.7.0/bin/danger)
/builds/technology/ios/project/.bundle/ruby/2.7.0/gems/danger-swiftformat-0.9.0/lib/swiftformat/swiftformat.rb:31:in `check_format': \e[31m (Danger::DSLError)
[!] Invalid `Dangerfile` file: Error running SwiftFormat:
Error: \e[0m./swiftformat: line 1: syntax error: unexpected word (expecting ")")\e[0m
 #  from Dangerfile:6
 #  -------------------------------------------
 #  swiftformat.binary_path = "./swiftformat"
 >  swiftformat.check_format
 #  -------------------------------------------
	from /builds/technology/ios/project/.bundle/ruby/2.7.0/gems/danger-swiftformat-0.9.0/lib/swiftformat/plugin.rb:59:in `check_format'
	from Dangerfile:6:in `eval_file'
Screenshot 2024-02-02 at 15 12 09

Dangerfile

require "gitlab-dangerfiles"

Gitlab::Dangerfiles.for_project(self, &:import_defaults)

swiftformat.binary_path = "./swiftformat"
swiftformat.check_format

.swiftformat

# file options

--exclude Tests/XCTestManifests.swift,Tests/BadConfig,Snapshots,Build,PluginTests,Pods

# format options

--guardelse same-line
--lineaftermarks false
--emptybraces spaced
--patternlet inline
--marktypes never
--markextensions never
--redundanttype inferred
--trailingclosures filter,map,compactMap
--commas inline
--stripunusedargs closure-only
--wraparguments before-first
--wrapparameters before-first
--wrapreturntype if-multiline
--wrapconditions after-first
--trimwhitespace nonblank-lines


# rules

--enable spaceAroundBraces
--enable wrapConditionalBodies
--enable redundantOptionalBinding
--disable initCoderUnavailable

What can I do to fix this issue? Is there anything that I missed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions