Commit Graph

28 Commits

Author SHA1 Message Date
Martin Redington 7623f1e730 Enable more rules in SwiftLint's own .swiftlint.yml (#5532) 2024-04-27 18:43:08 +02:00
Simon Støvring 9054ec0658 Add test verifying that the file_header rule can require an empty file header (#4928) 2023-05-01 18:47:37 +02:00
JP Simard a7bc9e20c7 Move built-in rules to new SwiftLintBuiltInRules module (#4950) 2023-04-27 11:16:01 -04:00
JP Simard 4c04cdafa7 Introduce SwiftLintTestCase
To consistently set up rules before tests
2023-04-25 12:28:50 -04:00
JP Simard c84124d8bc Enable all tests when using rules_xcodeproj (#4723)
* Revert "Skip tests requiring runfiles support when testing with rules_xcodeproj (#4694)"

This reverts commit 040096a641.

* Enable all tests when using rules_xcodeproj

Turns out we don't need runfiles support
(https://github.com/buildbuddy-io/rules_xcodeproj/issues/828) since the
tests run outside the sandbox in Xcode, so we can get the path to these
files from the `BUILD_WORKSPACE_DIRECTORY` environment variable that
`bazel test` sets.
2023-01-26 21:18:05 -05:00
JP Simard 040096a641 Skip tests requiring runfiles support when testing with rules_xcodeproj (#4694)
rules_xcodeproj doesn't support runfiles yet:
https://github.com/buildbuddy-io/rules_xcodeproj/issues/828
2023-01-16 13:09:56 -05:00
JP Simard 4bd7da32ea Reduce visibility of rules to be internal (#4533)
There's no reason to expose these publicly and this will make it nicer
to move to a new module outside of the core SwiftLint functionality.
2022-11-09 11:01:26 -05:00
Danny Mösch c1b74cd752 Rename test classes (#4083) 2022-08-11 07:33:11 +02:00
Danny Mösch cdb87e3869 Verify all examples provided in rule descriptions (#4061) 2022-08-04 23:06:37 +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
Paul Taykalo ac40778cb3 Use SwiftLintFile wrapper over the File 2019-11-07 15:19:17 +02:00
JP Simard 0e862ca9c4 Enable vertical whitespace rules in SwiftLint
and fix violations
2018-12-02 14:01:23 -08:00
Anders Hasselqvist 2fee6db032 Support file placeholder with required/forbidden_string 2018-06-13 20:05:02 +09:00
Anders Hasselqvist 58202772d3 Support placeholder for forbidden_pattern
- Move regex creation for *_pattern to FileHeaderConfiguration
- Switch to using test fixures for the tests
2018-06-13 19:55:27 +09:00
Anders Hasselqvist 15af1a778f Add file name matching to file_header rule
Add support of inserting a SWIFTLINT_CURRENT_FILENAME placeholder in the required_pattern.
The placeholder will be replaced by the lastPathComponent of the file's path.
2018-06-13 19:55:27 +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
Marcelo Fabri d21262d1bc Ignore SwiftLint commands in file_header rule
Fixes #1810
2017-09-30 00:29:23 -03:00
JP Simard 5c1c9389c7 produce an error when a 'disable' command doesn't silence any rules 2017-08-20 23:27:48 +02:00
Marcelo Fabri d79f642c43 Make file_header rule ignore doc comments.
Fixes #1719
2017-08-01 13:51:31 +02:00
Marcelo Fabri f6a28d9c33 Run tests against all rules 2017-07-26 10:20:02 +02:00
Marcelo Fabri 63e95a22c5 Refactoring tests that create RuleDescriptions 2017-07-02 17:10:26 +02:00
Marcelo Fabri e86763739f Move kind to RuleDescription 2017-07-02 15:50:16 +02:00
JP Simard 25a92c4e03 automatically generate LinuxMain.swift using Sourcery
This adds 6 tests that were accidentally not being run on Linux:

* LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresComments
* LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresFunctionDeclarations
* LineLengthConfigurationTests.testLineLengthConfigurationThrowsOnBadConfigValues
* LineLengthRuleTests.testLineLengthWithIgnoreCommentsEnabled
* LineLengthRuleTests.testLineLengthWithIgnoreFunctionDeclarationsEnabled
* RegionTests.testSeveralRegionsFromSeveralCommands
2017-06-02 14:28:37 -07:00
Marcelo Fabri 9e4d464e45 Add violation markers in rules 2016-12-18 01:07:51 -02:00
JP Simard 97e798dc70 add LinuxMain.swift and allTests extensions
to run all unit tests on Linux
2016-12-11 14:04:49 -08:00
Marcelo Fabri 1c59d8fb6e Updating rule description 2016-12-08 18:29:57 -02:00
Marcelo Fabri 9f1294abfc Make it green 2016-12-08 18:29:57 -02:00
Marcelo Fabri ac0b0824c9 Swift 3 migration 2016-12-08 18:29:57 -02:00