Commit Graph

21 Commits

Author SHA1 Message Date
JP Simard 5a2cf4b1fe Remove dead code (#6125)
In particular lots of stuff that used to be needed with SourceKit that
we no longer need to keep around.

Identified using Periphery: https://github.com/peripheryapp/periphery
2025-06-21 15:19:37 -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 86d60400c1 Move core SwiftLint functionality to new SwiftLintCore module
Over the years, SwiftLintFramework had become a fairly massive monolith,
containing over 400 source files with both core infrastructure and
rules.

Architecturally, the rules should rely on the core infrastructure but
not the other way around. There are two exceptions to this:
`custom_rules` and `superfluous_disable_command` which need special
integration with the linter infrastructure.

Now the time has come to formalize this architecture and one way to do
that is to move the core SwiftLint functionality out of
SwiftLintFramework and into a new SwiftLintCore module that the rules
can depend on.

Beyond enforcing architectural patterns, this also has the advantage of
speeding up incremental compilation by skipping rebuilding the core
functionality when iterating on rules.

Because the core functionality is always useful when building rules, I'm
opting to import SwiftLintCore in SwiftLintFramework as `@_exported` so
that it's implicitly available to all files in SwiftLintFramework
without needing to import it directly.

In a follow-up I'll also split the built-in rules and the extra rules
into their own modules. More modularization is possible from there, but
not planned.

The bulk of this PR just moves files from `Source/SwiftLintFramework/*`
to `Source/SwiftLintCore/*`. There are some other changes that can't be
split up into their own PRs:

* Change jazzy to document the SwiftLintCore module instead of
  SwiftLintFramework.
* Change imports in unit tests to reflect where code was moved to.
* Update `sourcery` make rule to reflect where code was moved to.
* Create a new `coreRules` array and register those rules with the
  registry. This allows the `custom_rules` and
  `superfluous_disable_command` rule implementations to remain internal
  to the SwiftLintCore module, preventing more implementation details
  from leaking across architectural layers.
* Move `RuleRegistry.registerAllRulesOnce()` out of the type declaration
  and up one level so it can access rules defined downstream from
  SwiftLintCore.
2023-04-26 21:10:19 -04:00
Martin Redington 31510b662e Use all optin rules facility for SwiftLint's own .swiftlint.yml (#4800) 2023-03-11 11:59:05 +01:00
Sara Tavares 436a6f3484 chore(typo): fix typo on func (#4077) 2022-08-10 13:35:42 -04:00
JP Simard 399f5b7df6 Fix docstring formatting issues using DrString (#3032)
Using command:
$ drstring check -i 'Source/**/*.swift' --first-letter lowercase --vertical-align
2020-01-12 11:19:33 -08:00
JP Simard 37167a8a35 Add documentation comments to all public declarations (#3027) 2020-01-08 09:47:10 -08:00
Marcelo Fabri cf0c7b7b21 Use default Equatable and Hashable implementations 2018-11-19 09:51:12 -08:00
Marcelo Fabri 1f121b1ef7 Enable static_operator opt-in rule in SwiftLint 2018-09-16 20:33:28 -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
Norio Nomura 7d0f239e2a Update dependencies
- Update SourceKitten from 0.19.1 to 0.20.0
- Update SWXMLHash from 4.3.6 to 4.6.0
- Update Yams from 0.5.0 to 0.7.0
2018-04-08 13:28:08 +09:00
Marcelo Fabri 03b4d6b020 Fix violations introduced when linting with Swift 4.1
Part of #2021
2018-02-03 22:23:48 -08:00
Marcelo Fabri d082f96284 Add pattern_matching_keywords rule 2017-08-26 10:05:56 -03:00
Marcelo Fabri 33ca7d71f7 Customize YAML loading for configurations
This enables:

1. Using environment variables inside a configuration (fixes #1512)
2. Treating reserved keywords as strings (`yes`, `no`, `on` and `off`) instead of booleans (fixes #1424)
2017-08-01 15:25:27 +02:00
JP Simard 4008fa38f1 refactor YamlParser.parse(_:) 2017-04-06 15:10:15 -07:00
Norio Nomura b5cba7ae40 Replace YamlSwift with Yams 2017-04-03 09:16:04 +09:00
JP Simard 1c55cc8cf5 don't swallow errors in YamlParser.parse(_:) 2017-01-09 16:25:19 -08:00
Norio Nomura df28dcfc13 Update YamlSwift to 3.1.0 2016-11-08 19:29:11 +09:00
Norio Nomura 8bf15f1dba Migrate to Swift 3.0 2016-10-09 01:09:50 +09:00
JP Simard 1866edae77 adjust access control levels for many APIs in SwiftLintFramework
this is done in an effort to stabilize the API for SwiftLint 1.0.
2016-02-10 17:26:06 -08:00
Scott Hoyt 6510960fa6 Began extracting Yaml dependency out of Configuration and into YamlParser 2016-01-11 11:18:54 -08:00