Skip to content

Commit

Permalink
Merge branch 'release/3.2.0' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Mar 27, 2020
2 parents 083707d + 8f18695 commit 80a9697
Show file tree
Hide file tree
Showing 44 changed files with 677 additions and 733 deletions.
151 changes: 74 additions & 77 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Basic Configuration
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- conditional_returns_on_newline
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- convenience_type
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
Expand All @@ -16,65 +22,75 @@ opt_in_rules:
- fatal_error_message
- file_header
- file_name
- file_name_no_space
- file_types_order
- first_where
- flatmap_over_map_reduce
- function_default_parameter_at_end
- identical_operands
- implicit_return
- implicitly_unwrapped_optional
- is_disjoint
- indentation_width
- joined_default_parameter
- last_where
- legacy_multiple
- legacy_random
- let_var_whitespace
- literal_expression_end_indentation
- lower_acl_than_parent
- missing_docs
- modifier_order
- multiline_arguments
- multiline_arguments_brackets
- multiline_function_chains
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- nimble_operator
- nslocalizedstring_key
- number_separator
- object_literal
- operator_usage_whitespace
- optional_enum_case_matching
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- prefer_self_type_over_type_of_self
- private_action
- private_outlet
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
- single_test_class
- sorted_first_last
- sorted_imports
- static_operator
- strong_iboutlet
- switch_case_on_newline
- toggle_bool
- trailing_closure
- type_contents_order
- unavailable_function
- unneeded_parentheses_in_closure_argument
- untyped_error_in_catch
- unused_declaration
- unused_import
- vertical_parameter_alignment_on_call
- vertical_whitespace_between_cases
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- xct_specific_matcher
- yoda_condition

disabled_rules:
- force_cast
- todo
- type_name

included:
- Frameworks
- Sources
- Tests

excluded:
- Tests/LinuxMain.swift

disabled_rules:
- todo

# Rule Configurations
conditional_returns_on_newline:
if_only: true
Expand All @@ -85,41 +101,28 @@ explicit_type_interface:
- local

file_header:
required_pattern: |
\/\/
\/\/ Created by [^\(\)\d\n]+ on \S{6,10}\.
\/\/ Copyright © \d{4} Flinesoft\. All rights reserved\.
\/\/
required_pattern: \/\/ Copyright © \d{4} Flinesoft\. All rights reserved\.

file_name:
suffix_pattern: "Extensions?|\\+.*"

file_types_order:
order:
- supporting_type
- main_type
- extension
suffix_pattern: "Ext"

identifier_name:
max_length: 60
excluded:
- id
- db
- to

line_length: 160

type_contents_order:
order:
- case
- [type_alias, associated_type]
- subtype
- type_property
- instance_property
- ib_outlet
- initializer
- type_method
- view_life_cycle_method
- ib_action
- other_method
- subscript
nesting:
type_level: 3

trailing_comma:
mandatory_comma: true

trailing_whitespace:
ignores_comments: false

