Skip to content

Commit

Permalink
[actions] Fix fastlane action template warnings reported by Rubocop (#…
Browse files Browse the repository at this point in the history
…21310)

* Fix Style/StringLiterals RuboCap warning

More information about warning:
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/StringLiterals

* Fix indentation of template Action, reported by Rubocop

https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/IndentationWidth

* Fix Layout/LineLength: Line is too long, reported by Rubocop

More information:
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/LineLength

* Fix Style/MethodCallWithArgsParentheses reported by Rubocop

* Fix Style/ParenthesesAroundCondition, Style/AndOr and Style/Not

Fixes:
* Style/ParenthesesAroundCondition: Don't use parentheses around the condition of an unless.
* Style/AndOr: Use && instead of and.
* Style/Not: Use ! instead of not.
  • Loading branch information
bartoszkosiorek committed Jul 4, 2023
1 parent 4635534 commit e70b3d1
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions fastlane/lib/assets/custom_action_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module SharedValues
class [[NAME_CLASS]] < Action
def self.run(params)
# fastlane will take care of reading in the parameter and fetching the environment variable:
UI.message "Parameter API Token: #{params[:api_token]}"
UI.message("Parameter API Token: #{params[:api_token]}")

# sh "shellcommand ./path"

Expand All @@ -19,13 +19,13 @@ def self.run(params)
#####################################################

def self.description
"A short description with <= 80 characters of what this action does"
'A short description with <= 80 characters of what this action does'
end

def self.details
# Optional:
# this is your chance to provide a more detailed description of this action
"You can use this action to do cool things..."
'You can use this action to do cool things...'
end

def self.available_options
Expand All @@ -34,17 +34,23 @@ def self.available_options
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :api_token,
env_name: "FL_[[NAME_UP]]_API_TOKEN", # The name of the environment variable
description: "API Token for [[NAME_CLASS]]", # a short description of this parameter
# The name of the environment variable
env_name: 'FL_[[NAME_UP]]_API_TOKEN',
# a short description of this parameter
description: 'API Token for [[NAME_CLASS]]',
verify_block: proc do |value|
UI.user_error!("No API token for [[NAME_CLASS]] given, pass using `api_token: 'token'`") unless (value and not value.empty?)
# UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
unless value && !value.empty?
UI.user_error!("No API token for [[NAME_CLASS]] given, pass using `api_token: 'token'`")
end
# UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
end),
FastlaneCore::ConfigItem.new(key: :development,
env_name: "FL_[[NAME_UP]]_DEVELOPMENT",
description: "Create a development certificate instead of a distribution one",
is_string: false, # true: verifies the input is a string, false: every kind of value
default_value: false) # the default value if the user didn't provide one
env_name: 'FL_[[NAME_UP]]_DEVELOPMENT',
description: 'Create a development certificate instead of a distribution one',
# true: verifies the input is a string, false: every kind of value
is_string: false,
# the default value if the user didn't provide one
default_value: false)
]
end

Expand All @@ -62,7 +68,7 @@ def self.return_value

def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
["Your GitHub/Twitter Name"]
['Your GitHub/Twitter Name']
end

def self.is_supported?(platform)
Expand Down

0 comments on commit e70b3d1

Please sign in to comment.