Skip to content

Commit 80a9697

Browse files
committed
Merge branch 'release/3.2.0' into versions
2 parents 083707d + 8f18695 commit 80a9697

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+677
-733
lines changed

.swiftlint.yml

+74-77
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# Basic Configuration
22
opt_in_rules:
3+
- anyobject_protocol
34
- array_init
45
- attributes
56
- closure_end_indentation
67
- closure_spacing
8+
- collection_alignment
79
- conditional_returns_on_newline
10+
- contains_over_filter_count
11+
- contains_over_filter_is_empty
812
- contains_over_first_not_nil
13+
- contains_over_range_nil_comparison
914
- convenience_type
15+
- empty_collection_literal
1016
- empty_count
1117
- empty_string
1218
- empty_xctest_method
@@ -16,65 +22,75 @@ opt_in_rules:
1622
- fatal_error_message
1723
- file_header
1824
- file_name
25+
- file_name_no_space
1926
- file_types_order
2027
- first_where
28+
- flatmap_over_map_reduce
2129
- function_default_parameter_at_end
30+
- identical_operands
31+
- implicit_return
2232
- implicitly_unwrapped_optional
23-
- is_disjoint
33+
- indentation_width
2434
- joined_default_parameter
35+
- last_where
36+
- legacy_multiple
37+
- legacy_random
2538
- let_var_whitespace
2639
- literal_expression_end_indentation
2740
- lower_acl_than_parent
2841
- missing_docs
2942
- modifier_order
3043
- multiline_arguments
3144
- multiline_arguments_brackets
32-
- multiline_function_chains
3345
- multiline_literal_brackets
3446
- multiline_parameters
3547
- multiline_parameters_brackets
36-
- nimble_operator
48+
- nslocalizedstring_key
3749
- number_separator
3850
- object_literal
3951
- operator_usage_whitespace
52+
- optional_enum_case_matching
4053
- overridden_super_call
4154
- override_in_extension
4255
- pattern_matching_keywords
56+
- prefer_self_type_over_type_of_self
4357
- private_action
4458
- private_outlet
4559
- prohibited_super_call
46-
- quick_discouraged_call
47-
- quick_discouraged_focused_test
48-
- quick_discouraged_pending_test
60+
- reduce_into
4961
- redundant_nil_coalescing
5062
- redundant_type_annotation
5163
- single_test_class
5264
- sorted_first_last
5365
- sorted_imports
66+
- static_operator
67+
- strong_iboutlet
5468
- switch_case_on_newline
69+
- toggle_bool
5570
- trailing_closure
5671
- type_contents_order
5772
- unavailable_function
5873
- unneeded_parentheses_in_closure_argument
5974
- untyped_error_in_catch
75+
- unused_declaration
76+
- unused_import
6077
- vertical_parameter_alignment_on_call
6178
- vertical_whitespace_between_cases
6279
- vertical_whitespace_closing_braces
6380
- vertical_whitespace_opening_braces
81+
- xct_specific_matcher
6482
- yoda_condition
6583

66-
disabled_rules:
67-
- force_cast
68-
- todo
69-
- type_name
70-
7184
included:
72-
- Frameworks
85+
- Sources
7386
- Tests
7487

7588
excluded:
7689
- Tests/LinuxMain.swift
7790

91+
disabled_rules:
92+
- todo
93+
7894
# Rule Configurations
7995
conditional_returns_on_newline:
8096
if_only: true
@@ -85,41 +101,28 @@ explicit_type_interface:
85101
- local
86102

87103
file_header:
88-
required_pattern: |
89-
\/\/
90-
\/\/ Created by [^\(\)\d\n]+ on \S{6,10}\.
91-
\/\/ Copyright © \d{4} Flinesoft\. All rights reserved\.
92-
\/\/
104+
required_pattern: \/\/ Copyright © \d{4} Flinesoft\. All rights reserved\.
93105

94106
file_name:
95-
suffix_pattern: "Extensions?|\\+.*"
96-
97-
file_types_order:
98-
order:
99-
- supporting_type
100-
- main_type
101-
- extension
107+
suffix_pattern: "Ext"
102108

