30 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
Danny Mösch 0796236031 Use text blocks in reporters if reasonable (#4733) 2023-01-30 16:38:07 -05:00
JP Simard 37167a8a35 Add documentation comments to all public declarations (#3027) 2020-01-08 09:47:10 -08:00
Paul Taykalo 1b0ac66334 Update reduce to reduce:into for a bit faster running (#2657) 2019-02-22 09:29:39 -08: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 2a0ac455bc 'flatMap' is deprecated: renamed to 'compactMap(_:)' 2018-04-08 13:28:09 +09:00
JP Simard a16e77c39e fix swiftlint version with SPM
all done by @marcelofabri, originally in #1073
2017-01-07 00:09:27 -08:00
Jamie Edge 8c89acdf82 Merge branch 'master' into relative-path-html-report
# Conflicts:
#	CHANGELOG.md
2016-12-21 20:29:41 +00:00
Jamie Edge 22588e7f6a Fix HTML reporter unit test failure. 2016-12-21 15:03:18 +00:00
Jamie Edge daba9abbc9 Add Arial font to improve the appearance of the HTML report. 2016-12-21 13:28:07 +00:00
Jamie Edge 970f29e058 Update the HTML report colour scheme to differentiate warnings and errors. 2016-12-21 12:51:23 +00:00
Jamie Edge 92d761374e Fix HTML output so that it is valid HTML 5. 2016-12-21 12:37:31 +00:00
Jamie Edge b9afeba7fd Switch to a relative path within the HTML report output. 2016-12-21 11:56:33 +00:00
Aaron McTavish d007325ba1 Fix invalid CSS in HTML reporter
Addresses #981 `HTML Reporter - Invalid CSS Styling`.
2016-12-15 07:06:08 +00:00
JP Simard bfdd95c964 minor clean up to HTMLReporter.swift 2016-12-13 12:33:05 -08:00
Fabian Ehrentraud 2f8c54d3c7 uppercase XML 2016-12-13 12:33:05 -08:00
Fabian Ehrentraud c88a5d0371 moved expected html reporter result for tests to external file too 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 19fad01b29 make all enum members lowercase to comply with Swift 3 API Guidelines 2016-12-01 22:16:21 -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 6fc48e34fd Merge commit 'bdeeac6b4c9e20847878b148ecaebf1efeec7a74' into swift3.0
* commit 'bdeeac6b4c9e20847878b148ecaebf1efeec7a74':
  simplify disable in HTMLReporter
  sort master rule list
  fix some older changelog formatting inconsistencies
  exclude test resources from linting

# Conflicts:
#	Source/SwiftLintFramework/Reporters/HTMLReporter.swift
2016-11-30 14:36:56 +09:00
JP Simard bdeeac6b4c simplify disable in HTMLReporter 2016-11-25 11:32:26 -08:00
Norio Nomura 40828dff03 Merge branch 'master' into swift3.0
* master: (41 commits)
  Fix formatting in CHANGELOG.md
  release 0.13.0
  Update CHANGELOG.md
  Fix check for trailing whitespace to return early
  Fix checks for some inline comments
  Replace check for comments to use SyntaxKind
  Add configuration for trailing_whitespace to ignore comments
  Unwanted space removed
  - Lint issues fixed
  Updated HTML Reporter
  PR feedback
  Add check on autocorrect for disabled range
  Use `utf8.count` instead of `utf16.count` to byte range
  Re-write `ExplicitInitRule` to `ASTRule`
  added ExplicitInitRule
  Updated CHANGELOG
  HTML Reporter added
  HTML Reporter added
  Adds information about SwiftLint plugin for AppCode into README.md
  added reasons why a new rule should be opt in
  ...

# Conflicts:
#	Source/SwiftLintFramework/Extensions/File+SwiftLint.swift
#	Source/SwiftLintFramework/Extensions/Structure+SwiftLint.swift
#	Source/SwiftLintFramework/Rules/ColonRule.swift
#	Source/SwiftLintFramework/Rules/CommaRule.swift
#	Source/SwiftLintFramework/Rules/LegacyCGGeometryFunctionsRule.swift
#	Source/SwiftLintFramework/Rules/LegacyConstantRule.swift
#	Source/SwiftLintFramework/Rules/LegacyConstructorRule.swift
#	Source/SwiftLintFramework/Rules/LegacyNSGeometryFunctionsRule.swift
#	Source/SwiftLintFramework/Rules/LineLengthRule.swift
#	Source/SwiftLintFramework/Rules/OperatorFunctionWhitespaceRule.swift
#	Source/SwiftLintFramework/Rules/ReturnArrowWhitespaceRule.swift
#	Source/SwiftLintFramework/Rules/RuleConfigurations/StatementPositionConfiguration.swift
#	Source/SwiftLintFramework/Rules/StatementPositionRule.swift
#	Source/SwiftLintFramework/Rules/TrailingWhitespaceRule.swift
#	Tests/SwiftLintFramework/RuleConfigurationTests.swift
2016-11-04 21:40:56 +09:00
Johnykutty Mathew 757ca5bc04 Unwanted space removed 2016-11-03 17:10:55 +05:30
Johnykutty Mathew e0627a3063 - Lint issues fixed 2016-11-02 14:38:09 +05:30
Johnykutty Mathew af7404aa3d Updated HTML Reporter 2016-11-01 20:00:31 +05:30
Johnykutty Mathew 6fb7ca1246 HTML Reporter added 2016-10-27 18:11:20 +05:30