Commit Graph

5273 Commits

Author SHA1 Message Date
JP Simard ddcde3faf1
fixup! Fall back to file system traversal if config files changed 2021-03-08 20:49:26 -05:00
JP Simard adc92db7b6
Fall back to file system traversal if config files changed 2021-03-08 18:02:54 -05:00
JP Simard b5421db0f5
Move specifying git revision from config to CLI 2021-03-08 18:02:53 -05:00
JP Simard 204c32481e
Fix typos 2021-03-08 18:00:47 -05:00
JP Simard 6b59bf0d3e
Docs & dead code 2021-03-08 18:00:47 -05:00
JP Simard e996f50c05
Lint all files changed compared to the merge-base
Between HEAD and the stable git revision. Also include untracked files.
2021-03-08 18:00:47 -05:00
JP Simard 6483fc142a
Add "stable git revision" to configuration
This allows specifying a git revision or "commit-ish" that is considered
stable. If specified, SwifLint will attempt to query the git repository
index for files changed since that revision, using only those files as
input as opposed to traversing the file system to collect lintable
files.
2021-03-08 18:00:47 -05:00
Stephen Williams c1b77f8e0a
Rename the “File Line Length” rule to just “File Length” 2021-03-08 09:29:51 -05:00
JP Simard 058869f446
Require Swift 5.3 or higher to build (#3553)
* Require Swift 5.3 or higher to build

* Remove Swift Version Support tables from readmes

These weren't exactly accurate because SwiftLint should still work with
older Swift versions long after we update the minimum version of Swift
needed to _build_ the tool. So I doubt this table was very helpful to
anyone.
2021-03-04 18:07:04 +00:00
JP Simard ca559c70df
Add empty changelog section 2021-03-03 16:14:58 -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 8b145d4ba4
Merge pull request #3549 from realm/fix-parsing-xcode-logs-for-analyzer-rules-for-target-names-with-spaces
Fix parsing xcode logs for analyzer rules for target names with spaces
2021-03-03 11:35:02 -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 fa1154c9a8
Merge pull request #3547 from realm/file-false-negatives-in-unused_declaration
File false negatives in unused_declaration
2021-03-02 12:05:02 -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 fd97e2259c
Merge pull request #3495 from otaviocc/oc/xctests_setup_teardown
Add opt-in rule balanced_xctest_lifecycle
2021-03-01 02:40:46 +01: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 7c1b5ff757
Update CHANGELOG after git rebase 2021-02-28 23:49:27 +01:00
Otavio Cordeiro a4820f49c2
Update CHANGELOG after git rebase 2021-02-28 23:48:06 +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 9d02cec17f
Merge pull request #3543 from realm/feature/fix-changelog-typo
Fix typo in changelog
2021-02-26 17:22:08 -05:00
Frederick Pietschmann 3d0c87738c Fix typo in changelog 2021-02-26 23:09:54 +01:00
JP Simard 43083f6537
Merge pull request #3542 from realm/relative-config
Fix issue that prevented the inclusion of a configuration file from a parent folder
2021-02-26 13:00:46 -05:00
JP Simard fed8644e01
Remove duplicate disable commands 2021-02-26 12:09:40 -05:00
JP Simard 2009b00366
Add entry to breaking section of changelog 2021-02-26 11:58:14 -05: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 9182eda98c
Disable file & type body length rules in ConfigurationTests 2021-02-26 10:37:47 -05:00
JP Simard 8c29a89888
Fix changelog spacing 2021-02-25 17:21:29 -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 4e2a569aac
Add SWIFTLINT_LOG_MODULE_USAGE environment variable for UnusedImportRule (#3539)
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 15:25:31 -05:00
JP Simard 8b6167c7f2
Add changelog entry 2021-02-25 14:54:51 -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 0dfb04b25a Add 2 new tests for custom rules when in 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
JP Simard 62d558eb53
Fix changelog whitespace 2021-02-24 17:31:53 -05:00
JP Simard 21cf0b77db
Fix changelog entry location 2021-02-24 17:30:04 -05: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