103109
identifier_name:
110+
max_length: 60
104111
excluded:
105112
- id
113+
- db
114+
- to
106115

107116
line_length: 160
108117

109-
type_contents_order:
110-
order:
111-
- case
112-
- [type_alias, associated_type]
113-
- subtype
114-
- type_property
115-
- instance_property
116-
- ib_outlet
117-
- initializer
118-
- type_method
119-
- view_life_cycle_method
120-
- ib_action
121-
- other_method
122-
- subscript
118+
nesting:
119+
type_level: 3
120+
121+
trailing_comma:
122+
mandatory_comma: true
123+
124+
trailing_whitespace:
125+
ignores_comments: false
123126

124127
# Custom Rules
125128
custom_rules:
@@ -141,15 +144,9 @@ custom_rules:
141144
name: "Class Name Suffix View Controller"
142145
message: "All `ViewController` subclasses should end on `ViewController`."
143146
severity: warning
144-
closing_brace_whitespace:
145-
included: ".*.swift"
146-
regex: '(?:\n| {2,})\}\)? *\n *[^ \n\})\]s#"]'
147-
name: "Closing Brace Whitespace"
148-
message: "Empty line required after closing curly braces if code with same indentation follows."
149-
severity: warning
150147
closure_params_parantheses:
151148
included: ".*.swift"
152-
regex: '\{\s*\([^):]+\)\s*in'
149+
regex: '\{\s*\((?!self)[^):]+\)\s*in'
153150
name: "Unnecessary Closure Params Parantheses"
154151
message: "Don't use parantheses around non-typed parameters in a closure."
155152
severity: warning
@@ -173,9 +170,9 @@ custom_rules:
173170
severity: warning
174171
controller_class_name_suffix:
175172
included: ".*.swift"
176-
regex: 'class +\w+(?<!View|Flow)Controller'
173+
regex: 'class +\w+(?<!Navigation|View|Flow|Model)Controller'
177174
name: "Controller Class Name Suffix"
178-
message: "Only use the `Controller` class name suffix for ViewControllers or FlowControllers."
175+
message: "Only use the `Controller` class name suffix for Navigation-, View-, Model- or FlowControllers."
179176
severity: warning
180177
debug_log_level:
181178
included: ".*.swift"
@@ -195,6 +192,12 @@ custom_rules:
195192
name: "Empty Method"
196193
message: "Don't keep empty methods in code without commenting inside why they are needed or a `// TODO: not yet implemented`."
197194
severity: warning
195+
empty_todo:
196+
included: ".*.swift"
197+
regex: '\/\/ TODO: (\[[\d-]+\])? *\n'
198+
name: "Empty Todo"
199+
message: "`// TODO:` comments should not be empty."
200+
severity: warning
198201
empty_type:
199202
included: ".*.swift"
200203
regex: '(?:class|protocol|struct|enum) [^\{]+\{\s*\}'
@@ -249,6 +252,18 @@ custom_rules:
249252
name: "Logging Prefix"
250253
message: "Don't use logging prefixes with log.verbose/debug/info/warning/error – done automatically."
251254
severity: warning
255+
multiline_guard_end:
256+
included: ".*.swift"
257+
regex: 'guard\s*([^\n]*,\n)+([^\n]*\S *)else\s*\{'
258+
name: "Multiline Guard End"
259+
message: "Always close a multiline guard via `else {` on a new line indented like the opening `guard`."
260+
severity: warning
261+
multiline_guard_start:
262+
included: ".*.swift"
263+
regex: 'guard([^\n]*,\n)+[^\n]*else\s*\{'
264+
name: "Multiline Guard Start"
265+
message: "Always start a multiline guard via `guard` then a line break and all expressions indented."
266+
severity: warning
252267
multiple_closure_params:
253268
included: ".*.swift"
254269
regex: '\n *(?:[^\.\n=]+\.)+[^\(\s]+\([^\{\n]+\{[^\}\n]+\}\)\s*\{'
@@ -261,30 +276,12 @@ custom_rules:
261276
name: "Non Case Enum"
262277
message: "Do not call enum cases `none` as you might run into problems with Optionals of this type."
263278
severity: warning
264-
quick_temporary_disabling:
265-
included: ".*.swift"
266-
regex: '\sxdescribe\(|\sxcontext\(|\sxit\('
267-
name: "Quick Temporary Disabling"
268-
message: "Temporary disabled Quick examples or groups shouldn't be commited."
269-
severity: warning
270-
quick_temporary_focus:
271-
included: ".*.swift"
272-
regex: '\sfdescribe\(|\sfcontext\(|\sfit\('
273-
name: "Quick Temporary Focus"
274-
message: "Temporary focused Quick examples or groups shouldn't be commited."
275-
severity: warning
276279
remove_where_for_negative_filtering:
277280
included: ".*.swift"
278281
regex: '\.filter *\{ *!\$0\.[^\}&|]+\}'
279282
name: "Remove Where for Negative Filtering"
280283
message: "Use `remove(where:)` instead of `filter(where not ...)` for performance."
281284
severity: warning
282-
single_line_enum_cases:
283-
included: ".*.swift"
284-
regex: 'enum [^\{]+\{\s*(?:\s*\/\/[^\n]*)*\s*case\s+[^,(\n]+,'
285-
name: "Single Line Enum Cases"
286-
message: "Use a new line for each enum case."
287-
severity: warning
288285
single_line_guard:
289286
included: ".*.swift"
290287
regex: 'guard[^\{]{2,80}else\s*\{\s*\n\s*return.{2,40}\}'
@@ -321,23 +318,23 @@ custom_rules:
321318
name: "Switch Associated Value Style"
322319
message: "Always put the `let` in front of case – even if only one associated value captured."
323320
severity: warning
324-
toggle_bool:
321+
todo_format:
325322
included: ".*.swift"
326-
regex: '(?<=\n)[ \t]*(?<VAR>\w+) *= *!\k<VAR>(?=\s)'
327-
name: "Toggle Bool"
328-
message: "Use `toggle()` instead of toggling manually."
323+
regex: '\/\/ TODO: [^\n]{0,14}\n|\/\/ TODO: \[\S{1,12}\]|\/\/ TODO: [^\[]|\/\/ TODO: \[.{13}[^\]]|\/\/ TODO: \[[^a-z]{2}|\/\/ TODO: \[.{2}[^_]|\/\/ TODO: \[.{7}[^-]|\/\/ TODO: \[.{10}[^-]'
324+
name: "Todo Date"
325+
message: "All TODOs should have a format with creator credentials & date of their creation documented like this: `// TODO: [cg_YYYY-MM-DD] `."
329326
severity: warning
330-
too_much_indentation:
327+
todo_uppercase:
331328
included: ".*.swift"
332-
regex: '\n {0}[^\s\/][^\n]*[^,|&]\n+ {5,}\S|\n {4}[^\s\/][^\n]*[^,|&]\n+ {9,}\S|\n {8}[^\s\/][^\n]*[^,|&]\n+ {13,}\S|\n {12}[^\s\/][^\n]*[^,|&]\n+ {17,}\S|\n {16}[^\s\/][^\n]*[^,|&]\n+ {21,}\S|\n {20}[^\s\/][^\n]*[^,|&]\n+ {25,}\S'
333-
name: "Too Much Indentation"
334-
message: "Don't indent code by more than 4 whitespaces."
329+
regex: '\/\/ ?tODO|\/\/ ?ToDO|\/\/ ?TOdO|\/\/ ?TODo|\/\/ ?todo|\/\/ ?Todo|\/\/ ?ToDo|\/\/ ?toDo'
330+
name: "Todo Uppercase"
331+
message: "All TODOs should be all-uppercased like this: `// TODO: [cg_YYYY-MM-DD] `."
335332
severity: warning
336-
too_much_unindentation:
333+
todo_whitespacing:
337334
included: ".*.swift"
338-
regex: ' {28}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,23}[^\s\/]| {24}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,19}[^\s\/]| {20}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,15}[^\s\/]| {16}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,11}[^\s\/]| {12}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,7}[^\s\/]| {8}[^\s\.](.|[^\n]*[^\)][^\ ][^\}])\n+ {0,3}[^\s\/]'
339-
name: "Too Much Unindentation"
340-
message: "Don't unindent code by more than 4 whitespaces."
335+
regex: '\/\/TODO|\/\/ TODO\s|\/\/ TODO:[^ ]|\/\/ TODO: |\/\/ TODO: \[[^\s]{0,10}\][^ ]'
336+
name: "Todo Whitespace"
337+
message: "All TODOs should exactly start like this (mind the whitespacing): `// TODO: [cg_YYYY-MM-DD] `."
341338
severity: warning
342339
tuple_index:
343340
included: ".*.swift"