# Custom Rules
custom_rules:
Expand All @@ -141,15 +144,9 @@ custom_rules:
name: "Class Name Suffix View Controller"
message: "All `ViewController` subclasses should end on `ViewController`."
severity: warning
closing_brace_whitespace:
included: ".*.swift"
regex: '(?:\n| {2,})\}\)? *\n *[^ \n\})\]s#"]'
name: "Closing Brace Whitespace"
message: "Empty line required after closing curly braces if code with same indentation follows."
severity: warning
closure_params_parantheses:
included: ".*.swift"
regex: '\{\s*\([^):]+\)\s*in'
regex: '\{\s*\((?!self)[^):]+\)\s*in'
name: "Unnecessary Closure Params Parantheses"
message: "Don't use parantheses around non-typed parameters in a closure."
severity: warning
Expand All @@ -173,9 +170,9 @@ custom_rules:
severity: warning
controller_class_name_suffix:
included: ".*.swift"
regex: 'class +\w+(?<!View|Flow)Controller'
regex: 'class +\w+(?<!Navigation|View|Flow|Model)Controller'
name: "Controller Class Name Suffix"
message: "Only use the `Controller` class name suffix for ViewControllers or FlowControllers."
message: "Only use the `Controller` class name suffix for Navigation-, View-, Model- or FlowControllers."
severity: warning
debug_log_level:
included: ".*.swift"
Expand All @@ -195,6 +192,12 @@ custom_rules:
name: "Empty Method"
message: "Don't keep empty methods in code without commenting inside why they are needed or a `// TODO: not yet implemented`."
severity: warning
empty_todo:
included: ".*.swift"
regex: '\/\/ TODO: (\[[\d-]+\])? *\n'
name: "Empty Todo"
message: "`// TODO:` comments should not be empty."
severity: warning
empty_type:
included: ".*.swift"
regex: '(?:class|protocol|struct|enum) [^\{]+\{\s*\}'
Expand Down Expand Up @@ -249,6 +252,18 @@ custom_rules:
name: "Logging Prefix"
message: "Don't use logging prefixes with log.verbose/debug/info/warning/error – done automatically."
severity: warning
multiline_guard_end:
included: ".*.swift"
regex: 'guard\s*([^\n]*,\n)+([^\n]*\S *)else\s*\{'
name: "Multiline Guard End"
message: "Always close a multiline guard via `else {` on a new line indented like the opening `guard`."
severity: warning
multiline_guard_start:
included: ".*.swift"
regex: 'guard([^\n]*,\n)+[^\n]*else\s*\{'
name: "Multiline Guard Start"
message: "Always start a multiline guard via `guard` then a line break and all expressions indented."
severity: warning
multiple_closure_params:
included: ".*.swift"
regex: '\n *(?:[^\.\n=]+\.)+[^\(\s]+\([^\{\n]+\{[^\}\n]+\}\)\s*\{'
Expand All @@ -261,30 +276,12 @@ custom_rules:
name: "Non Case Enum"
message: "Do not call enum cases `none` as you might run into problems with Optionals of this type."
severity: warning
quick_temporary_disabling:
included: ".*.swift"
regex: '\sxdescribe\(|\sxcontext\(|\sxit\('
name: "Quick Temporary Disabling"
message: "Temporary disabled Quick examples or groups shouldn't be commited."
severity: warning
quick_temporary_focus:
included: ".*.swift"
regex: '\sfdescribe\(|\sfcontext\(|\sfit\('
name: "Quick Temporary Focus"
message: "Temporary focused Quick examples or groups shouldn't be commited."
severity: warning
remove_where_for_negative_filtering:
included: ".*.swift"
regex: '\.filter *\{ *!\$0\.[^\}&|]+\}'
name: "Remove Where for Negative Filtering"
message: "Use `remove(where:)` instead of `filter(where not ...)` for performance."
severity: warning
single_line_enum_cases:
included: ".*.swift"
regex: 'enum [^\{]+\{\s*(?:\s*\/\/[^\n]*)*\s*case\s+[^,(\n]+,'
name: "Single Line Enum Cases"
message: "Use a new line for each enum case."
severity: warning
single_line_guard:
included: ".*.swift"
regex: 'guard[^\{]{2,80}else\s*\{\s*\n\s*return.{2,40}\}'
Expand Down Expand Up @@ -321,23 +318,23 @@ custom_rules:
name: "Switch Associated Value Style"
message: "Always put the `let` in front of case – even if only one associated value captured."
severity: warning
toggle_bool:
todo_format:
included: ".*.swift"
regex: '(?<=\n)[ \t]*(?<VAR>\w+) *= *!\k<VAR>(?=\s)'
name: "Toggle Bool"
message: "Use `toggle()` instead of toggling manually."
regex: '\/\/ TODO: [^\n]{0,14}\n|\/\/ TODO: \[\S{1,12}\]|\/\/ TODO: [^\[]|\/\/ TODO: \[.{13}[^\]]|\/\/ TODO: \[[^a-z]{2}|\/\/ TODO: \[.{2}[^_]|\/\/ TODO: \[.{7}[^-]|\/\/ TODO: \[.{10}[^-]'
name: "Todo Date"
message: "All TODOs should have a format with creator credentials & date of their creation documented like this: `// TODO: [cg_YYYY-MM-DD] `."
severity: warning
too_much_indentation:
todo_uppercase:
included: ".*.swift"
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'
name: "Too Much Indentation"
message: "Don't indent code by more than 4 whitespaces."
regex: '\/\/ ?tODO|\/\/ ?ToDO|\/\/ ?TOdO|\/\/ ?TODo|\/\/ ?todo|\/\/ ?Todo|\/\/ ?ToDo|\/\/ ?toDo'
name: "Todo Uppercase"
message: "All TODOs should be all-uppercased like this: `// TODO: [cg_YYYY-MM-DD] `."
severity: warning
too_much_unindentation:
todo_whitespacing:
included: ".*.swift"
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\/]'
name: "Too Much Unindentation"
message: "Don't unindent code by more than 4 whitespaces."
regex: '\/\/TODO|\/\/ TODO\s|\/\/ TODO:[^ ]|\/\/ TODO: |\/\/ TODO: \[[^\s]{0,10}\][^ ]'
name: "Todo Whitespace"
message: "All TODOs should exactly start like this (mind the whitespacing): `// TODO: [cg_YYYY-MM-DD] `."
severity: warning
tuple_index:
included: ".*.swift"
Expand Down
41 changes: 25 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http:https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http:https://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog](http:https://keepachangelog.com/en/1.0.0/).

