Commit Graph

164 Commits

Author SHA1 Message Date
David Harris 8c789bb3e2 feature: add config setting to exist successfully in case of no lintable (#2732)
files
2020-02-08 13:33:50 -08:00
JP Simard 399f5b7df6
Fix docstring formatting issues using DrString (#3032)
Using command:
$ drstring check -i 'Source/**/*.swift' --first-letter lowercase --vertical-align
2020-01-12 11:19:33 -08:00
JP Simard 37167a8a35
Add documentation comments to all public declarations (#3027) 2020-01-08 09:47:10 -08:00
Marcelo Fabri 3a36212b94 Swift 5 support (#2720)
* Update project to compile with Xcode 10.2

* Fix explicit_acl with Swift 5

* Update macOS VM image

* Fix ConfigurationTests on Swift 5

* Update Podspec

* Workaround SR-10486 to fix validation tests

* Fix testDetectSwiftVersion on Swift 5

* Update specs repo when validating CocoaPods spec

* Fix redundant_set_access_control tests

* Manually update Package.resolved

* Use .upToNextMinor

* [Azure Pipelines] Add `sw_vers`

* Relax expecting conditions for crashing output in `testSimulateHomebrewTest()`

Because TSAN makes `swiflint` to produce additional output on crashing.

* Add CHANGELOG entry

* Ignore extensions in explicit ACL rules

* Work around SR-10486 for Sourcery
2019-04-28 21:10:06 -07:00
Paul Taykalo 1b0ac66334 Update reduce to reduce:into for a bit faster running (#2657) 2019-02-22 09:29:39 -08:00
Kim de Vos b5c5701e90 Warn when disabling non existing rules (#2504)
* Added violations when trying to disable non valid rule

* Added violations when trying to disable non valid rule

* Add changelog enty for 'superfluous_disable_command' improvement

* Uses all rule identifiers when running nonValidSuperfluousCommandViolations

* Address feedback from jpsim

* Uses all rule identifiers when running nonValidSuperfluousCommandViolations

* Address more feedback from jpsim

* Added customRuleIdentifiers when verifying undefinedSuperfluousCommandViolations

* Catch all invalid disable commands in a region

Not just the first one.

* Rename test
2019-01-13 15:10:44 -08:00
JP Simard 0e01e07326
#2441 - Fix inaccessible custom rules in nested configurations (#2556)
* #2441 - Pass custom rules identifiers to the enableRules function to consider custom rules of a parent of a nested configuration

* #2441 - Add custom rules merge

* #2441 - Fix line length violation

* #2441 - Add nested configutaion mocks with custom rules

* #2441 - Add nested configurations tests for custom rules

* #2441 - Disable function body length check

* #2441 - Update changelog

* Move changelog to appropriate position

* Split up and refactor Configuration.init to avoid being too long

* Add tests to LinuxMain.swift

* Remove redundant protocol conformances

Hashable implies Equatable

* Fix typo in changelog entry and add another fixed issue URL
2019-01-13 15:07:27 -08:00
Kim de Vos d62e187b5c Add Legacy Hashing rule (#2496) 2018-12-05 15:43:39 -08:00
JP Simard 0e862ca9c4
Enable vertical whitespace rules in SwiftLint
and fix violations
2018-12-02 14:01:23 -08:00
Kim de Vos bf97e08fa7 Exit immediately when linting with a version other than swift_version if defined (#2491) 2018-11-29 12:40:29 -08:00
JP Simard 5901d3075f
Require Swift 4.2 (#2466)
This bumps the minimum version required to build SwiftLint to 4.2. The primary motivating factor to drop support for Swift 4.0-4.1.x is that SwiftLint now uses CryptoSwift, which requires 4.2.

* Add changelog entry

* Remove --allow-warnings flag from CocoaPods commands

* Update CryptoSwift to 0.13.0

* Migrate to Swift 4.2

* Remove CircleCI tests for Swift < 4.2

* Update English and Chinese README

Korean README doesn't yet have a version table like this.

* Update gems

* Add changelog entry for fixed compiler warnings

* Update CocoaPods to 1.6.0.beta.2

To work around https://github.com/CocoaPods/CocoaPods/issues/7708
2018-11-18 17:32:25 -08:00
Marcelo Fabri be60504dad Enable identical_operands rule on the project 2018-08-30 23:12:44 -07:00
JP Simard e2b74bd867
Require Swift 4.0 or higher to build. 2018-05-30 14:00:17 +10: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 fbeaaeb972
Use Sequence.reduce(into:) when possible 2018-04-22 20:46:46 -07:00
Norio Nomura 133cef8df1
`ObjCBool` is no longer implicitly converted to `Bool` on Linux 2018-04-08 13:28:09 +09:00
JP Simard fa13551af1
Rename Configuration.Indentation to IndentationStyle
and move to its own file
2018-01-03 23:21:23 -08:00
JP Simard 5fd67018bb
Fix comment alignment 2018-01-03 23:16:37 -08:00
Noah McCann fa5815e9f5
Extracted rule logic to separate function to address linting errors 2018-01-03 23:05:48 -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 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
JP Simard 08e0c816f3
Make `Configuration` conform to `Hashable` 2017-10-19 22:50:07 -07:00
JP Simard 757443d201
Correct and speed up equality checks for `Configuration` values
they previously didn't account for `warningThreshold` or `cachePath`.
2017-10-19 22:28:04 -07:00
Marcelo Fabri d4f4f5f35c Sort list of rule identifiers before printing them 2017-10-05 11:51:36 -03:00
Marcelo Fabri be341f90b9 Introduce queuedFatalError
`fatalError` prints the full path of the file, which leaks filesystem information from the machine that built the binary. Now that we release via CocoaPods, this is more critical.
2017-09-30 15:07:23 -03:00
Marcelo Fabri 54f9c22c60 Fix existing violations 2017-08-26 10:05:56 -03:00
Marcelo Fabri d4248e9b12 Fix tests on Linux 2017-08-17 20:36:44 +02:00
Stéphane Copin 3ad4842bcd
Small changes and refactoring based on github Feedback 2017-08-02 13:05:26 -07:00
Stéphane Copin 9f1f454cf9
Refactor the way Configuration objects are created with regards to rules 2017-08-02 13:05:26 -07:00
Stéphane Copin 97c1dcd0fa
Add support for nested configuration
Original commit here: 9eef125245

Significant modifications made by @jpsim
2017-08-02 13:05:26 -07:00
Marcelo Fabri 663081cfbd Fix crash when using --config and --path with a Swift file
Fixes #1694
2017-07-19 20:53:55 +02:00
JP Simard 7592d9247a
use cached configurations if available when initializing 2017-07-17 16:35:16 -07:00
JP Simard d0c8e5ee60
reorganize Configuration.swift 2017-07-17 12:05:05 -07:00
JP Simard 40bd4e7d4f
move parsing functionality to Configuration+Parsing 2017-07-17 12:05:05 -07:00
JP Simard e6f95d5723
move merging functionality to Configuration+Merging 2017-07-17 12:05:04 -07:00
JP Simard 8f8e5d1fc2
move "lintable files" functionality to Configuration+LintableFiles 2017-07-17 11:45:32 -07:00
JP Simard 283055623a
prefer early return in containsDuplicateIdentifiers(_:) 2017-07-17 11:42:03 -07:00
Marcelo Fabri 68c1f3c1ab Fix configuration issue when using custom paths
Fixes #1631
2017-06-24 22:54:10 +02:00
JP Simard a6487db198 fix using incorrect config file (fixes #1531) 2017-06-13 21:32:56 +02:00
JP Simard eef39595f6
move cache-related Configuration code into Configuration+Cache.swift 2017-05-23 11:22:55 -07:00
JP Simard b19e0de6e4
fix non-root configs logging warnings more than once 2017-05-23 11:22:55 -07:00
JP Simard ca08d6598a
move LinterCache+CommandLine to SwiftLintFramework
and make cacheURL an internal member of Configuration
2017-05-18 14:53:39 -07:00
JP Simard 97bdac211a
keep a single cache file for all of SwiftLint 2017-05-18 14:45:46 -07:00
JP Simard f639ae95f1
add CacheDescriptionProvider protocol
to provide more complete descriptions for cache invalidation
purposes.
2017-05-18 14:31:33 -07:00
JP Simard 903b48f4da
derive Configuration.cacheDescription in all cases
rather than just when using one of many code paths in one of many
initializers
2017-05-18 13:59:24 -07:00
Víctor Pimentel 5ed010c9c0
Change LinterCache to use file modification dates instead of hashing files with a weak algorithm. 2017-05-18 13:39:05 -07:00
JP Simard 385d726e52
simplify Configuration.swift's usage of its default file manager 2017-05-18 13:04:09 -07:00
JP Simard 1b69b90691
remove superfluous string interpolation of a single String 2017-04-06 13:33:38 -07:00