Commit Graph

3020 Commits

Author SHA1 Message Date
p-x9 7ea514b77a Fixed error in character limit per line. 2021-05-21 14:33:16 -07:00
p-x9 f0c707f477 Fix indents 2021-05-21 14:33:16 -07:00
p-x9 04a41bdb2f Fix Autocorrect on no space between the tuple and "in" in unneeded_parentheses_in_closure_argument 2021-05-21 14:33:16 -07:00
raduciobanu002 07c8e52fc8 "Colon Spacing" rule name update (#3583)
* * Changed rule name from "Colon" to "Colon Spacing"
* Updated tests

* Update CHANGELOG.md

Co-authored-by: Seth Friedman <sethfri@gmail.com>
2021-05-20 23:46:54 -04:00
Steven 625cd180ae Fix type_contents_order initializer detection (#3622) 2021-05-10 09:56:21 -04:00
Dan Loman dd672b4b0c [bug fix] expiring todo regex (#3597)
* Add failing tests

* Fix regex to allow non-zero-padded dates

* Update changelog

* Update CHANGELOG.md
2021-05-02 17:12:52 -04:00
Marcelo Fabri 4e3c87e2f3 Fix false positive in empty_enum_arguments (#3616)
Fixes #3562
2021-04-28 20:25:05 -07:00
Marcelo Fabri a10158c475 Add duplicated_key_in_dictionary_literal rule (#3613) 2021-04-28 17:25:08 -07:00
Dylan Maryk 5a3844401b Fix missing comma in description (#3588) 2021-04-27 22:51:37 -07:00
Keith Smiley 7976b74615 Add test functions with parameters to TestCaseAccessibilityRule (#3612)
If a function starts with `test` but takes some parameters, it is not
actually a test.
2021-04-26 20:04:04 +00:00
JP Simard 4039eff984 Release 0.43.1 2021-03-15 13:13:51 -04:00
JP Simard 60ec029e1b Re-add --format flag to reformat Swift files using SourceKit (#3573)
Missed during the migration from Commandant to swift-argument-parser in
https://github.com/realm/SwiftLint/pull/3465.

Fixes https://github.com/realm/SwiftLint/issues/3571.
2021-03-15 11:15:09 -04:00
Stephen Williams c1b77f8e0a Rename the “File Line Length” rule to just “File Length” 2021-03-08 09:29:51 -05:00
JP Simard da2ca76953 release 0.43.0 2021-03-03 16:01:42 -05:00
JP Simard e47fb60c7a Regenerate Sourcery output 2021-03-03 15:41:50 -05:00
JP Simard 92061e84b5 Merge pull request #3550 from realm/fix-oss-check-noise
Fix OSSCheck noise
2021-03-03 15:10:40 -05:00
JP Simard aa32742abf Revert OSSCheck changes for faster debugging 2021-03-03 14:43:37 -05:00
JP Simard 027f130e8c fixup! Fix OSSCheck noise 2021-03-03 11:36:09 -05:00
JP Simard 7f7fc03a8f Fix OSSCheck noise
Try a few things:

1. Sort InclusiveLanguageRule terms since they're a Set and don't have
  deteministic ordering (will definitely help)
2. Fetch remote at the beginning of the script (likely to help)
3. Only fetch remote once (likely to help)
4. Sort branch & master output before diffing (unlikely to help)
5. Change diff filter from `d` to `AMRCU` (no idea if it will help)
2021-03-03 11:19:41 -05:00
JP Simard eec4c58e1f Fix parsing xcode logs for analyzer rules for target names with spaces 2021-03-03 10:36:22 -05:00
László Kustra 87d4accb39 Add "Capture non-constant variable" rule 2021-03-02 16:11:33 -05:00
JP Simard 0a0fb1e71b File false negatives in unused_declaration
When a declaration refers to an Objective-C type but doesn't have an
explicit `@objc` attribute.

It would have the string `@objc` embedded in its USR. So add a space so
we only trigger this condition when there's an explicit `@objc`
attribute in the declaration source code.

The triggering example added here didn't trigger before this change.
2021-03-02 11:36:06 -05:00
Otavio Cordeiro 24122e1325 Rename Rule to BalancedXCTestLifecycleRule 2021-03-01 01:29:16 +01:00
Otavio Cordeiro a6a5e633d0 Add support to unbalanced teardown methods 2021-03-01 01:18:30 +01:00
Otavio Cordeiro 3fbc482a2e Add MARKs
to trigger a new build.
2021-02-28 23:48:06 +01:00
Otavio Cordeiro cdd877c289 Add examples for static setUp and tearDown 2021-02-28 23:48:06 +01:00
Otavio Cordeiro bd4dcd5b23 Add required_xctest_tearddown opt-in rule 2021-02-28 23:48:05 +01:00
JP Simard 3e04acd97d Revert "Revert "Fix issue that prevented the inclusion of a configuration file from a parent folder (#3491)""
This reverts commit b66f7c7992.
2021-02-26 11:44:10 -05:00
JP Simard 706abfe9e3 Tweak the auto-correction result console output for clarity (#3522)
A colleague was confused by the output of `swiftlint autocorrect`, she
couldn't understand why SwiftLint told her it corrected thousands of
files when she only touched one.

The "Done correcting \(files.count) ..." output made her think that a
change was made on each of the `files`, when really they had only been
inspected.

A good solution would be to adopt a similar approach as the `lint`
command does.

Not being familiar with the codebase, I though a good first step could
have been to tweak the message a bit, making it clearer that the count
printed to the console is the inspected files.
2021-02-25 17:20:58 -05:00
JP Simard 5b1d737683 Merge pull request #3538 from realm/feature/fix-custom-rules-merging
Multiple fixes for custom rules
2021-02-25 16:14:50 -05:00
JP Simard 721b077608 Add SWIFTLINT_LOG_MODULE_USAGE environment variable for UnusedImportRule
That's because it can currently be difficult to know why a module is
referenced in a file.

To use, run SwiftLint with the environment variable set to the module
whose references you want to log to `stderr`:

    SWIFTLINT_LOG_MODULE_USAGE=MyModule swiftlint analyze ...
2021-02-25 14:53:07 -05:00
JP Simard b66f7c7992 Revert "Fix issue that prevented the inclusion of a configuration file from a parent folder (#3491)"
This reverts commit 2f6fd1e95f.
2021-02-25 14:49:10 -05:00
Frederick Pietschmann 235f598ac7 Fix custom rules bug when using only_rules mode 2021-02-25 19:22:57 +01:00
Frederick Pietschmann 520d224719 Revert "Revert "Merge pull request #3473 from realm/feature/3472-fix-custom-rules-merging" (#3503)"
This reverts commit 6a38b15657.
2021-02-25 19:22:57 +01:00
JP Simard 8326624491 Make discarded_notification_center_observer opt-in (#3537)
It's very common for this rule to produce false positives, and there's
no easy way to address them.

See these issues:
  * https://github.com/realm/SwiftLint/issues/1398
  * https://github.com/realm/SwiftLint/issues/3498
2021-02-25 09:06:00 -08:00
Artem Garmash 4266ea9d60 Add Bool violation reporting in redundant_type_annotation (#3438)
* Add Bool violation detection

* Update Changelog

* Fix issues found by the rule
2021-02-24 14:29:08 -08:00
Bradley Walters 5eb00b79cc Update CodeClimateReporter to produce relative paths (#3499)
GitLab and the CodeClimate spec both expect these paths to be relative.

https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool
https://github.com/codeclimate/platform/blob/690633cb2a08839a5bfa350ed925ddb6de55bbdc/spec/analyzers/SPEC.md#locations
2021-02-24 14:16:18 -08:00
JP Simard 559470a245 Integrate OS Signposts to help profile SwiftLint performance (#3535)
* Integrate OS Signposts to help profile SwiftLint performance

* Split LintOrAnalyzeCommand.lintOrAnalyze(_:) into two functions

Using a builder reference type to share common mutable state.
2021-02-24 10:03:53 -08:00
Frederick Pietschmann 2f6fd1e95f Fix issue that prevented the inclusion of a configuration file from a parent folder (#3491)
* Add (currently failing) test for #3485

* [#3485] Add missing rootDir adjustment for included / excluded paths

* Add changelog entry

* Adjust tests for relative included / excluded paths
2021-02-23 18:19:19 -05:00
Thomas Goyne 8f216b8398 Support Swift Playground control comments in the comment spacing rule
Swift Playgrounds use `//:` to mark prose sections and `//:#` for embedded
content like images and localized prose, so those shouldn't violate the
space-after-comment rule.
2021-02-23 17:33:20 -05:00
JP Simard eca9ea4bb8 Adding Legacy ObjC Type Rule #2758 (#3531) 2021-02-23 12:08:01 -08:00
JP Simard cfd67b9534 Make strong-iboutlet rule correctable (#3530)
* Make strong-iboutlet rule correctable

* fixup! Make strong-iboutlet rule correctable

Co-authored-by: Max Haertwig <dev@maxhaertwig.com>
2021-02-23 11:37:23 -08:00
JP Simard 6b51c3ebc5 [UnusedDeclarationRule] Fix false positives with result builders (#3528) 2021-02-23 07:59:37 -08:00
JP Simard 60242fd599 [UnusedDeclarationRule] Allow configuration related USRs to skip (#3525)
For example you might have custom source tooling that does something
with types conforming to a procotol even if that type is never
explicitly referenced by other code.
2021-02-17 12:25:23 -08:00
Gio Lodi 8248178213 Tweak the auto-correction result console output for clarity
A colleague was confused by the output of `swiftlint autocorrect`, she
couldn't understand why SwiftLint told her it corrected thousands of
files when she only touched one.

The "Done correcting \(files.count) ..." output made her think that a
change was made on each of the `files`, when really they had only been
inspected.

A good solution would be to adopt a similar approach as the `lint`
command does.

Not being familiar with the codebase, I though a good first step could
have been to tweak the message a bit, making it clearer that the count
printed to the console is the inspected files.
2021-02-16 20:41:04 +11:00
Otavio Cordeiro 46777539ad Add opt-in rule private_passthrough_subject (#3504) 2021-02-08 10:43:27 -08:00
Colton Schlosser 01a0f82e99 Improve parallelMap implementation by removing iteration for force unwrapping every element (#3517) 2021-02-08 06:37:20 -05:00
Otavio Cordeiro 7ea9b733ff Allow multi-line parameters rule to always break lines (#3494) 2021-02-02 13:27:29 -08:00
JP Simard bbf1ad4a18 [ExplicitSelfRule] Fix violation location and misplaced corrections (#3507) 2021-01-29 10:59:28 -08:00
Otavio Cordeiro 59eb887cfa Add opt-in rule discouraged_assert (#3506)
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
2021-01-29 09:30:57 -08:00