Commit Graph

547 Commits

Author SHA1 Message Date
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
Cihat Gündüz cf034c9dfb Multiline Brackets (#2302)
* Add new multiline_literal_brackets rule with examples

* Implement rule

* Add changelog entry

* Fix CHANGELOG and rule name

* Fix tests + Update stuff after rebasing

* Add more examples & fix whitespace issue

* Address feedback from @ornithocoder

* Add multiline rules for arguments and parameters

* Fix false positives in rule multiline_parameters_brackets

* Fix false positive for trailing closures in multiline_arguments_brackets

* Add nested examples to rule multiline_arguments_brackets

* Fix more false positives in multiline_arguments_brackets rule

* Use guard where appropriate instead of if

* Update generated artifacts after rebase

* Add CHANGELOG entry for all three new rules

* Move changelog entries to new version

* Fix changelog entries position

* Move new rules to correct subfolder

* Update Rules.md file contents

* Fixup changelog

* Refactor rules
2018-11-28 10:30:36 -08:00
Cihat Gündüz 9d47c3471c Vertical whitespace between cases (#2292) 2018-11-28 08:34:10 -08:00
dirtydanee c4e2a38643 Add "Redundant @objc Attribute" Rule (#2270) 2018-11-27 16:50:53 -08:00
JP Simard 8fc75e393b release 0.29.0 2018-11-27 13:31:15 -08:00
JP Simard a944808c8b Default column to 1 in XcodeReporter output (#2488) 2018-11-27 13:00:01 -08:00
JP Simard b64ead1a3c release 0.28.2 2018-11-27 10:55:50 -08:00
JP Simard d1109da326 Parallelize iterating over subpaths (#2475)
This has a very small performance improvement on multi-core machines
2018-11-21 22:38:05 -08:00
Norio Nomura ea171fbbf2 Add SWIFTLINT_DISABLE_SOURCEKIT environment variable (#2473)
This can be used for avoid "Test::Unit::AssertionFailedError" error in `libxpc.dylib` on calling `sourcekitd_send_request_sync` in sandbox environment.
2018-11-21 17:03:42 -08:00
Marcelo Fabri fb9d8df8a3 Add back MARK 2018-11-20 10:32:20 -08:00
Marcelo Fabri cf0c7b7b21 Use default Equatable and Hashable implementations 2018-11-19 09:51:12 -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
JP Simard 4955c173a0 release 0.28.1 2018-11-18 15:41:26 -08:00
JP Simard 94dd8b4772 release 0.28.0 2018-11-13 22:41:00 -08:00
Marcelo Fabri 83a2ca4be7 Merge pull request #2419 from yhkaplan/random
New Rule - Legacy Random
2018-10-13 22:58:50 -07:00
Joshua Kaplan 6eda1396d8 Rename random rule to legacy random rule 2018-10-06 12:02:21 +09:00
Joshua Kaplan b173350969 Automatic changes to documentation, MasterRuleList, and tests 2018-09-30 14:55:29 +09:00
Joshua Kaplan 71b6def313 Add random rule 2018-09-27 00:21:36 +09:00
Marcelo Fabri 1f121b1ef7 Enable static_operator opt-in rule in SwiftLint 2018-09-16 20:33:28 -07:00
Marcelo Fabri b92b236a5e Add static_operator opt-in rule
Fixes #2395
2018-09-11 09:34:10 -07:00
Dalton Claybrook 45b0881f1d Add Collection Alignment rule and implement basic left-alignment case 2018-09-10 23:45:56 -04:00
Marcelo Fabri c9f315a798 Merge pull request #2372 from marcelofabri/identical_operands
Add identical_operands opt-in rule
2018-09-09 20:47:49 -07:00
JP Simard 53d8a3aba9 Add UnusedPrivateDeclarationRule (#2385)
* Add UnusedPrivateDeclarationRule

* Temporarily disable UnusedPrivateDeclarationRule tests on Xcode 10

So we can merge UnusedPrivateDeclarationRule without having to wait
for CircleCI to update its Xcode 10 version.
2018-09-05 21:59:45 -07:00
JP Simard e460c5ef9c Add Unused Import analyzer rule (#2381) 2018-09-02 14:45:02 -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
Marcelo Fabri be60504dad Enable identical_operands rule on the project 2018-08-30 23:12:44 -07:00
Marcelo Fabri 5bb483d72b Add identical_operands opt-in rule 2018-08-30 23:12:19 -07:00
Dalton Claybrook 4ea785c993 Add ToggleBoolRule 2018-08-30 10:22:21 -04:00
Marcelo Fabri 53647b4e6e Add inert_defer rule
Fixes #2123
2018-08-26 03:10:16 -07:00
Marcelo Fabri 04b634cde7 Add prohibited_interface_builder opt-in rule
Fixes #2365
2018-08-25 22:53:15 -07:00
Ornithologist Coder c4bf3dee10 Adds closure_body_length opt-in rule
because closure bodies should not span too many lines. Implements #52.
Requires Swift 4.2.
2018-08-07 00:13:50 +02:00
Marcelo Fabri 12996ef1f5 release 0.27.0 2018-07-31 09:28:44 -07:00
Matthew Remmel 89adc4224c Patch created from Nef10 (https://github.com/Nef10/SwiftLint.git) missing_docs branch, to remove merge commits that were preventing merging the PR (https://github.com/realm/SwiftLint/pull/2172) 2018-07-25 11:34:53 -04:00
Cihat Gündüz dc44fbcac3 Add tests for if_only configuration option 2018-07-24 13:02:30 +02:00
Marcelo Fabri f2d14e7c5a redundant_optional_initialization rule now lints local variables
Fixes #2233
2018-07-21 21:35:24 -07:00
Marcelo Fabri 883a8dd0dd Merge pull request #2274 from marcelofabri/automatic-rule-tests
Split RulesTests into several test cases, generating them automatically
2018-07-21 18:13:55 -07:00
Marcelo Fabri 8aadb802fb Split RulesTests into several test cases, generating them automatically 2018-07-21 17:23:08 -07:00
Norio Nomura 093b99bea7 Fix LinterCacheTests.testDetectSwiftVersion for Swift 4.2 2018-07-20 08:30:25 +09:00
Marcelo Fabri 90a2134a18 Merge pull request #2239 from sjavora/master
Opt-in rule to check for redundant type annotations
2018-07-19 08:24:51 -07:00
Ornithologist Coder 01dc00f576 Add default rule anyobject_protocol
This commit implements #2283.
2018-07-07 18:54:09 +02:00
Marcelo Fabri 701abbea94 Don’t overwrite file when formatting if not needed
Fixes #2249
2018-06-24 11:38:38 -07:00
Marcelo Fabri b168296d07 Fix generic_type_rule when using Swift 4.2 2018-06-24 00:20:50 -07:00
JP Simard 8c5d2afa7c release 0.26.0 2018-06-22 09:48:20 -07:00
Marcelo Fabri 1d28025789 Add convenience_type opt-in rule
Fixes #1871
2018-06-16 21:08:49 -07:00
Austin Belknap d2981d779f Fix XCode build issues. 2018-06-11 09:30:19 -07:00
Austin Belknap 1fdc5fda94 Add "No Fallthrough Only" Rule. 2018-06-11 09:30:19 -07:00
Eric Horacek 7b8c97ad02 Add multiline function chain rule
See #2214
2018-06-10 19:49:03 -07:00
Šimon Javora 96c1422f23 Added a rule to check for redundant type annotations. 2018-06-10 11:28:33 +02:00
JP Simard e2b74bd867 Require Swift 4.0 or higher to build. 2018-05-30 14:00:17 +10:00