Sha256: 709268e3917b9a99944e59b771d4ff5810c06a7d341f8ec563a83d1f5bb8ac24

Contents?: true

Size: 1.78 KB

Versions: 4

Compression:

Stored size: 1.78 KB

Contents

module Fastlane
  module Actions
    class SwiftlintAction < Action
      def self.run(params)
        if `which swiftlint`.to_s.length == 0 and !Helper.test?
          raise "You have to install swiftlint using `brew install swiftlint`".red
        end

        command = 'swiftlint lint'
        command << " --strict" if params[:strict]
        command << " --config #{params[:config_file]}" if params[:config_file]
        command << " > #{params[:output_file]}" if params[:output_file]
        Actions.sh(command)
      end

      #####################################################
      # @!group Documentation
      #####################################################

      def self.description
        "Run swift code validation using SwiftLint"
      end

      def self.details
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :output_file,
                                       description: 'Path to output SwiftLint result',
                                       optional: true),
          FastlaneCore::ConfigItem.new(key: :config_file,
                                       description: 'Custom configuration file of SwiftLint',
                                       optional: true),
          FastlaneCore::ConfigItem.new(key: :strict,
                                       description: 'Fail on warnings? (true/false)',
                                       default_value: false,
                                       is_string: false,
                                       optional: true)
        ]
      end

      def self.output
      end

      def self.return_value
      end

      def self.authors
        ["KrauseFx"]
      end

      def self.is_supported?(platform)
        [:ios, :mac].include?(platform)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fastlane-1.53.0 lib/fastlane/actions/swiftlint.rb
fastlane-1.52.0 lib/fastlane/actions/swiftlint.rb
fastlane-1.51.0 lib/fastlane/actions/swiftlint.rb
fastlane-1.50.0 lib/fastlane/actions/swiftlint.rb