Commit Graph

289 Commits

Author SHA1 Message Date
Ornithologist Coder 371e7b4995 Run format before autocorrect (#2383) 2018-09-02 14:35:39 -07:00
JP Simard dcc85fb0f3 Remove unused imports (#2382) 2018-09-02 14:09:04 -07:00
JP Simard 2bcea4b04d Add ability for SwiftLint to lint files with full type-checked AST awareness (#2379)
* Add LintableFilesVisitor

* Move LintCommand logic into LintOrAnalyzeCommand

to prepare for the upcoming analyze command

* Add AnalyzeCommand (not fully implemented yet in SwiftLintFramework)

* Add analyzerRules configuration member

* Add AnalyzerRule protocol

* Pass compiler arguments to validate/correct

* Add requiresFileOnDisk member to RuleDescription

This will be used by AnalyzerRules because they need a file on disk
to pass in the compiler arguments to SourceKit.

* Exclusively run AnalyzerRules when the Linter has compiler arguments

* Enable testing AnalyzerRules in TestHelpers

* Add ExplicitSelfRule

* Update documentation

* Fix `analyze --autocorrect`

* Improve performance of CompilerArgumentsExtractor

* Fix lint command actually running analyze

* Move File operations in TestHelpers into a private extension

* Add analyzer column to rules command and markdown documentation

* Use a Set literal

* Make AnalyzerRule inherit from OptInRule

* Mention analyzer_rules in readme

* Mention that analyzer rules are slow
2018-09-02 00:13:27 -07:00
JP Simard b38758b902 Completely remove deprecated --use-tabs option (#2376) 2018-09-01 12:50:31 -07:00
Marcelo Fabri 12996ef1f5 release 0.27.0 2018-07-31 09:28:44 -07:00
Ben Asher 32e8c5bbc3 Fix extra array copies 2018-07-23 10:13:55 -07:00
Ben Asher 7f86dc4c44 Fix paths arg eating other params 2018-07-23 10:13:55 -07:00
Ben Asher 3f1acd6ca1 Prefer single path, if it's provided; fix multi-path 2018-07-23 10:13:55 -07:00
Ben Asher 7a32b8d4c2 Support for multiple paths 2018-07-23 10:13:55 -07:00
Marcelo Fabri 701abbea94 Don’t overwrite file when formatting if not needed
Fixes #2249
2018-06-24 11:38:38 -07:00
JP Simard 8c5d2afa7c release 0.26.0 2018-06-22 09:48:20 -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
JP Simard 4fddef5ac1 release 0.25.1 2018-04-08 11:11:28 -07:00
Norio Nomura 2a0ac455bc 'flatMap' is deprecated: renamed to 'compactMap(_:)' 2018-04-08 13:28:09 +09:00
John Szumski a1f5fb9ee0 Fixed issue where the autocorrect done message used the plural form of "files" even if only 1 file changed. 2018-03-27 21:49:00 -04:00
Ash Furrow 63658418c4 Adds unit test for force-exclude flag. 2018-03-22 09:42:56 -07:00
Ash Furrow 7ed962d1ee Adds force-exclusion config. 2018-03-22 09:42:56 -07:00
Ash Furrow f80f9c8897 Adds autocorrect config for force-excludes. 2018-03-22 09:42:56 -07:00
Ash Furrow f9aba962ca Adds linter config for force-excludes. 2018-03-22 09:42:56 -07:00
Marcelo Fabri c875bed813 release 0.25.0 2018-02-11 22:15:36 -08: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
JP Simard 7bf32346cc release 0.24.2 2018-01-10 10:13:57 -08:00
JP Simard 7ad77df690 release 0.24.1 2018-01-08 15:21:59 -08:00
Noah McCann beb2e03610 Added backwards compatibility for use-tabs and deprecation warning 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 fb67afa185 AutoCorrect now uses indentationMode rather than options 2018-01-03 23:05:48 -08:00
Noah McCann 3c7f8d05f4 Revert "Added indent-width option for swiftlint autocorrect"
This reverts commit 7531bbace2.
2018-01-03 23:05:48 -08:00
Noah McCann b161ee00ad Added indent-width option for swiftlint autocorrect 2018-01-03 23:05:48 -08:00
Norio Nomura 67a8fc3c78 Use SwiftPM to build installables 2017-11-17 09:53:28 +09:00
JP Simard 06ece1ea8d release 0.24.0 2017-11-10 15:49:41 -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 b2227accc3 Avoid calling cacheDescription when the cache is disabled
This skips an expensive JSON serialization call.
2017-11-09 12:28:45 -08:00
JP Simard e3404cbf56 Fix superfluous disable command violation 2017-10-23 15:27:30 -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 ee02e0f8e5 Remove support for building with Swift 3.1 2017-10-04 13:48:17 -07:00
Marcelo Fabri d1cc128660 release 0.23.0 2017-10-03 21:55:00 -03:00
JP Simard 8bce777cd8 Disable sorted imports rule in RulesCommand.swift
since we're conditionally importing and can't fully sort.
2017-09-29 11:23:33 -07:00
JP Simard 20dcc49066 Fix compilation with Swift < 3.2 2017-09-29 10:55:06 -07:00
JP Simard c5a7390010 Dynamically truncate to fit in console window 2017-09-29 10:41:38 -07:00
JP Simard 99a00d4281 improve rules table rendering with multi-line or very long values 2017-09-29 10:16:35 -07:00
Marcelo Fabri f58ade89bb Fix existing violations 2017-09-13 19:47:25 -03:00
Marcelo Fabri 03edafae15 Merge pull request #1797 from marcelofabri/rules-tests
Validate rules docs when running unit tests
2017-09-08 00:41:22 -03:00
Marcelo Fabri f074ff7f47 release 0.22.0 2017-08-30 14:38:04 -03:00
Marcelo Fabri 43925199d4 Validate rules docs when running unit tests
Fix #1734
2017-08-24 21:27:35 +02:00
Marcelo Fabri e811218443 release 0.21.0 2017-08-02 00:18:04 +02:00
JP Simard ef67adca19 rename RulesDocsOptions to GenerateDocsOptions
to match command name
2017-07-30 18:41:20 -07:00
Marcelo Fabri 791221088b Add --disabled flag to swiftlint rules
This is helpful to quickly evaluate which rules could/should be enabled in the current configuration.
2017-07-21 11:16:51 +02:00