Commit Graph

199 Commits

Author SHA1 Message Date
Paul Taykalo ac40778cb3 Use SwiftLintFile wrapper over the File 2019-11-07 15:19:17 +02:00
JP Simard ffb2f4f76d Require Swift 5.0 to build (#2857)
* Require Swift 5.0 to build

* Update CI

* Stop testing with Swift 4.x & Xcode 10.0/10.1
* Use official Swift docker image instead of norionomura's
* Use Xcode 10.3 as latest stable version

* Update READMEs

* Fixup xcodeproj

* Fixup CI Swift container image tag

* Fixup changelog
2019-09-03 11:42:57 -04:00
Marcelo Fabri 3879151abf Enable some opt-in rules (#2801) 2019-08-28 14:49:23 -07:00
JP Simard e63e8cad0f Add UnusedDeclarationRule (#2814)
This PR adds a new `unused_declaration` analyzer rule to lint for unused declarations.
By default, detects unused `fileprivate`, `private` and `internal` declarations.
Configure the rule with `include_public_and_open: true` to also detect unused `public` and `open` declarations.

Completely remove the `unused_private_declaration` rule.

This is built on the work enabling collecting rule infrastructure in https://github.com/realm/SwiftLint/pull/2714.
2019-07-18 18:23:43 -07:00
JP Simard 7f4b736ea3 Synthesize Equatable implementations where possible (#2790) 2019-07-01 17:22:18 -04:00
Frederick Pietschmann 3b9917f89d Add nested type handling specification to file_name rule (#2718)
* Add nestedTypeSeparator to FileNameConfiguration

* Add tests for nested_type_separator configurability of file_name rule

* Add changelog entry

* Fix changelog position after rebase
2019-04-30 08:12:43 -07:00
Cihat Gündüz b145d666d0 Fix issues after rebasing to master 2019-03-27 11:54:56 +01:00
Cihat Gündüz 7d43a71510 Add more specific instance property type ib_inspectable 2019-03-27 10:34:41 +01:00
Cihat Gündüz 99f60685a3 Implement equatable protocols manually for Swift 4.0 conformance 2019-03-27 10:34:41 +01:00
Cihat Gündüz ea7f5e6b47 Fix configuration naming issue 2019-03-27 10:34:41 +01:00
Cihat Gündüz e0fb65624b Add configurations for both rules 2019-03-27 10:34:41 +01:00
Cihat Gündüz 3ab600f5a2 [number_separator] Add more non-triggering examples + Rename option to exclude_ranges 2019-02-14 21:19:15 +01:00
Cihat Gündüz 57fe9947a6 [number_separator] Add valid_ranges option instead of ignoring years by default 2019-02-14 21:19:15 +01:00
Marcelo Fabri 293805cf11 Remove unused import 2019-01-24 22:28:45 -08:00
Marcelo Fabri 6fadf80eae Add deployment_target rule
Fixes #2589
2019-01-24 21:42:11 -08:00
Marcelo Fabri f8dda65637 Add only_single_muted_parameter configuration on `trailing_closure 2019-01-17 22:02:47 -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
JP Simard 0e862ca9c4 Enable vertical whitespace rules in SwiftLint
and fix violations
2018-12-02 14:01:23 -08:00
Marcelo Fabri cf0c7b7b21 Use default Equatable and Hashable implementations 2018-11-19 09:51:12 -08:00
Marcelo Fabri 1f121b1ef7 Enable static_operator opt-in rule in SwiftLint 2018-09-16 20:33:28 -07:00
Dalton Claybrook a71bb4dd48 Add more triggering and non-triggering examples 2018-09-10 23:45:56 -04:00
Dalton Claybrook 0597df5b8c Add support for colon alignment 2018-09-10 23:45:56 -04:00
Dalton Claybrook d8a043f84b Create CollectionAlignmentConfiguration 2018-09-10 23:45:56 -04:00
Marcelo Fabri c9f315a798 Merge pull request #2372 from marcelofabri/identical_operands
Add identical_operands opt-in rule
2018-09-09 20:47:49 -07:00
JP Simard dcc85fb0f3 Remove unused imports (#2382) 2018-09-02 14:09:04 -07:00
Marcelo Fabri be60504dad Enable identical_operands rule on the project 2018-08-30 23:12:44 -07:00
JP Simard 1f9a0017e6 Refactor a rule disable command 2018-08-06 14:26:17 -07:00
JP Simard 3961d6482b Organize rules by kind in Xcode project (#2341) 2018-08-05 18:54:05 -07:00
Marcelo Fabri 88f4c8be6f Minor changes after merging #2318 2018-07-30 00:12:02 -07:00
Marcelo Fabri f7f3f3dee5 Merge pull request #2318 from mattremmel/nef10_missing_docs
Added back 'missing_docs' (Nef10)
2018-07-30 00:05:05 -07:00
Cihat Gündüz b4f960bd48 Add config option allow_redundancy 2018-07-27 11:12:46 +02:00
Matthew Remmel 89adc4224c Patch created from Nef10 (https://github.com/Nef10/SwiftLint.git) missing_docs branch, to remove merge commits that were preventing merging the PR (https://github.com/realm/SwiftLint/pull/2172) 2018-07-25 11:34:53 -04:00
Keith Smiley 6eedf5d73c Add private_only to prefixed_toplevel_constant (#2315)
* Add private_only to prefixed_toplevel_constant

This allows users to opt in to only validate top level constants have
the given prefix if the constant is private or fileprivate.
2018-07-24 12:38:01 -07:00
Marcelo Fabri 8a686dac2a Merge pull request #2310 from Dschee/file-name
Add options `prefix_pattern` and `suffix_pattern` to `file_name` rule
2018-07-24 09:46:28 -07:00
Cihat Gündüz bacc3ddaca Add default suffixPattern value directly in configuration initalizer 2018-07-24 17:34:17 +02:00
Cihat Gündüz c02dd17155 Add prefix_pattern and suffix_pattern options to file_name rule 2018-07-24 16:35:38 +02:00
Cihat Gündüz 51a9a62159 Add if_only option to rule conditional_returns_on_newline 2018-07-23 10:22:28 +02:00
Anders Hasselqvist 1efb78ef25 Fix unnecessary oss-check diff reports
Other minor improvements based on review feedback.
2018-06-14 00:48:14 +09: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 ed04e75c8a Fix indentation 2018-05-11 23:01:16 -07:00
JP Simard 84bfdca774 Enable File Name rule for SwiftLint & fix violations 2018-05-11 22:17:40 -07:00
JP Simard 24ec44d288 Add file_name opt-in rule
validating that file names contain the name of a
type or extension declared in the file (if any).
2018-05-11 22:17:39 -07:00
Varun P M 794160a8d2 Added ignores_default_parameters when calculating parameter count 2018-05-10 17:40:30 +05:30
Eric Horacek d21b787980 Make closure end indentation rule correctable 2018-05-08 21:00:19 -07:00
freak4pc 4d3a1173b6 Apply correct severity form configuration 2018-05-06 23:34:14 +03:00
freak4pc d429ad4358 Get rid of duplicated RuleConfiguration and use reason instead 2018-05-06 23:34:14 +03:00
freak4pc 62d0dd14ca Remove headers 2018-05-06 23:34:14 +03:00
freak4pc 7809ac731a Add specific violation reason for switch_case_alignment based on configuration. 2018-05-06 23:34:14 +03:00