fastlane: Exit status of command 'swiftlint lint --config .swiftlint.yml' was 1 instead of 0.

New Issue Checklist

Issue Description 51d663c576736da80d012210f4e44671

Complete output when running fastlane, including the stack trace and command used
from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane_core-0.36.8/lib/fastlane_core/ui/ui.rb:14:in `method_missing'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/helper/sh_helper.rb:44:in `sh_no_action'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/helper/sh_helper.rb:9:in `sh'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/actions/swiftlint.rb:30:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/runner.rb:143:in `block (2 levels) in execute_action'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/actions/actions_helper.rb:35:in `execute_action'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/runner.rb:129:in `block in execute_action'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/runner.rb:128:in `chdir'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/runner.rb:128:in `execute_action'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/fast_file.rb:149:in `method_missing'
    from Fastfile:288:in `block in parsing_binding'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/lane.rb:36:in `call'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/lane.rb:36:in `call'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/runner.rb:52:in `block in execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/runner.rb:46:in `chdir'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/runner.rb:46:in `execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/lib/fastlane/command_line_handler.rb:30:in `handle'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/bin/fastlane:38:in `block (2 levels) in run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
    from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
    from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.3.5/lib/commander/command.rb:153:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.3.5/lib/commander/runner.rb:428:in `run_active_command'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane_core-0.36.8/lib/fastlane_core/ui/fastlane_runner.rb:23:in `run!'
    from /usr/local/lib/ruby/gems/2.2.0/gems/commander-4.3.5/lib/commander/delegates.rb:15:in `run!'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/bin/fastlane:156:in `run'
    from /usr/local/lib/ruby/gems/2.2.0/gems/fastlane-1.63.1/bin/fastlane:162:in `<top (required)>'
    from /usr/local/bin/fastlane:23:in `load'
    from /usr/local/bin/fastlane:23:in `<main>'

Configuration Files

Please copy the complete content of your Fastfile and any other configuration files you use below:

Fastfile:

  swiftlint(
    mode: :lint,
    strict: false,
    config_file: '.swiftlint.yml',
  )

AND/OR

  swiftlint(
    mode: :lint,
    strict: false,
  )

Environment

fastlane version (fastlane -v): fastlane 1.63.1 Do you use bundler, rbenv or rvm? NO

I’m trying to find a way to generate swiftlint report file without broke the ci (jenkins) build

Actually I get this result: Valid Done linting! Found 261 violations, 35 serious in 28 files.

and fastlane throw:

/usr/local/lib/ruby/gems/2.2.0/gems/fastlane_core-0.36.8/lib/fastlane_core/ui/interface.rb:120:in `crash!': [!] Exit status of command 'swiftlint lint --config .swiftlint.yml' was 1 instead of 0. (FastlaneCore::Interface::FastlaneCrash)

Without config file (–config .swiftlint.yml):

/usr/local/lib/ruby/gems/2.2.0/gems/fastlane_core-0.36.8/lib/fastlane_core/ui/interface.rb:120:in `crash!': [!] Exit status of command 'swiftlint lint' was 1 instead of 0. (FastlaneCore::Interface::FastlaneCrash)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

This has gone out as part of fastlane 1.81.0! 🎉

Hi folks. I’ve merged #4112, which adds a ignore_exit_status option to the swiftlint action that should do what you’re looking for.

That will go out in the next release! 🚀

Swiftlint always returns exit 1 when he founds serious violations (https://github.com/realm/SwiftLint/issues/30), but I think it should not fail job on CI. For example Jenkins has plugins for inform about violations (e.g. https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin) and swiftlint support custom reporters, https://github.com/realm/SwiftLint/pull/293/files.

EDIT: This works (in Fastfile): sh "cd #{ENV['PWD']}; swiftlint lint --config .swiftlint.yml > swiftlint.result.xml; exit 0"

And in .swiftlint.yml add: reporter: "checkstyle"

It is not good way to do this but works 😃

Maybe you’re running it in the wrong directory? Try putting this around swiftline

Dir.chdir("..") do
  swiftlint
end

Fastlane: 1.63.1 Swiftlint: 0.9.1

This is issue of fastlane, when I run command swiftlint lint --config fastlane/rules.yml it works perfectly, but when I used localy swiflint fastlane action I got: Done linting! Found 4268 violations, 475 serious in 414 files.

and just after that

Exit status of command 'swiftlint lint --config fastlane/rules.yml' was 1 instead of 0.

and dump from swiftlint logs, all files etc.

Last lines:

Done linting! Found 4268 violations, 475 serious in 414 files.
()

    from /Library/Ruby/Gems/2.0.0/gems/fastlane_core-0.39.0/lib/fastlane_core/ui/ui.rb:15:in `method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/helper/sh_helper.rb:44:in `sh_no_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/helper/sh_helper.rb:9:in `sh'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/actions/swiftlint.rb:30:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/runner.rb:143:in `block (2 levels) in execute_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/actions/actions_helper.rb:35:in `execute_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/runner.rb:129:in `block in execute_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/runner.rb:128:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/runner.rb:128:in `execute_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/fast_file.rb:149:in `method_missing'
    from GenericFastfile:180:in `block (2 levels) in parsing_binding'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/lane.rb:36:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/lane.rb:36:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/runner.rb:52:in `block in execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/runner.rb:46:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/runner.rb:46:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/lane_manager.rb:46:in `cruise_lane'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/lib/fastlane/command_line_handler.rb:30:in `handle'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/bin/fastlane:38:in `block (2 levels) in run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:178:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/command.rb:153:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/runner.rb:428:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane_core-0.39.0/lib/fastlane_core/ui/fastlane_runner.rb:23:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.5/lib/commander/delegates.rb:15:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/bin/fastlane:156:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.66.0/bin/fastlane:162:in `<top (required)>'
    from /usr/local/bin/fastlane:23:in `load'
    from /usr/local/bin/fastlane:23:in `<main>'

So Swiftlint is doing it’s job, but then fastlane produce error. So could you explain how it’s not fastlane problem ?