Commit Graph

15 Commits

Author SHA1 Message Date
Danny Mösch e64e82d80d Get rid of periods finishing rule descriptions 2023-01-10 22:29:13 +01:00
JP Simard 4bd7da32ea
Reduce visibility of rules to be `internal` (#4533)
There's no reason to expose these publicly and this will make it nicer
to move to a new module outside of the core SwiftLint functionality.
2022-11-09 11:01:26 -05:00
Danny Mösch 449190d324
Verify examples in rules by default and enforce explicit exclusion (#4065)
A rule must conform to ManuallyTestedExamplesRule to skip generation of a test for its examples.
2022-08-09 22:32:09 +02:00
Danny Moesch fa2a0bab6c
Move StringView.byteOffset into generally accessible extension (#3917) 2022-03-25 07:27:50 +01:00
JP Simard bbf1ad4a18
[ExplicitSelfRule] Fix violation location and misplaced corrections (#3507) 2021-01-29 10:59:28 -08:00
Paul Taykalo 693ee2cae9
Add Isnot Empty extension in the Swift Framework (#3387) 2020-11-07 18:42:55 -05:00
Sven Münnich da408b5901
Fix some false positives in rule `explicit_self` (#3368) 2020-09-25 09:23:03 -07:00
Marcelo Fabri f8ef7d649c Enable legacy_multiple and prefer_self_type_over_type_of_self in our codebase 2020-08-05 01:11:17 -07:00
Zev Eisenberg fcf848608e
Add Inline test failure messages (#3040)
* Add Example wrapper in order to display test failures inline when running in Xcode.
* Stop using Swift 5.1-only features so we can compile on Xcode 10.2.
* Wrap strings in Example.
* Add Changelog entry.
* Wrap all examples in Example struct.
* Better and more complete capturing of line numbers.
* Fix broken test.
* Better test traceability.
* Address or disable linting warnings.
* Add documentation comments.
* Disable linter for a few cases.
* Limit mutability and add copy-and-mutate utility functions.
* Limit scope of mutability.
2020-02-02 10:35:37 +02:00
Paul Taykalo 8ac124a494 A bit faster Explicit Self rule (#3048) 2020-01-17 13:57:54 -08:00
JP Simard fe5baca7cd
Migrate to use SourceKitten's new ByteCount/ByteRange types (#3037)
New APIs were introduced in SourceKitten to allow for a more typesafe distinction between integers meaning NSString-based distances and byte-based distances.

* https://github.com/jpsim/SourceKitten/pull/639
* https://github.com/jpsim/SourceKitten/pull/642

This PR migrates SwiftLint's use of those APIs.
2020-01-16 15:18:37 -08:00
JP Simard 40ade98710
Update SourceKitten to 0.28.0 (#3011) 2020-01-03 16:47:18 -08:00
Paul Taykalo ac40778cb3 Use SwiftLintFile wrapper over the File 2019-11-07 15:19:17 +02: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
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