Commit Graph

90 Commits

Author SHA1 Message Date
Danny Mösch 4065fc8437 Enable upcoming feature MemberImportVisibility (#6286) 2025-10-08 08:12:05 +02:00
Danny Mösch 7321f2bbd0 Warn about implicit overrides (#5936) 2025-01-04 11:29:26 -05: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
JP Simard 165172e0fa Introduce a "rule registry" concept
This will allow for registering rules that aren't compiled as part of
SwiftLintFramework.

Specifically this will allow us to split the built-in and extra rules
into separate modules, leading to faster incremental compilation when
working on rules since the rest of the framework won't need to be
rebuilt on every compilation.
2023-04-25 12:28:50 -04:00
Danny Mösch 3d15419adb Fix warnings in Swift 5.8/Xcode 14.3 (#4850) 2023-03-31 22:13:20 +02:00
Martin Redington 7dad240ea7 Add a reporters subcommand (#4836) 2023-03-31 08:09:01 +02:00
Martin Redington 5a91b1e392 Fixed display of optin and correctable (#4841)
Co-authored-by: Martin Redington <mildm8nnered@gmail.com>
2023-03-27 07:48:51 +02:00
Martin Redington f2d15355be Add a summary table reporter (#4820) 2023-03-25 08:28:42 +01:00
Michael S 9c216baf20 Add new relative-path reporter (#4739) 2023-02-07 23:23:00 +01:00
Danny Mösch 5af4291b53 Let Emoji reporter print rule identifier (#4708) 2023-02-06 16:28:07 -05:00
Danny Mösch 0796236031 Use text blocks in reporters if reasonable (#4733) 2023-01-30 16:38:07 -05:00
Patrick 651b00eb70 Updated JUnit reporter (#4725) 2023-01-30 20:48:29 +01:00
JP Simard 05ac3c9d75 Require macOS 12 & Swift 5.6 (#4037)
This will unblock using Swift Concurrency features and updating to the
latest versions of Swift Argument Parser.

This won't drop support for linting projects with an older toolchain /
Xcode selected, as long as SwiftLint was _built_ with 5.6+ and is
_running_ on macOS 12+. So the main breaking change for end users here
is requiring macOS 12 to run.

However, the upside to using Swift Concurrency features is worth the
breaking change in my opinion. Also being able to stay on recent Swift
Argument Parser releases.
2022-07-26 03:55:36 -04:00
Marcelo Fabri f880b66cbf Rewrite operator_usage_whitespace with SwiftSyntax (#3962) 2022-05-06 16:48:57 -07:00
HA Pors 8d0aeb995d Generate fingerprint with relativefile (#3860)
* Change fingerprint generation to use relativeFile instead of location in order to support CI/CD on multiple machines.

* Created copy of location with relativeFile instead of file to generate fingerprint.

Co-authored-by: Henk Pors <hpors@anwb.nl>
2022-02-17 08:29:16 -08:00
Bradley Walters 5eb00b79cc Update CodeClimateReporter to produce relative paths (#3499)
GitLab and the CodeClimate spec both expect these paths to be relative.

https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool
https://github.com/codeclimate/platform/blob/690633cb2a08839a5bfa350ed925ddb6de55bbdc/spec/analyzers/SPEC.md#locations
2021-02-24 14:16:18 -08:00
Jan-Otto Kröpke 874cacbd1f Add codeclimate reporter (#3425) 2020-11-11 10:29:00 -08:00
Alexander Chapliuk ef4a37ee1e JUnit reporter for GitLab artifact:report:junit (#3177)
* Add JUnit reporter for GitLab artifact:report:junit

* Added CHANGELOG entry

Co-authored-by: Alexander Chapliuk <2318002+krin-san@users.noreply.github.com>
2020-04-12 17:14:52 +03: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 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
Norio Nomura 80d3813214 Add GitHub Actions Logging reporter (github-actions-logging)
Use [GitHub Actions Logging](https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#logging-commands) same as https://github.com/norio-nomura/action-swiftlint does.
2019-11-04 19:36:25 +09:00
Paul Taykalo 1b0ac66334 Update reduce to reduce:into for a bit faster running (#2657) 2019-02-22 09:29:39 -08:00
Dani Vela b58c4e35bb Add markdown reporter (#2486) 2018-11-27 12:31:12 -08:00
Marcelo Fabri dfb447490e Enable collection_alignment on SwiftLint 2018-09-11 09:31:54 -07:00
JP Simard dcc85fb0f3 Remove unused imports (#2382) 2018-09-02 14:09:04 -07:00
Yusuke Ohashi 2e55028053 update as per comments 2018-08-16 15:03:21 +09:00
Yusuke Ohashi a941b2f242 added SonarQube reporter. 2018-08-16 15:02:47 +09: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
Andrew Tetlaw 0a590e8ebe Removed that trailing return 2017-10-01 11:44:37 +08:00
Andrew Tetlaw 4a37839401 Output CSV in rows
- changed CSV reporter to out put the header row and each violation row with returns, in the way that can be imported into a spreadsheet for example.
- updated the test output CSV file for the unit test
2017-10-01 11:34:49 +08:00
JP Simard 6367d541b2 Improve compile time by speeding up slow type inference expressions 2017-09-19 17:26:24 -07:00
Marcelo Fabri 0bf1179c83 Validating trailing closure even if there's only one param 2017-07-24 00:50:31 +02:00
Marcelo Fabri c01f4bd19f Enable extension_access_modifier rule 2017-07-21 21:08:52 +02: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
JP Simard 00cd61ab17 update SwiftLintFramework/Reporters to follow Swift 3 API Design Guidelines 2017-01-09 19:31:19 -08:00
JP Simard a16e77c39e fix swiftlint version with SPM
all done by @marcelofabri, originally in #1073
2017-01-07 00:09:27 -08:00
JP Simard f36e28e0a6 prefer 'joined()' over 'joined(separator: "")'
since that's the default separator.

Rule for this requested in #1093.
2016-12-30 10:30:03 -08:00
JP Simard c82cc6d9f6 fix JSON reporter on Linux and re-enable its unit test
the printed JSON string is slightly different on Linux than it is on
Darwin, but produces equivalent JSON
2016-12-22 10:39:26 -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