Commit Graph

19 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
Martin Redington 7dad240ea7 Add a reporters subcommand (#4836) 2023-03-31 08:09:01 +02:00
Zev Eisenberg fcf848608e Add Inline test failure messages (#3040)
* Add Example wrapper in order to display test failures inline when running in Xcode.
* Stop using Swift 5.1-only features so we can compile on Xcode 10.2.
* Wrap strings in Example.
* Add Changelog entry.
* Wrap all examples in Example struct.
* Better and more complete capturing of line numbers.
* Fix broken test.
* Better test traceability.
* Address or disable linting warnings.
* Add documentation comments.
* Disable linter for a few cases.
* Limit mutability and add copy-and-mutate utility functions.
* Limit scope of mutability.
2020-02-02 10:35:37 +02:00
JP Simard 37167a8a35 Add documentation comments to all public declarations (#3027) 2020-01-08 09:47:10 -08:00
JP Simard dcc85fb0f3 Remove unused imports (#2382) 2018-09-02 14:09:04 -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 ccf85e87c3 Make emoji and checkstyle reporter to output report sorted by file name
Fixes #1429
2017-04-12 22:36:27 +09:00
Yuki Oya f590507270 Remove empty identifier case. 2017-03-20 23:37:54 +09:00
Yuki Oya a3cf8451e0 Fix unique file element 2017-03-20 21:57:34 +09:00
Yuki Oya be5daeb993 Add source attribute 2017-03-20 19:08:35 +09:00
Fabian Ehrentraud 2f8c54d3c7 uppercase XML 2016-12-13 12:33:05 -08:00
Fabian Ehrentraud 223f2defd1 fixed <nopath> not being xml encoded + use <nopath> for html reporter too 2016-12-13 12:33:05 -08:00
Fabian Ehrentraud ea5f3319ca escape characters for xml reporters 2016-12-13 12:32:32 -08:00
JP Simard 576e1a5d4d remove unnecessary .lowercased() calls
now that ViolationSeverity is already lowercase.
2016-12-01 22:29:09 -08:00
JP Simard 39e1001629 make lots of Swift 3 related changes
many of which are to help with otherwise very long compile times
2016-12-01 00:34:29 -08:00
Norio Nomura 8bf15f1dba Migrate to Swift 3.0 2016-10-09 01:09:50 +09:00
JP Simard 59db289356 rewrite CheckstyleReporter.generateReport to compile 100x faster
before: 10s
after: 100ms
2016-01-18 13:52:37 -08:00
JP Simard e546ecb094 add checkstyle reporter. addresses #277 2015-12-25 02:31:38 -05:00