Commit Graph

1913 Commits

Author SHA1 Message Date
JP Simard b11adfe6ba compactMap 2018-04-08 10:55:58 -07:00
JP Simard ec7f643475 Run 'make sourcery' 2018-04-08 10:48:27 -07:00
JP Simard 7070c3beac Merge pull request #2136 from realm/ks/lower-acl
Add LowerACLThanBodyRule
2018-04-08 10:44:44 -07:00
JP Simard cf59e0c771 Merge pull request #2038 from realm/nn-swift-4.1
Support building with Swift 4.1
2018-04-08 10:28:51 -07:00
Norio Nomura 133cef8df1 ObjCBool is no longer implicitly converted to Bool on Linux 2018-04-08 13:28:09 +09:00
Norio Nomura 2a0ac455bc 'flatMap' is deprecated: renamed to 'compactMap(_:)' 2018-04-08 13:28:09 +09:00
Norio Nomura 7d0f239e2a Update dependencies
- Update SourceKitten from 0.19.1 to 0.20.0
- Update SWXMLHash from 4.3.6 to 4.6.0
- Update Yams from 0.5.0 to 0.7.0
2018-04-08 13:28:08 +09:00
Marcelo Fabri d4321762a5 Fix false positives in attributes rule with Swift 4.1
Fixes #2125 and #2141
2018-04-06 16:50:09 -07:00
Norio Nomura 2ab42cdec1 Fix typo 2018-04-05 11:17:35 +09:00
Norio Nomura c592538856 Add 4.1.0, 4.1.1 and 4.2.0 to Swift version detection 2018-04-05 10:29:54 +09:00
Keith Smiley 925fb26d83 Add LowerACLThanBodyRule
This new rule validates that if a type/function/variable definition has
an ACL specifier, it is more restrictive than the containing body's
level. This is intended to lint a peculiarity of SE-0025 where it is
stated:

> The compiler should not warn when a broader level of access control is
used within a type with more restrictive access, such as internal within
a private type. This allows the designer of the type to select the
access they would use were they to make the type more widely accessible.

