Commit Graph

22 Commits

Author SHA1 Message Date
Martin Redington 7623f1e730 Enable more rules in SwiftLint's own .swiftlint.yml (#5532) 2024-04-27 18:43:08 +02:00
Danny Mösch 82cad0bfff Allow to infer option names (#5505)
This allows to infer names of options from their names in a configuration. CamelCase is translated into snake_case automatically when `apply` is triggered.

* Don't have all `RuleConfiguration`s conform to `InlinableOptionType`. Mark types that must have this capability explicitly. Same for `AcceptableByConfigurationElement`.
* A type being an `InlinableOptionType` doesn't mean it's automatically inlined. This also doesn't depend on the fact of having a name for its key configured any longer. Instead, an `inline` attribute must explicitly be set to `true` in `@ConfigurationElement`.
* Key name inference is optional and can be overwritten by specifying a key name in the attribute.
* Inlined configurations only fail in `apply` when they are really sure that something is odd. Otherwise, they accept to not being updated.
2024-03-23 18:54:39 +01:00
Kasra Babaei 77bae5429c Allow line_length rule to ignore certain lines based on regex patterns (#5437) 2024-01-26 09:40:59 +01:00
Danny Mösch 2433e7b5bf Make use of macros to generate configuration parsing code (#5250) 2023-10-02 22:35:24 +02:00
Danny Mösch 3f039f26d5 Connect configs with their referencing rules to have some context in error logging (#5017)
With the binding of configurations to their associated rule types
"unknown configuration" errors can be made more specific mentioning
also the rule's identifier in the printed message.
2023-05-19 20:58:24 +02:00
Danny Mösch d938b2d3c3 Specify default options in configurations only (#5020) 2023-05-18 17:21:30 +02:00
Danny Mösch 405113f793 Open ConfigurationError up to be used more broadly (#5005) 2023-05-14 20:00:46 +02:00
JP Simard a7bc9e20c7 Move built-in rules to new SwiftLintBuiltInRules module (#4950) 2023-04-27 11:16:01 -04:00
JP Simard 4c04cdafa7 Introduce SwiftLintTestCase
To consistently set up rules before tests
2023-04-25 12:28:50 -04:00
Danny Mösch 16e2bb0f18 Extend xct_specific_matcher rule to check for boolean asserts on (un)equal comparisons (#3858) 2023-04-02 12:30:21 +02:00
JP Simard e63e8cad0f Add UnusedDeclarationRule (#2814)
This PR adds a new `unused_declaration` analyzer rule to lint for unused declarations.
By default, detects unused `fileprivate`, `private` and `internal` declarations.
Configure the rule with `include_public_and_open: true` to also detect unused `public` and `open` declarations.

Completely remove the `unused_private_declaration` rule.

This is built on the work enabling collecting rule infrastructure in https://github.com/realm/SwiftLint/pull/2714.
2019-07-18 18:23:43 -07:00
Michael Gray ac9b5348e1 Added "ignores_interpolated_strings" option to line_length (default value is false) 2018-05-06 10:41:15 -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
Ornithologist Coder 83c47cc493 Update tests not to trigger xctfail_message_rule 2017-08-02 14:52:36 +02:00
JP Simard 25a92c4e03 automatically generate LinuxMain.swift using Sourcery
This adds 6 tests that were accidentally not being run on Linux:

* LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresComments
* LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresFunctionDeclarations
* LineLengthConfigurationTests.testLineLengthConfigurationThrowsOnBadConfigValues
* LineLengthRuleTests.testLineLengthWithIgnoreCommentsEnabled
* LineLengthRuleTests.testLineLengthWithIgnoreFunctionDeclarationsEnabled
* RegionTests.testSeveralRegionsFromSeveralCommands
2017-06-02 14:28:37 -07:00
JP Simard 69f885cf08 small refactoring after #1264 2017-02-09 14:42:09 -08:00
Michael Welles 15a7a88297 Modified so that kinds(forByteOffset:) does not require a separate
filter() setup of the results
2017-02-06 15:58:45 -05:00
Michael Welles c9ff0aa07f Changes from PR feedback. Long comments following code in a line will now trigger, configuration will now fail if invalud value types are set for options 2017-02-06 15:33:44 -05:00
Michael Welles ccc840b340 Changed LineLengthConfigurationFlag enum to be an OptionSet struct, per pull request feedback 2017-01-31 13:56:26 -05:00
Michael Welles cd843e7fcd Added "ignores_comments" and "ignores_function_declarations" as boolean options to LineLengthRule 2017-01-30 17:51:56 -05:00
JP Simard 9e7cdc3282 update SwiftLintFramework/Protocols to follow Swift 3 API Design Guidelines 2017-01-09 19:19:25 -08:00
Javier Hernández 7b3648899d Extract line length tests to their own test files 2017-01-06 01:08:50 +01:00