CHANGELOG.md

+25-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
5+
6+
<details>
7+
<summary>Formatting Rules for Entries</summary>
8+
Each entry should use the following format:
9+
10+
```markdown
11+
- Summary of what was changed in a single line using past tense & followed by two whitespaces.
12+
Issue: [#0](https://github.com/Flinesoft/HandySwift/issues/0) | PR: [#0](https://github.com/Flinesoft/HandySwift/pull/0) | Author: [Cihat Gündüz](https://github.com/Jeehut)
13+
```
14+
15+
Note that at the end of the summary line, you need to add two whitespaces (` `) for correct rendering on GitHub.
16+
17+
If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries separated by `, `. Also, remove entries not needed in the second line.
18+
</details>
519

620
## [Unreleased]
721
### Added
@@ -17,6 +31,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1731
### Security
1832
- None.
1933

34+
## [3.2.0] - 2020-03-27
35+
### Added
36+
- New `DivisibleArithmetic` protocol which easily extends `average()` to Collections of `Double`, `Float` and `CGFloat`.
37+
Issue: [#36](https://github.com/Flinesoft/HandySwift/issues/36) | PR: [#38](https://github.com/Flinesoft/HandySwift/pull/38) | Author: [David Knothe](https://github.com/knothed)
38+
- Make most of the API `@inlinable` for increased real-time performance.
39+
Issue: [#40](https://github.com/Flinesoft/HandySwift/issues/40) | PR: [#43](https://github.com/Flinesoft/HandySwift/pull/43) | Author: [David Knothe](https://github.com/knothed)
40+
### Changed
41+
- Allow `Int.init?(randomBelow:)` to use an arbitrary RandomNumberGenerator (instead of just the system one).
42+
PR: [#44](https://github.com/Flinesoft/HandySwift/pull/44) | Author: [David Knothe](https://github.com/knothed)
43+
2044
## [3.1.0] - 2019-09-01
2145
### Added
2246
- New `Comparable.clamped(to:)` and `Comparable.clamp(to:)` interfaces for any `Comparable`, e. g. `Int`.
@@ -26,15 +50,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
2650
- New `Withable` protocol to init/copy objects and set properties in a convenient way on a single line.
2751
### Changed
2852
- Upgraded to Swift 5 & Xcode 10.2.
29-
### Deprecated
30-
- None.
3153
### Removed
3254
- Remove `ExpressibleByStringLiteral` conformance of `Regex` type to only allow initialization via `init(_:options:) throws` interface.
33-
### Fixed
34-
- None.
35-
### Security
36-
- None.
37-
3855

3956
## [2.8.0] - 2019-02-11
4057
### Added
@@ -44,14 +61,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
4461
- New `fullRange` and `fullNSRange` computed properties on `String`
4562
### Changed
4663
- Made some APIs available in wider contexts (like `sample` in `RandomAccessCollection` instead of `Array`)
47-
### Deprecated
48-
- None.
49-
### Removed
50-
- None.
51-
### Fixed
52-
- None.
53-
### Security
54-
- None.
5564

5665
## [2.7.0] - 2018-09-27
5766
### Added

CONTRIBUTING.md

-31
This file was deleted.

0 commit comments

Comments
 (0)