I think this is an anti-goal because when a type is made more open, it
should be a concious decision at that time to make it public. This is of
course an opt-in rule as well. This also has the added benefit of
linting this compiler bug: https://bugs.swift.org/browse/SR-2925
2018-04-04 10:16:12 -07:00
Nealon Young 3842854fd7 Add UIOffsetMake to legacy_constructor rule 2018-04-01 23:26:12 -07:00
Twig b296e494ad Fixed severity and description parameters 2018-03-29 13:47:05 -04:00
John Szumski 28989be7ee Fix redundant_void_return rule autocorrect when preprocessor macros are present.
Fixes #2115
2018-03-27 20:41:24 -04:00
John Szumski 04666f1ae4 Fixed typo. 2018-03-27 20:31:39 -04:00
Marcelo Fabri 0982045346 Merge pull request #2001 from ornithocoder/optional_collection
Adds opt-in rule discouraged_optional_collection
2018-03-27 08:09:31 -07:00
Marcelo Fabri d8749f9acb Fix autocorrection for several rules 2018-03-26 22:46:46 -07:00
Marcelo Fabri 8f56ce9d11 Fix empty_enum_arguments rule autocorrection 2018-03-26 21:53:00 -07:00
Ornithologist Coder 3e5f7c5523 Simplifies guard logic 2018-03-26 00:26:14 +02:00
Ornithologist Coder 61e79976d5 Renames method 2018-03-26 00:26:14 +02:00
Ornithologist Coder 15a521ae17 Adds mathematical intervals (w/ lower and upper bounds) 2018-03-26 00:26:14 +02:00
Ornithologist Coder dcdd50a973 Fixes typo in documentation 2018-03-26 00:26:14 +02:00
Ornithologist Coder ac149d296e Adds examples to String extension 2018-03-26 00:26:14 +02:00
Ornithologist Coder 5c201149ad Simplifies guard statements 2018-03-26 00:26:14 +02:00
Ornithologist Coder 53b0fff155 Adds more examples 2018-03-26 00:26:14 +02:00
Ornithologist Coder 16085d3ebb Returns the Range of the entire optional collection 2018-03-26 00:26:14 +02:00
Ornithologist Coder 6056b3e734 Moves examples to own file
and adds more examples.
2018-03-26 00:26:14 +02:00
Ornithologist Coder 190a39aadc Uses AST instead of regular expressions 2018-03-26 00:26:13 +02:00
Ornithologist Coder 86727aca5f Adds extra example 2018-03-26 00:26:13 +02:00
Ornithologist Coder 6e1630e888 Improves regular expression 2018-03-26 00:26:13 +02:00
Ornithologist Coder faee8c935b Adds opt-in rule discouraged_optional_collection 2018-03-26 00:26:13 +02:00
Marcelo Fabri ae0e21f0f8 Fix crash when saving cache
Fixes #2032
2018-03-24 21:23:14 -07:00
Ash Furrow 7ed962d1ee Adds force-exclusion config. 2018-03-22 09:42:56 -07:00
Frederick Pietschmann 0f93373e8a Rename RuleIdentifier.explicit to .single 2018-03-21 07:47:16 +01:00
Frederick Pietschmann 48c9aeb08a Adjust all keyword architecture + docs 2018-03-21 07:42:46 +01:00
Frederick Pietschmann 00154e9631 Improve map syntax 2018-03-21 07:42:46 +01:00
Frederick Pietschmann 7ac75e92d2 Fix logic error in rule disable check 2018-03-21 07:42:46 +01:00
Frederick Pietschmann fdbc391e52 Improve all keyword-related code
As per PR #2095 review, suggested by @marcelofabri
2018-03-21 07:42:46 +01:00
Frederick Pietschmann 0ad2488d7e Add all keyword 2018-03-21 07:42:46 +01:00
Marcelo Fabri 8e3b929d44 Fix colon autocorrect when preprocessor macros are present
Fixes #2099
2018-03-17 18:51:30 -07:00
Marcelo Fabri e810689ca7 Make legacy_constructor rule more reliable
Fixes #2098
2018-03-17 18:19:46 -07:00
Marcelo Fabri 7b34b4b92b Merge pull request #2094 from notorca/master
Fix for crash on Linux on sources with surrogate characters
2018-03-17 16:00:03 -07:00
Marcelo Fabri bbe2923263 Update rule name 2018-03-17 13:20:43 -07:00
Marcelo Fabri 6b00950d43 Simplify implementation 2018-03-17 12:55:05 -07:00
Daniel Metzing 96d29817b4 Add untyped_error_in_catch opt-in rule 2018-03-17 12:54:51 -07:00
Cyril Lashkevich 10ba712748 Fix for crash on Linux on sources with surrogate characters
Because of the bug https://bugs.swift.org/browse/SR-5971 SwiftLint
crashes when linting on Linux files like https://github.com/xmartlabs/Eureka/blob/master/Example/Example/ViewController.swift
2018-03-17 19:51:24 +01:00
Marcelo Fabri d2c43020fc Merge pull request #2069 from donileo/fix/todos-lint-message
Fix TODOs violation message
2018-03-17 11:50:07 -07:00
Davide Sibilio 5c8d6069b6 Implemented empty_string rule (#2064)
Added empty_string rule
2018-03-17 11:47:04 -07:00
Norio Nomura 85542a6f8d Remove DispatchQueue.sync from Array.parallelMap
`DispatchQueue.sync` was required to avoid CoW on calling `subscript` from multiple copied instances of `Array`.
Since `UnsafeMutableBufferPointer` does not cause CoW on same situation, `DispatchQueue.sync` can be removed.
2018-03-08 15:56:28 +09:00
JP Simard a7a8a69fa2 Improve Array.parallelMap
By applying concepts from Swift Talk 90: https://talk.objc.io/episodes/S01E90-concurrent-map

Notably:
* Removing `@escaping` from block parameter
* Avoiding Array.append & sorting
* Using a constant DispatchQueue label
2018-03-07 09:27:35 -08:00