Commit Graph

151 Commits

Author SHA1 Message Date
Ornithologist Coder 371e7b4995 Run format before autocorrect (#2383) 2018-09-02 14:35:39 -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
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 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
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 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 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
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
JP Simard 93ded518a7 Remove uses of String.characters, deprecated in Swift 4.0.2 2017-11-10 14:37:53 -08:00
JP Simard e3404cbf56 Fix superfluous disable command violation 2017-10-23 15:27:30 -07:00
Marcelo Fabri ee02e0f8e5 Remove support for building with Swift 3.1 2017-10-04 13:48:17 -07: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 43925199d4 Validate rules docs when running unit tests
Fix #1734
2017-08-24 21:27:35 +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
JP Simard 18ab900e5a update swiftlint CLI module to compile with Swift 4 from Xcode 9 beta 3 2017-07-18 11:59:22 -07:00
Marcelo Fabri 4dcbc5e441 Parallel autocorrect
Fix #1578
2017-07-15 22:52:25 +02:00
Cody Winton 3f089d6a0d Added use-tabs option for swiftlint autocorrect 2017-07-15 21:18:44 +02:00
JP Simard cc69202999 rename RulesDocsCommand to GenerateDocsCommand
rules_docs -> generate-docs

addresses #1660
2017-07-11 09:06:22 -07:00
JP Simard 83885fc562 reword RulesDocsCommand's usage string 2017-07-10 22:39:08 -07:00
JP Simard bbfa8059b5 refer to correct action in AutoCorrectCommand's option usage 2017-07-10 22:17:04 -07:00
Marcelo Fabri 3e80e91265 Add scheme for docs and section in CONTRIBUTING 2017-07-03 00:30:36 +02:00
Marcelo Fabri 27b06d37f7 Print rules summary 2017-07-02 23:58:45 +02:00
Marcelo Fabri 015dfc6632 Add command to generate rules documentation 2017-07-02 23:48:01 +02:00
Marcelo Fabri e86763739f Move kind to RuleDescription 2017-07-02 15:50:16 +02:00
Marcelo Fabri e3bb6d1665 Print rule kind on rules command 2017-07-02 15:50:16 +02:00
Marcelo Fabri 68c1f3c1ab Fix configuration issue when using custom paths
Fixes #1631
2017-06-24 22:54:10 +02:00
Marcelo Fabri fd231b607d Fix existing violations 2017-06-13 16:12:58 +02:00
Marcelo Fabri 33955234b3 Skip files with valid cache & no violations when auto correcting 2017-05-28 12:47:52 +02: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 bb2b9a2cbf hoist knowledge of LintOptions.ignoreCache out of LinterCache+CommandLine 2017-05-18 14:40:46 -07:00
JP Simard da91a2ef51 use --cache-path as directory rather than cache file 2017-05-18 14:40:46 -07:00
JP Simard 98ea7ae791 re-enable cache when running lint command
by respecting the value of ignoreCache rather than always passing 'true'
2017-05-18 14:31:33 -07:00