<details>
<summary>Formatting Rules for Entries</summary>
Each entry should use the following format:

```markdown
- Summary of what was changed in a single line using past tense & followed by two whitespaces.
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)
```

Note that at the end of the summary line, you need to add two whitespaces (` `) for correct rendering on GitHub.

If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries separated by `, `. Also, remove entries not needed in the second line.
</details>

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

## [3.2.0] - 2020-03-27
### Added
- New `DivisibleArithmetic` protocol which easily extends `average()` to Collections of `Double`, `Float` and `CGFloat`.
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)
- Make most of the API `@inlinable` for increased real-time performance.
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)
### Changed
- Allow `Int.init?(randomBelow:)` to use an arbitrary RandomNumberGenerator (instead of just the system one).
PR: [#44](https://github.com/Flinesoft/HandySwift/pull/44) | Author: [David Knothe](https://github.com/knothed)

## [3.1.0] - 2019-09-01
### Added
- New `Comparable.clamped(to:)` and `Comparable.clamp(to:)` interfaces for any `Comparable`, e. g. `Int`.
Expand All @@ -26,15 +50,8 @@ The format is based on [Keep a Changelog](http:https://keepachangelog.com/en/1.0.0/) a
- New `Withable` protocol to init/copy objects and set properties in a convenient way on a single line.
### Changed
- Upgraded to Swift 5 & Xcode 10.2.
### Deprecated
- None.
### Removed
- Remove `ExpressibleByStringLiteral` conformance of `Regex` type to only allow initialization via `init(_:options:) throws` interface.
### Fixed
- None.
### Security
- None.


## [2.8.0] - 2019-02-11
### Added
Expand All @@ -44,14 +61,6 @@ The format is based on [Keep a Changelog](http:https://keepachangelog.com/en/1.0.0/) a
- New `fullRange` and `fullNSRange` computed properties on `String`
### Changed
- Made some APIs available in wider contexts (like `sample` in `RandomAccessCollection` instead of `Array`)
### Deprecated
- None.
### Removed
- None.
### Fixed
- None.
### Security
- None.

## [2.7.0] - 2018-09-27
### Added
Expand Down
31 changes: 0 additions & 31 deletions CONTRIBUTING.md

This file was deleted.

Loading

0 comments on commit 80a9697

Please sign in to comment.