Commit Graph

183 Commits

Author SHA1 Message Date
Danny Mösch 5eed8fe91b
Enable `if_let_shadowing` rule and fix all violations (#4247) 2023-01-31 22:31:38 +01:00
Ryan Aveo 92304cdd98
Fix building tests in Xcode (#4607)
Co-authored-by: JP Simard <jp@jpsim.com>
2022-11-30 10:33:33 -05:00
Danny Mösch 32152646f3
Use `Self` in constructor calls (#4505) 2022-11-02 22:50:22 +00:00
Andrés Cecilia Luque af59581b66
Fix specifying the cachePath from command line (#3797) 2022-01-21 08:01:48 -08:00
Danny Mösch 050473a0e1
Add optional prefer_self_in_static_references rule (#3732) 2021-11-29 18:42:53 +00:00
JP Simard 3e04acd97d
Revert "Revert "Fix issue that prevented the inclusion of a configuration file from a parent folder (#3491)""
This reverts commit b66f7c7992.
2021-02-26 11:44:10 -05:00
JP Simard b66f7c7992
Revert "Fix issue that prevented the inclusion of a configuration file from a parent folder (#3491)"
This reverts commit 2f6fd1e95f.
2021-02-25 14:49:10 -05:00
Artem Garmash 4266ea9d60
Add Bool violation reporting in `redundant_type_annotation` (#3438)
* Add Bool violation detection

* Update Changelog

* Fix issues found by the rule
2021-02-24 14:29:08 -08:00
Frederick Pietschmann 2f6fd1e95f
Fix issue that prevented the inclusion of a configuration file from a parent folder (#3491)
* Add (currently failing) test for #3485

* [#3485] Add missing rootDir adjustment for included / excluded paths

* Add changelog entry

* Adjust tests for relative included / excluded paths
2021-02-23 18:19:19 -05:00
JP Simard 01b1001a81
fixup! Don't log a warning if no configuration files were explicitly specified 2020-12-11 10:02:16 -05:00
JP Simard cb3eed544c
Add FileGraphInitializationResult to make error handling more explicit 2020-12-11 09:27:51 -05:00
JP Simard ab700a3262
Re-add warning message if the config file was implicit and misconfigured
Thanks fredpi!
2020-12-10 09:37:09 -05:00
JP Simard 35d75809c9
Fix typo 2020-12-09 17:16:50 -05:00
JP Simard 2b50902d1a
Revert most changes, just don't log a warning 2020-12-09 17:14:04 -05:00
JP Simard d010569f1d
Extract out error string generation 2020-12-09 16:26:10 -05:00
JP Simard 82e5870a16
Don't log a warning if no configuration files were explicitly specified
And none was found at the default location of `.swiftlint.yml`.
2020-12-09 16:16:04 -05:00
Frederick Pietschmann 4c5a3f0577 Add remote, parent & child configuration features 2020-11-20 23:08:37 +01:00
Dalton Claybrook d305e03905
Add `inclusive_language` rule (#3243)
Current events have renewed the conversation in our community about the roles of terminology with racist connotations in our software. Many companies and developers are now taking appropriate steps to remove this terminology from their codebases and products. (e.g. [GitHub](https://twitter.com/natfriedman/status/1271253144442253312)) This small rule prevents the use of declarations that contain any of the terms: whitelist, blacklist, master, and slave. It may be appropriate to add more terms to this list now or in the future.
2020-11-07 22:03:08 -05:00
Paul Taykalo 693ee2cae9
Add Isnot Empty extension in the Swift Framework (#3387) 2020-11-07 18:42:55 -05:00
David Harris 8c789bb3e2 feature: add config setting to exist successfully in case of no lintable (#2732)
files
2020-02-08 13:33:50 -08: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
Marcelo Fabri 3a36212b94 Swift 5 support (#2720)
* Update project to compile with Xcode 10.2

* Fix explicit_acl with Swift 5

* Update macOS VM image

* Fix ConfigurationTests on Swift 5

* Update Podspec

* Workaround SR-10486 to fix validation tests

* Fix testDetectSwiftVersion on Swift 5

* Update specs repo when validating CocoaPods spec

* Fix redundant_set_access_control tests

* Manually update Package.resolved

* Use .upToNextMinor

* [Azure Pipelines] Add `sw_vers`

* Relax expecting conditions for crashing output in `testSimulateHomebrewTest()`

Because TSAN makes `swiflint` to produce additional output on crashing.

* Add CHANGELOG entry

* Ignore extensions in explicit ACL rules

* Work around SR-10486 for Sourcery
2019-04-28 21:10:06 -07:00
Paul Taykalo 1b0ac66334 Update reduce to reduce:into for a bit faster running (#2657) 2019-02-22 09:29:39 -08:00
Kim de Vos b5c5701e90 Warn when disabling non existing rules (#2504)
* Added violations when trying to disable non valid rule

* Added violations when trying to disable non valid rule

* Add changelog enty for 'superfluous_disable_command' improvement

* Uses all rule identifiers when running nonValidSuperfluousCommandViolations

* Address feedback from jpsim

* Uses all rule identifiers when running nonValidSuperfluousCommandViolations

* Address more feedback from jpsim

* Added customRuleIdentifiers when verifying undefinedSuperfluousCommandViolations

* Catch all invalid disable commands in a region

Not just the first one.

* Rename test
2019-01-13 15:10:44 -08:00
JP Simard 0e01e07326
#2441 - Fix inaccessible custom rules in nested configurations (#2556)
* #2441 - Pass custom rules identifiers to the enableRules function to consider custom rules of a parent of a nested configuration

* #2441 - Add custom rules merge

* #2441 - Fix line length violation

* #2441 - Add nested configutaion mocks with custom rules

* #2441 - Add nested configurations tests for custom rules

* #2441 - Disable function body length check

* #2441 - Update changelog

* Move changelog to appropriate position

* Split up and refactor Configuration.init to avoid being too long

* Add tests to LinuxMain.swift

* Remove redundant protocol conformances

Hashable implies Equatable

* Fix typo in changelog entry and add another fixed issue URL
2019-01-13 15:07:27 -08:00
Kim de Vos d62e187b5c Add Legacy Hashing rule (#2496) 2018-12-05 15:43:39 -08:00
JP Simard 0e862ca9c4
Enable vertical whitespace rules in SwiftLint
and fix violations
2018-12-02 14:01:23 -08:00
Kim de Vos bf97e08fa7 Exit immediately when linting with a version other than swift_version if defined (#2491) 2018-11-29 12:40:29 -08:00
JP Simard 5901d3075f
Require Swift 4.2 (#2466)
This bumps the minimum version required to build SwiftLint to 4.2. The primary motivating factor to drop support for Swift 4.0-4.1.x is that SwiftLint now uses CryptoSwift, which requires 4.2.

* Add changelog entry

* Remove --allow-warnings flag from CocoaPods commands

* Update CryptoSwift to 0.13.0

* Migrate to Swift 4.2

* Remove CircleCI tests for Swift < 4.2

* Update English and Chinese README

Korean README doesn't yet have a version table like this.

* Update gems

* Add changelog entry for fixed compiler warnings

* Update CocoaPods to 1.6.0.beta.2

To work around https://github.com/CocoaPods/CocoaPods/issues/7708
2018-11-18 17:32:25 -08:00
Marcelo Fabri be60504dad Enable identical_operands rule on the project 2018-08-30 23:12:44 -07:00
JP Simard e2b74bd867
Require Swift 4.0 or higher to build. 2018-05-30 14:00:17 +10: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
JP Simard fbeaaeb972
Use Sequence.reduce(into:) when possible 2018-04-22 20:46:46 -07:00
Norio Nomura 133cef8df1
`ObjCBool` is no longer implicitly converted to `Bool` on Linux 2018-04-08 13:28:09 +09:00
JP Simard fa13551af1
Rename Configuration.Indentation to IndentationStyle
and move to its own file
2018-01-03 23:21:23 -08:00
JP Simard 5fd67018bb
Fix comment alignment 2018-01-03 23:16:37 -08:00
Noah McCann fa5815e9f5
Extracted rule logic to separate function to address linting errors 2018-01-03 23:05:48 -08:00
Noah McCann ab29b75d20
Addressed most linting errors 2018-01-03 23:05:48 -08:00
Noah McCann 093367073a
Renamed IndentationMode to Indentation, better handled default value 2018-01-03 23:05:48 -08:00
Noah McCann 38f869bf81
Added indentationMode to configuration, updated parsing to handle it 2018-01-03 23:05:48 -08:00
JP Simard 3a32d6b479
Speed up reading cached results by about 200%
also slightly speed up writing to the cache.

For example, on the Lyft codebase with 1,500 Swift files:

```bash
$ time swiftlint lint --quiet
swiftlint --quiet  3.53s user 0.27s system 388% cpu 0.979 total
$ rm -rf ~/Library/Caches/SwiftLint && time swiftlint lint --quiet
swiftlint --quiet  35.20s user 1.22s system 371% cpu 9.806 total
$ time swiftlint lint --quiet
swiftlint lint --quiet  0.90s user 0.13s system 218% cpu 0.472 total
$ rm -rf ~/Library/Caches/SwiftLint && time swiftlint lint --quiet
swiftlint lint --quiet  31.78s user 1.18s system 360% cpu 9.146 total
```
2017-10-19 23:17:01 -07:00
JP Simard 08e0c816f3
Make `Configuration` conform to `Hashable` 2017-10-19 22:50:07 -07:00
JP Simard 757443d201
Correct and speed up equality checks for `Configuration` values
they previously didn't account for `warningThreshold` or `cachePath`.
2017-10-19 22:28:04 -07:00
Marcelo Fabri d4f4f5f35c Sort list of rule identifiers before printing them 2017-10-05 11:51:36 -03:00
Marcelo Fabri be341f90b9 Introduce queuedFatalError
`fatalError` prints the full path of the file, which leaks filesystem information from the machine that built the binary. Now that we release via CocoaPods, this is more critical.
2017-09-30 15:07:23 -03:00
Marcelo Fabri 54f9c22c60 Fix existing violations 2017-08-26 10:05:56 -03:00
Marcelo Fabri d4248e9b12 Fix tests on Linux 2017-08-17 20:36:44 +02:00
Stéphane Copin 3ad4842bcd
Small changes and refactoring based on github Feedback 2017-08-02 13:05:26 -07:00
Stéphane Copin 9f1f454cf9
Refactor the way Configuration objects are created with regards to rules 2017-08-02 13:05:26 -07:00