Skip to content

Commit

Permalink
Fix format by rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
ainame committed Apr 10, 2021
1 parent 62ab41f commit 81449b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions fastlane/lib/fastlane/notification/slack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Slack
def initialize(webhook_url)
@webhook_url = webhook_url
@client = Faraday.new do |conn|
conn.use Faraday::Response::RaiseError
conn.use(Faraday::Response::RaiseError)
end
end

Expand All @@ -19,7 +19,7 @@ def post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_name
username: username,
icon_url: icon_url,
attachments: attachments,
link_names: link_names,
link_names: link_names
}.to_json
end
end
Expand All @@ -28,7 +28,7 @@ def post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_name
# https://github.com/stevenosloan/slack-notifier/blob/4bf6582663dc9e5070afe3fdc42d67c14a513354/lib/slack-notifier/util/link_formatter.rb
class LinkConverter
HTML_PATTERN = %r{<a.*?href=['"](?<link>#{URI.regexp})['"].*?>(?<label>.+?)<\/a>}
MARKDOWN_PATTERN = %r{\[(?<label>[^\[\]]*?)\]\((?<link>#{URI.regexp}|mailto:#{URI::MailTo::EMAIL_REGEXP})\)}
MARKDOWN_PATTERN = /\[(?<label>[^\[\]]*?)\]\((?<link>#{URI.regexp}|mailto:#{URI::MailTo::EMAIL_REGEXP})\)/

def self.convert(string)
convert_markdown_to_slack_link(convert_html_to_slack_link(string.scrub))
Expand Down
4 changes: 2 additions & 2 deletions fastlane/spec/notification/slack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%|Hello <a href="https://fastlane.tools">fastlane</a>| => 'Hello <https://fastlane.tools|fastlane>',
%|Hello <a href='https://fastlane.tools'>fastlane</a>| => 'Hello <https://fastlane.tools|fastlane>',
%|Hello <a id="foo" href="https://fastlane.tools">fastlane</a>| => 'Hello <https://fastlane.tools|fastlane>',
%|Hello <a href="https://fastlane.tools">fastlane</a> <a href="https://github.com/fastlane">GitHub</a>| => 'Hello <https://fastlane.tools|fastlane> <https://github.com/fastlane|GitHub>',
%|Hello <a href="https://fastlane.tools">fastlane</a> <a href="https://github.com/fastlane">GitHub</a>| => 'Hello <https://fastlane.tools|fastlane> <https://github.com/fastlane|GitHub>'
}.each do |input, output|
expect(described_class.convert(input)).to eq(output)
end
Expand All @@ -19,7 +19,7 @@
%|Hello [[fastlane](https://fastlane.tools) in brackets]| => 'Hello [<https://fastlane.tools|fastlane> in brackets]',
%|Hello [](https://fastlane.tools)| => 'Hello <https://fastlane.tools>',
%|Hello ([fastlane](https://fastlane.tools) in parens)| => 'Hello (<https://fastlane.tools|fastlane> in parens)',
%|Hello ([fastlane(:rocket:)](https://fastlane.tools) in parens)| => 'Hello (<https://fastlane.tools|fastlane(:rocket:)> in parens)',
%|Hello ([fastlane(:rocket:)](https://fastlane.tools) in parens)| => 'Hello (<https://fastlane.tools|fastlane(:rocket:)> in parens)'
}.each do |input, output|
expect(described_class.convert(input)).to eq(output)
end
Expand Down

0 comments on commit 81449b1

Please sign in to comment.