Skip to content

Commit 0f6b4c2

Browse files
authored
Merge pull request #1715 from MessageKit/swiftlint
Fix iOS 13 depraction, fix Swiftlint and Danger on PRs
2 parents cf07a47 + 68dc85a commit 0f6b4c2

File tree

7 files changed

+91
-22
lines changed

7 files changed

+91
-22
lines changed

.github/workflows/danger.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,15 @@ on:
77
jobs:
88
danger:
99
name: Run Danger
10-
runs-on: ubuntu-latest
10+
runs-on: macos-latest
1111
steps:
1212
- name: Checkout the Git repository
1313
uses: actions/checkout@v2
1414
with:
15-
fetch-depth: 0
16-
# - name: Cache Gems
17-
# uses: actions/cache@v1
18-
# with:
19-
# path: vendor/bundle
20-
# key: ${{ runner.os }}-danger-${{ env.cache-name }}-gems-${{ hashFiles('**/Gemfile.lock') }}
21-
# restore-keys: |
22-
# ${{ runner.os }}-danger-${{ env.cache-name }}-gems-
23-
# ${{ runner.os }}-danger-${{ env.cache-name }}-
24-
# ${{ runner.os }}-danger-
25-
# - name: Run build script
26-
# run: gem install bundler && bundle install && bundle exec danger --fail-on-errors=true
27-
# env:
28-
# DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
fetch-depth: 100
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
ref: ${{ github.event.pull_request.head.ref }}
18+
- name: Run build script
19+
run: gem install bundler && bundle install && bundle exec danger --fail-on-errors=true
20+
env:
21+
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.swiftlint.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
disabled_rules:
2+
- trailing_whitespace
3+
- file_length
4+
- line_length
5+
- type_body_length
6+
- identifier_name
7+
- function_parameter_count
8+
- switch_case_alignment
9+
- orphaned_doc_comment
10+
- inclusive_language
11+
- multiple_closures_with_trailing_closure
12+
13+
opt_in_rules:
14+
- force_unwrapping
15+
- implicitly_unwrapped_optional
16+
- conditional_returns_on_newline
17+
- empty_count
18+
- empty_string
19+
- extension_access_modifier
20+
- closure_spacing
21+
- fatal_error_message
22+
- first_where
23+
- toggle_bool
24+
- unused_declaration
25+
- modifier_order
26+
- contains_over_first_not_nil
27+
- convenience_type
28+
- fallthrough
29+
- unused_import
30+
- unavailable_function
31+
- strict_fileprivate
32+
- explicit_init
33+
- anyobject_protocol
34+
- switch_case_on_newline
35+
- contains_over_range_nil_comparison
36+
- contains_over_filter_count
37+
- contains_over_filter_is_empty
38+
- empty_collection_literal
39+
- flatmap_over_map_reduce
40+
- no_space_in_method_call
41+
42+
excluded:
43+
- Tests
44+
- Vendor
45+
- Scripts
46+
- fastlane
47+
- "DerivedData/**/*"
48+
- "**/.build"
49+
- "**/Package.swift"
50+
51+
function_body_length: 120
52+
type_name:
53+
min_length: 3
54+
max_length: 60
55+
identifier_name:
56+
min_length: 3
57+
max_length: 60
58+
cyclomatic_complexity: 30
59+
large_tuple:
60+
warning: 4
61+
error: 5
62+
implicitly_unwrapped_optional:
63+
mode: all_except_iboutlets
64+
65+
colon:
66+
flexible_right_spacing: false
67+
apply_to_dictionaries: true

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ See [MIGRATION_GUIDE.md](https://github.com/MessageKit/MessageKit/blob/main/Docu
3737

3838
### Fixed
3939

40+
- Fixed iOS 13 deprecation warnings [#1715](https://github.com/MessageKit/MessageKit/pull/1715) by [@kaspik](https://github.com/Kaspik)
41+
4042
### Removed
4143

4244
- NSConstraintLayoutSet.swift [#1700](https://github.com/MessageKit/MessageKit/pull/1700) by [@martinpucik](https://github.com/martinpucik)

Dangerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# MIT License
33
#
4-
# Copyright (c) 2017-2020 MessageKit
4+
# Copyright (c) 2017-2022 MessageKit
55
#
66
# Permission is hereby granted, free of charge, to any person obtaining a copy
77
# of this software and associated documentation files (the "Software"), to deal
@@ -29,6 +29,11 @@ if mergeable_state == "draft"
2929
warn("PR is marked as Draft")
3030
end
3131

32+
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
33+
if github.pr_title.include? "[WIP]"
34+
warn("PR is marked as Work in Progress")
35+
end
36+
3237
# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title
3338
if github.pr_body.length < 5
3439
fail("Please provide a summary in the Pull Request description")
@@ -42,9 +47,9 @@ end
4247

4348
# Warn when there is a big PR
4449
if git.lines_of_code > 1000
45-
warn("Big Pull Request - Please consider splitting up your changes into smaller Pull Requests.")
50+
warn("Big Pull Request - Please consider splitting up your changes into smaller Pull Requests.")
4651
end
4752

4853
swiftlint.config_file = '.swiftlint.yml'
49-
swiftlint.binary_path = 'Example/Pods/SwiftLint/swiftlint'
54+
swiftlint.binary_path = 'bin/swiftlint'
5055
swiftlint.lint_files inline_mode:true, fail_on_error:true

Sources/Controllers/MessagesViewController+Menu.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ internal extension MessagesViewController {
5454
selectedIndexPathForMenu = nil
5555
}
5656

57-
currentMenuController.setMenuVisible(false, animated: false)
57+
currentMenuController.hideMenu()
5858

59-
guard let selectedCell = messagesCollectionView.cellForItem(at: selectedIndexPath) as? MessageContentCell else { return }
59+
guard let selectedCell = messagesCollectionView.cellForItem(at: selectedIndexPath) as? MessageContentCell else {
60+
return
61+
}
6062
let selectedCellMessageBubbleFrame = selectedCell.convert(selectedCell.messageContainerView.frame, to: view)
6163

6264
var messageInputBarFrame: CGRect = .zero
@@ -85,8 +87,7 @@ internal extension MessagesViewController {
8587
currentMenuController.arrowDirection = .up
8688
}
8789

88-
currentMenuController.setTargetRect(targetRect, in: view)
89-
currentMenuController.setMenuVisible(true, animated: true)
90+
currentMenuController.showMenu(from: view, rect: targetRect)
9091
}
9192

9293
// MARK: - Helpers

bin/swiftlint

27.6 MB
Binary file not shown.

bin/swiftlint.version.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.46.2 https://github.com/realm/SwiftLint/releases/tag/0.46.2

0 commit comments

Comments
 (0)