Commit Graph

50 Commits

Author SHA1 Message Date
JP Simard f6c9633087 Add RegexConfiguration.ExecutionMode (#6128)
* Add `RegexConfiguration.ExecutionMode`

To help migrate custom rules to SwiftSyntax. Not wired up yet, just the
configuration parsing and defaults. Will wire it up in the next PR.

The diff looks big, but it's 500+ lines of tests, with ~45 lines of
actually new code.

* Docs

* Address PR feedback

- Add `default` case to ExecutionMode enum instead of using optional
- Change configuration key from `mode` to `execution_mode` for consistency
- Move default execution mode logic to runtime instead of configuration time
- Refactor test functions to use throws instead of do-catch
2025-06-22 10:19:14 -04:00
JP Simard 3a922d41f9 Add ConditionallySourceKitFree to migrate custom rules to SwiftSyntax (#6127)
The protocol will be used to tag rules that may or may not require
SourceKit depending on its configuration. I only expect this to be used
for custom rules as utility to help transition to a fully SwiftSyntax
based approach.
2025-06-21 15:54:56 -04:00
Danny Mösch a6c4fd98bc Move files from SwiftLintCore to SwiftLintFramework
Ideally, SwiftLintCore would some day only contain components
that are needed to define rules. Consequently, it would be the
only bundle required to import for (external) rule development.
2024-12-23 12:51:43 +01:00
JP Simard 3961d6482b Organize rules by kind in Xcode project (#2341) 2018-08-05 18:54:05 -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
Frederick Pietschmann 0ad2488d7e Add all keyword 2018-03-21 07:42:46 +01:00
JP Simard 34f429b0a3 Fix caching on Linux
This has never worked for two reasons:

1. We've used dictionaries to represent cache descriptions, which
   don't guarantee stable ordering of keys across invocations.
   This is true both on Darwin and Linux, but in practice ordering
   varies significantly more on Linux.
2. Storing a `TimeInterval` value in a `[String: Any]` dictionary
   and retrieving it again will not be dynamically castable to
   `Double` or `TimeInterval` but will be castable to `Int`.
2017-10-26 12:23:13 -07:00
Marcelo Fabri 0be8c855d2 Move functions to properties and Sets instead of Arrays 2017-10-04 14:34:00 -07:00
Marcelo Fabri 60229853cd Add test for invalid custom rule handling 2017-07-17 11:48:01 +02:00
Jamie Edge 51389083c9 Fix all custom rules not being applied when any rule is configured incorrectly. 2017-07-17 11:35:08 +02:00
JP Simard 7904f92ca9 fix under-indentation in CustomRules.swift 2017-07-10 16:03:42 -07:00
Marcelo Fabri e86763739f Move kind to RuleDescription 2017-07-02 15:50:16 +02:00
Marcelo Fabri 5012211d3d Add RuleKind 2017-07-02 15:50:16 +02:00
JP Simard 81105b70db fix custom rules not working correctly with comment commands 2017-06-13 22:47:52 +02: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 65f32a14dd refactor CustomRules.validate(file:) 2017-05-16 11:28:01 -07:00
Nigel Flack 6321e24877 Adds support for excluded in custom rules 2017-04-14 15:14:45 +01:00
JP Simard 7522635ad8 update SwiftLintFramework/Rules to follow Swift 3 API Design Guidelines 2017-01-09 19:37:53 -08:00
JP Simard 9e7cdc3282 update SwiftLintFramework/Protocols to follow Swift 3 API Design Guidelines 2017-01-09 19:19:25 -08:00
JP Simard a291bb594a update SwiftLintFramework/Extensions to follow Swift 3 API Design Guidelines 2017-01-09 17:53:07 -08:00
JP Simard 89526264db improve RegexConfiguration 2016-12-11 16:49:28 -08:00
JP Simard 54acf03983 use NSRegularExpression with a placeholder pattern to compile on Linux
since `NSRegularExpression.init()` isn't available on Linux yet.
2016-12-11 14:04:49 -08:00
JP Simard 0faf567931 use bridge() rather than explict or implicit casts
this is a step in aligning the code to compile on both Darwin and
Linux
2016-12-11 13:47:44 -08:00
JP Simard a57526d639 omit 'self.' references when not ambiguous 2016-12-08 01:25:54 -08:00
Norio Nomura 8bf15f1dba Migrate to Swift 3.0 2016-10-09 01:09:50 +09:00
JP Simard b0e4842910 fix long line I just added 2016-08-21 14:38:53 -07:00
JP Simard d433d5b197 small stylistic tweaks following #743 2016-08-21 14:31:05 -07:00
J Cheyo Jimenez 4509495f9e Allowing disabling custom rules in code
closes https://github.com/realm/SwiftLint/issues/515
2016-08-08 15:16:52 -07:00
J Cheyo Jimenez 5acae661a2 Fixes custom rule regex
closes https://github.com/realm/SwiftLint/issues/717
closes https://github.com/realm/SwiftLint/issues/726
2016-08-06 15:59:45 -07:00
bootstraponline 0d78cdb0c2 Add included to custom rules 2016-06-23 10:21:45 -04:00
JP Simard 4ffb9358d0 rename CustomRulesConfig to CustomRulesConfiguration 2016-02-12 10:53:36 -08:00
JP Simard 144495306b rename rule configurations to expand "Config" to "Configuration" 2016-02-12 10:53:36 -08:00
JP Simard 7e07e813ca rename RuleConfig to RuleConfiguration 2016-02-12 10:53:36 -08:00
JP Simard 6befe7e5a4 expand many instances of "config" to "configuration" 2016-02-12 10:53:36 -08:00
JP Simard d9cd1d670a rename Rule.init(config:) to Rule.init(configuration:) 2016-02-12 10:53:36 -08:00
JP Simard 3f4b993847 rename ConfigProviderRule to ConfigurationProviderRule 2016-02-12 10:53:36 -08:00
JP Simard 71135c6a4b make RulesCommand show a configuration description for all rules 2016-02-07 10:40:51 -08:00
JP Simard b2a7b707ab print rule configuration 2016-02-03 10:31:53 -08:00
Scott Hoyt 3aa5393b3d Fix typo. 2016-01-25 10:03:28 -08:00
Scott Hoyt ccdd81af61 Switch guard early exit with if for CustomRules.validateFile. 2016-01-25 07:26:31 -08:00
Scott Hoyt b76a3d2ae6 Added tests. 2016-01-25 07:26:31 -08:00
Scott Hoyt 08a7560881 Switch RegexConfig.matchTokens to RegexConfig.matchKinds. Properly reset set if key exists. 2016-01-25 07:26:31 -08:00
Scott Hoyt c6c088b3bc Fix broken tests by removing SwiftXCP import. 2016-01-25 07:26:31 -08:00
Scott Hoyt 923b4c4e7e Update RegexConfig to use a Set for matchTokens. Fixed CustomRules. 2016-01-25 07:26:31 -08:00
Scott Hoyt fede0ccc2d Added convenience for RegexConfig.severity 2016-01-25 07:26:31 -08:00
Scott Hoyt 49bd5ae91f Use flatMap instead. 2016-01-25 07:26:31 -08:00
Scott Hoyt db10bff4d2 Fleshed out validateFile for CustomRules. 2016-01-25 07:26:31 -08:00
Scott Hoyt f2cab3e296 Added CustomRulesConfig. 2016-01-25 07:26:31 -08:00
Scott Hoyt a266901216 Fixed typo. 2016-01-25 07:26:31 -08:00
Scott Hoyt 8cc5ba4f32 Stub out CustomRules. 2016-01-25 07:26:31 -08:00