Commit Graph

297 Commits

Author SHA1 Message Date
Marcelo Fabri 6e987a763e Fix a false positive in unused_closure_parameter rule
Fixes #2062
2018-06-02 20:56:24 -07:00
JP Simard e2b74bd867 Require Swift 4.0 or higher to build. 2018-05-30 14:00:17 +10:00
Marcelo Fabri f2297d7387 Fix false positives in prohibited_super_call rule
Fixes #2212
2018-05-21 20:50:34 -07:00
JP Simard 84bfdca774 Enable File Name rule for SwiftLint & fix violations 2018-05-11 22:17:40 -07:00
JP Simard 6f0318e1b3 Another attempt to fix compiler issues with CocoaPods 2018-05-05 16:57:13 -07:00
JP Simard 6ff33e675b Refactor 2018-05-05 16:24:54 -07:00
JP Simard 22a6187553 Merge branch 'master' into attibute_and_modifier_order
* master:
  Remove all file headers
  Make fallthrough rule opt-in
  Update the swift file and run the unit tests
  Fix a typo
2018-05-05 15:25:43 -07:00
JP Simard b83e0991b9 Remove all file headers
The MIT license doesn't require that all files be prepended with this
licensing or copyright information. Realm confirmed that they're ok with this
change. This will enable some companies to contribute to SwiftLint and the
date & authorship information will remain accessible via git source control.
2018-05-04 13:42:02 -07:00
JP Simard 382263868e Tweak code format for arrays 2018-04-28 15:28:13 -07:00
Daniel Metzing 9a7005912a Add modifiers_order rule 2018-04-26 20:25:58 +02:00
Daniel Metzing b2bb9d6c89 Merge remote-tracking branch 'upstream/master' into upstream_master 2018-04-26 15:10:14 +02:00
Daniel Metzing 5283598794 Merge remote-tracking branch 'upstream/master' into upstream_master 2018-04-25 12:43:06 +02:00
Marcelo Fabri e2b195a4e2 Use SwiftDeclarationAttributeKind instead of string constants 2018-04-24 22:23:36 -07:00
Daniel Metzing c68a28dba5 Adding rule 2018-04-10 22:52:16 +02:00
Marcelo Fabri 1a9a4f7516 Add redundant_set_access_control rule
Fixes #1869
2018-04-08 21:54:50 -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
Ash Furrow 7ed962d1ee Adds force-exclusion config. 2018-03-22 09:42:56 -07: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
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
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
Jamie Edge 0a4b562452 Removed dependency upon non-Linux NSString method. 2018-02-11 18:01:09 -08:00
Jamie Edge b80798b875 Fix directories with a '.swift' suffix being treated as files. 2018-02-11 18:01:09 -08:00
Marcelo Fabri 5eb48d69b7 Merge pull request #2030 from mshibanami/ignoring_functions_of_line_length
Fix ignores_function_declarations of line_length doesn't work in some cases
2018-02-03 23:05:53 -08:00
Manabu Nakazawa 9677c92285 Fix ignores_function_declarations of line_length doesn't work in some cases 2018-02-04 15:44:35 +09:00
Marcelo Fabri 03b4d6b020 Fix violations introduced when linting with Swift 4.1
Part of #2021
2018-02-03 22:23:48 -08:00
JP Simard 623590acd1 Update dependencies 2018-02-01 15:35:41 -08:00
Marcelo Fabri 4c8df19c84 Use SourceKit to validate associatedtype and typealias in type_name rule when linting with Swift 4.1
Part of #2021
2018-01-26 22:08:59 -08:00
Marcelo Fabri 19edf2608b Fix enclosedSwiftAttributes in Swift 4.1
Fixes #2019
2018-01-25 09:47:11 -08:00
JP Simard e70710bedb Don't log if indentation isn't set in config
Fixes #1998
2018-01-10 10:08:39 -08:00
JP Simard 34d2fb3949 Move Configuration.defaultIndentation() to IndentationStyle init 2018-01-03 23:31:12 -08:00
JP Simard fa13551af1 Rename Configuration.Indentation to IndentationStyle
and move to its own file
2018-01-03 23:21:23 -08:00
Noah McCann ab29b75d20 Addressed most linting errors 2018-01-03 23:05:48 -08:00
Noah McCann 093367073a Renamed IndentationMode to Indentation, better handled default value 2018-01-03 23:05:48 -08:00
Noah McCann 38f869bf81 Added indentationMode to configuration, updated parsing to handle it 2018-01-03 23:05:48 -08:00
JP Simard 93ded518a7 Remove uses of String.characters, deprecated in Swift 4.0.2 2017-11-10 14:37:53 -08:00
JP Simard 170ad413f0 Lock accesses to assert handler storage
This fixes races seen "in the wild" causing crashes.
2017-11-09 12:28:45 -08:00
JP Simard aa73566b39 Convert Cache struct to a class
to avoid having to lock calls to mutating functions that don't
actually perform mutating operations.

This fixes races seen "in the wild" causing crashes.
2017-11-09 12:28:45 -08:00
JP Simard 34f429b0a3 Fix caching on Linux
This has never worked for two reasons:

1. We've used dictionaries to represent cache descriptions, which
   don't guarantee stable ordering of keys across invocations.
   This is true both on Darwin and Linux, but in practice ordering
   varies significantly more on Linux.
2. Storing a `TimeInterval` value in a `[String: Any]` dictionary
   and retrieving it again will not be dynamically castable to
   `Double` or `TimeInterval` but will be castable to `Int`.
2017-10-26 12:23:13 -07:00
JP Simard 3a32d6b479 Speed up reading cached results by about 200%
also slightly speed up writing to the cache.

For example, on the Lyft codebase with 1,500 Swift files:

```bash
$ time swiftlint lint --quiet
swiftlint --quiet  3.53s user 0.27s system 388% cpu 0.979 total
$ rm -rf ~/Library/Caches/SwiftLint && time swiftlint lint --quiet
swiftlint --quiet  35.20s user 1.22s system 371% cpu 9.806 total
$ time swiftlint lint --quiet
swiftlint lint --quiet  0.90s user 0.13s system 218% cpu 0.472 total
$ rm -rf ~/Library/Caches/SwiftLint && time swiftlint lint --quiet
swiftlint lint --quiet  31.78s user 1.18s system 360% cpu 9.146 total
```
2017-10-19 23:17:01 -07:00
Marcelo Fabri e84100eed4 Remove SwiftExpressionKind.other 2017-10-05 14:33:32 -03:00
Marcelo Fabri 0be8c855d2 Move functions to properties and Sets instead of Arrays 2017-10-04 14:34:00 -07:00
JP Simard c57c47d66f Remove unnecessary Swift version differences 2017-10-04 13:49:40 -07:00
Marcelo Fabri ee02e0f8e5 Remove support for building with Swift 3.1 2017-10-04 13:48:17 -07:00
Marcelo Fabri 81f90e6326 Add custom rule to enforce using queuedFatalError 2017-10-01 20:05:46 -03:00
Marcelo Fabri 05685785f2 Merge pull request #1864 from marcelofabri/improve-allowed-symbols
Fix false negatives when using allowed_symbols
2017-10-01 01:11:46 -03:00
Marcelo Fabri ffa4e8a3fb Workaround union not working on Linux on Swift 3.1 2017-10-01 00:45:52 -03:00