11 Commits

Author SHA1 Message Date
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
Danny Mösch ec38c244fd Refactor rule list documentation (#4763) 2023-02-13 21:22:10 +01:00
Vasiliy Kattouf ad29864d7f Add markdown local links to listed rules (#4762) 2023-02-12 23:22:09 +01:00
Ethan Wong 68dc0f58d2 List Analyzer rules in an independent section in the rule directory (#4664) 2023-01-03 07:18:25 +01:00
JP Simard b2caef7202 Generate Swift Syntax Dashboard in documentation (#4260)
This is a useful overview of where the migration effort stands and what
rules can be migrated next.
2022-10-01 11:29:10 -04:00
Natan Rolnik fe905f8ae9 Fix default rules section in documentation (#3857)
While browsing the rules documentation, I noticed **many** rules were both in the Default Rules and in the Opt In Rules section.

After looking into it, the docs of the `drop(while predicate: (Element) throws -> Bool` function states:

A closure that takes an element of the sequence as its argument and returns true if the element should be skipped or false if it should be included. **Once the predicate returns false it will not be called again.**

This caused the `defaultRuleDocumentations` array to contain almost all `ruleDocumentation`.
2022-02-15 06:23:05 -08:00
Ethan Wong bb37a253e2 Add rule identifiers in 'Rule Directory' documentation page. 2022-01-21 10:43:09 -05:00
Benny Wong 210874f4d8 Documentation: Separate out default rules vs opt in rules in rule list (#3758) 2021-11-29 17:50:14 +00: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 d2643db495 [Docs] Build docs using jazzy (#3016)
* Add `.jazzy.yaml` configuration file
* Update `swiftlint generate-docs` to write docs to a directory rather than a single file
* Add jazzy to the Gemfile
* Run `bundle update`
* Add CI job to run jazzy automatically and publish to GitHub Pages

![swiftlint-jazzy](https://user-images.githubusercontent.com/474794/71799038-fcf4e180-3008-11ea-81fa-3eb9cf296506.gif)
2020-01-07 20:31:29 -08:00