Commit Graph

8 Commits

Author SHA1 Message Date
Danny Mösch 5eed8fe91b
Enable `if_let_shadowing` rule and fix all violations (#4247) 2023-01-31 22:31:38 +01:00
JP Simard d10ccacb45
Add unused_import config options to require imports for each module used (#3123)
For example, if `CGFloat` is used in a file where only `UIKit` is imported but not `CoreGraphics`, this will be a violation even if the file previously compiled.

This is because Swift allows referencing some declarations that are only transitively imported.

Enabling the `require_explicit_imports` configuration option will require that the module of every declaration referenced in a source file be explicitly imported.

This will add significant noise to the imports list, but has a few advantages:

1. It will be easier to understand all the dependencies explicitly referenced in a source file.
2. Correcting the `unused_import` rule will no longer introduce compilation errors in files that compiled prior to the correction.

If missing imports are added to a file when correcting it, the `sorted_imports` rule will be automatically run on that file.

If you with to allow some imports to be implicitly importable transitively, you may specify the `allowed_transitive_imports` configuration:

```yaml
unused_import:
  require_explicit_imports: true
  allowed_transitive_imports:
    - module: Foundation
      allowed_transitive_imports:
        - CoreFoundation
        - Darwin
        - ObjectiveC
```
2020-02-22 14:39:07 -08:00
JP Simard 37167a8a35
Add documentation comments to all public declarations (#3027) 2020-01-08 09:47:10 -08:00
JP Simard 6f0318e1b3
Another attempt to fix compiler issues with CocoaPods 2018-05-05 16:57:13 -07:00
JP Simard 6ff33e675b
Refactor 2018-05-05 16:24:54 -07:00
JP Simard 382263868e
Tweak code format for arrays 2018-04-28 15:28:13 -07:00
Daniel Metzing 9a7005912a Add modifiers_order rule 2018-04-26 20:25:58 +02:00
Daniel Metzing c68a28dba5 Adding rule 2018-04-10 22:52:16 +02:00