Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/1.9.2' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed May 7, 2020
2 parents 9b56780 + 954a67b commit 630ad7b
Show file tree
Hide file tree
Showing 31 changed files with 341 additions and 286 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ Carthage/Build
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/test_output

.DS_Store
1 change: 0 additions & 1 deletion .jamithub/projconf.json

This file was deleted.

147 changes: 73 additions & 74 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,66 +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
- no_extension_access_modifier
- 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
- Tests

excluded:
- Tests/LinuxMain.swift

disabled_rules:
- todo

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

file_header:
required_pattern: \/\/ Created by [^\(\)\d\n]+ on \S{6,10}\.
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
- ib_inspectable
- 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 @@ -139,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 @@ -171,9 +170,9 @@ custom_rules:
severity: warning
controller_class_name_suffix:
included: ".*.swift"
regex: 'class +\w+(?<!View|Flow|Model|Presentation)Controller'
regex: 'class +\w+(?<!Navigation|View|Flow|Model)Controller'
name: "Controller Class Name Suffix"
message: "Only use the `Controller` class name suffix for View-, Flow-, Model- and PresentationControllers."
message: "Only use the `Controller` class name suffix for Navigation-, View-, Model- or FlowControllers."
severity: warning
debug_log_level:
included: ".*.swift"
Expand All @@ -193,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 @@ -247,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 @@ -259,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 @@ -319,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
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion 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://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog](http://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,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
### Security
- None.

## [1.9.2] - 2020-05-07
### Added
- Made `cornerRadius` and `IBDesignable`s available for override.
### Changed
- Updated code to Xcode 11.4 & Swift 5.

## [1.9.0] - 2019-02-11
### Added
Expand Down
3 changes: 1 addition & 2 deletions Frameworks/HandyUIKit/ColorSpaces.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Created by Tim Wood on 10/9/15.
// Copyright © 2015 Flinesoft. All rights reserved.
//
// Original source: https://github.com/timrwood/ColorSpaces
//

// swiftlint:disable all

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Created by Cihat Gündüz on 31.10.18.
// Copyright © 2018 Flinesoft. All rights reserved.

import UIKit

extension CGPoint {
/// Returns a new CGPoint object with the x and y converted to true pixels on the main screen.
public var inPixels: CGPoint { return inPixels(.main) }
public var inPixels: CGPoint { inPixels(.main) }

/// Returns a new CGPoint object with the x and y converted to true pixels on the given screen.
///
/// - Parameters:
/// - screen: The target screen to convert to pixels for.
public func inPixels(_ screen: UIScreen) -> CGPoint {
return CGPoint(x: x * screen.scale, y: y * screen.scale)
CGPoint(x: x * screen.scale, y: y * screen.scale)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Created by Cihat Gündüz on 31.10.18.
// Copyright © 2018 Flinesoft. All rights reserved.

import UIKit

extension CGRect {
/// Returns a new CGRect object with the origin and size converted to true pixels on the main screen.
public var inPixels: CGRect { return inPixels(.main) }
public var inPixels: CGRect { inPixels(.main) }

/// Creates a new CGRect object from origin zero with given size.
///
Expand All @@ -26,6 +26,6 @@ extension CGRect {
/// - Parameters:
/// - screen: The target screen to convert to pixels for.
public func inPixels(_ screen: UIScreen) -> CGRect {
return CGRect(origin: origin.inPixels(screen), size: size.inPixels(screen))
CGRect(origin: origin.inPixels(screen), size: size.inPixels(screen))
}
}
Loading

0 comments on commit 630ad7b

Please sign in to comment.