Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/realm/SwiftLint
Browse files Browse the repository at this point in the history
  • Loading branch information
optionalendeavors committed Apr 12, 2020
2 parents 54d7c86 + ef4a37e commit a7729f1
Show file tree
Hide file tree
Showing 387 changed files with 11,834 additions and 33,909 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ SwiftLintFramework.framework.zip
benchmark_*
portable_swiftlint.zip
osscheck/
docs/
rule_docs/

# Swift Package Manager
#
Expand Down
30 changes: 30 additions & 0 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module: SwiftLintFramework
author: JP Simard, SwiftLint Contributors
author_url: https://jpsim.com
root_url: https://realm.github.io/SwiftLint/
github_url: https://github.com/realm/SwiftLint
github_file_prefix: https://github.com/realm/SwiftLint/tree/master
swift_build_tool: spm
theme: fullwidth
clean: true
copyright: '© 2020 [JP Simard](https://jpsim.com) under MIT.'

documentation: rule_docs/*.md
hide_unlisted_documentation: true
custom_categories_unlisted_prefix: ''
exclude:
- Source/SwiftLintFramework/Rules/**/*.swift
custom_categories:
- name: Rules
children:
- Rule Directory
- name: Reporters
children:
- CSVReporter
- CheckstyleReporter
- EmojiReporter
- GitHubActionsLoggingReporter
- HTMLReporter
- JSONReporter
- JUnitReporter
- MarkdownReporter
1 change: 1 addition & 0 deletions .sourcery/MasterRuleList.stencil
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// The rule list containing all available rules built into SwiftLint.
public let masterRuleList = RuleList(rules: [
{% for rule in types.structs where rule.name|hasSuffix:"Rule" or rule.name|hasSuffix:"Rules" %} {{ rule.name }}.self{% if not forloop.last %},{% endif %}
{% endfor %}])
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ opt_in_rules:
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- discouraged_object_literal
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
- enum_case_associated_values_count
- explicit_init
- extension_access_modifier
- fallthrough
Expand Down
297 changes: 293 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,281 @@

#### Enhancements

* JUnit reporter for GitLab artifact:report:junit with better representation of found issues.
[krin-san](https://github.com/krin-san)
[#3177](https://github.com/realm/SwiftLint/pull/3177)

#### Bug Fixes

* None.

## 0.39.2: Stay Home

This is the last release to support building with Swift 5.0.x.

#### Breaking

* None.

#### Experimental

* None.

#### Enhancements

* Add configuration options to the `unused_import` rule to require
explicit import statements for each module referenced in a source
file (`require_explicit_imports`). When this setting is enabled,
an `allowed_transitive_imports` setting may also be specified to allow
a mapping of modules to transitively imported modules. See PR for
details: https://github.com/realm/SwiftLint/pull/3123
[JP Simard](https://github.com/jpsim)
[#3116](https://github.com/realm/SwiftLint/issues/3116)

#### Bug Fixes

* Fix more false positives in `implicit_getter` rule in extensions when using
Swift 5.2.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3149](https://github.com/realm/SwiftLint/issues/3149)

* Fix false positives in `redundant_objc_attribute` rule in extensions when
using Swift 5.2.
[Marcelo Fabri](https://github.com/marcelofabri)

* Fix false positives in `attributes` rule when using `rethrows` using
Swift 5.2.
[JP Simard](https://github.com/jpsim)

* Fix false positives in `valid_ibinspectable` rule when defining inspectable
properties in class extensions with computed properties using Swift 5.2.
[JP Simard](https://github.com/jpsim)

## 0.39.1: The Laundromat has a Rotating Door

#### Breaking

* The new rules introduced in 0.39.0 that depend on SwiftSyntax have been
temporarily removed as we work out release packaging issues.
* `prohibited_nan_comparison`
* `return_value_from_void_function`
* `tuple_pattern`
* `void_function_in_ternary`
[JP Simard](https://github.com/jpsim)
[#3105](https://github.com/realm/SwiftLint/issues/3105)

#### Experimental

* None.

#### Enhancements

* None.

#### Bug Fixes

* Fix unused_import rule reported locations and corrections when
multiple `@testable` imports are involved.
[JP Simard](https://github.com/jpsim)

## 0.39.0: A Visitor in the Laundromat

#### Breaking

* Replace all uses of `Int`/`Int64`/`NSRange` representing byte offsets
to use newly introduced `ByteCount` and `ByteRange` values instead.
This will minimize the risk of accidentally using a byte-based offset
in character-based contexts.
[Paul Taykalo](https://github.com/PaulTaykalo)
[JP Simard](https://github.com/jpsim)

* SwiftLint now imports [SwiftSyntax](https://github.com/apple/swift-syntax)
and requires Xcode 11.0 to build.
[Marcelo Fabri](https://github.com/marcelofabri)

#### Experimental

* None.

#### Enhancements

* Add option to pass successfully if no files passed to SwiftLint are lintable.
[thedavidharris](https://github.com/thedavidharris)
[#2608](https://github.com/realm/SwiftLint/issues/2608)i

* Add `deinitializer` type content to `type_contents_order` rule instead of
grouping it with initializers.
[Steven Magdy](https://github.com/StevenMagdy)

* Inline test failure messages to make development of SwiftLint easier. Test
failures in triggering and non-triggering examples will appear inline in
their respective files so you can immediately see which cases are working
and which are not.
[ZevEisenberg](https://github.com/ZevEisenberg)
[#3040](https://github.com/realm/SwiftLint/pull/3040)

* Introduce a new `SyntaxRule` that enables writing rules using
[SwiftSyntax](https://github.com/apple/swift-syntax).
[Marcelo Fabri](https://github.com/marcelofabri)

* Add `tuple_pattern` opt-in rule to warn against using
assigning variables through a tuple pattern when the left side
of the assignment contains labels.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2203](https://github.com/realm/SwiftLint/issues/2203)

* Add `return_value_from_void_function` opt-in rule to warn against using
`return <expression>` in a function that is `Void`.
[Marcelo Fabri](https://github.com/marcelofabri)

* Add `void_function_in_ternary` opt-in rule to warn against using
a ternary operator to call `Void` functions.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2358](https://github.com/realm/SwiftLint/issues/2358)

* Add `only_after_dot` configuration option to `empty_count` rule. With the
option enabled, `empty_count` rule will ignore variables named `count`.
By default, this option is disabled.
[Zsolt Kovács](https://github.com/lordzsolt)
[#827](https://github.com/realm/SwiftLint/issues/827)

* Add `prohibited_nan_comparison` opt-in rule to validate using `isNaN`
instead of comparing values to the `.nan` constant.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2086](https://github.com/realm/SwiftLint/issues/2086)

#### Bug Fixes

* Fix `discarded_notification_center_observer` false positives when
capturing observers into an array.
[Petteri Huusko](https://github.com/PetteriHuusko)

* Fix crash when non-closed #if was present in file.
[PaulTaykalo](https://github.com/PaulTaykalo)

* Fix false positives when line ends with carriage return + line feed.
[John Mueller](https://github.com/john-mueller)
[#3060](https://github.com/realm/SwiftLint/issues/3060)

* Implicit_return description now reports current config correctly.
[John Buckley](https://github.com/nhojb)

* Fix false positive in `implicit_getter` rule in extensions when using
Swift 5.2.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3074](https://github.com/realm/SwiftLint/issues/3074)

* Do not trigger `optional_enum_case_matching` rule on `_?` as the `?` might
be required in some situations.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3057](https://github.com/realm/SwiftLint/issues/3057)

* Fix false positive in `attributes` rule with `@escaping` parameters when
using Swift 5.2.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3079](https://github.com/realm/SwiftLint/issues/3079)

* Fix false positive in `empty_string` rule when using multiline string
literals.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3100](https://github.com/realm/SwiftLint/issues/3100)

## 0.38.2: Machine Repair Manual

#### Breaking

* None.

#### Experimental

* None.

#### Enhancements

* Add option to configure which kinds of expressions should omit their
`return` keyword by introducing an `included` configuration for the
`implicit_return` rule. Supported values are `closure`, `function` and
`getter`. Defaults to all three.
[Sven Münnich](https://github.com/svenmuennich)
[#2870](https://github.com/realm/SwiftLint/issues/2870)

* Add `--correctable` and `--verbose` arguments to the `rules` command
to allow displaying only correctable rules, and to always print the
full configuration details regardless of your terminal width.
[Optional Endeavors](https://github.com/optionalendeavors)

* Add `capture_group` option to `custom_rules` for more fine-grained placement
of the location marker for violating code.
[pyrtsa](https://github.com/pyrtsa)

* Add `orphaned_doc_comment` rule to catch doc comments that are not attached
to any declarations.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2989](https://github.com/realm/SwiftLint/issues/2989)

* Add new indentation opt-in rule (`indentation_width`) checking for
super-basic additive indentation pattern.
[Frederick Pietschmann](https://github.com/fredpi)
[#227](https://github.com/realm/SwiftLint/issues/227)

* Catch previously missed violations in the `optional_enum_case_matching` rule
when case expressions involved tuples.
[JP Simard](https://github.com/jpsim)

* API docs for SwiftLintFramework are now available at
[realm.github.io/SwiftLint](https://realm.github.io/SwiftLint). `Rules.md`
now redirects to the rules directory in the API docs
[here](https://realm.github.io/SwiftLint/rule-directory.html). Contributors no
longer need to update rule documentation in PRs as this is now done
automatically. The rule documentation now includes the default configuration.
[JP Simard](https://github.com/jpsim)
[#1653](https://github.com/realm/SwiftLint/issues/1653)
[#1704](https://github.com/realm/SwiftLint/issues/1704)
[#2808](https://github.com/realm/SwiftLint/issues/2808)
[#2933](https://github.com/realm/SwiftLint/issues/2933)
[#2961](https://github.com/realm/SwiftLint/issues/2961)

#### Bug Fixes

* Fix issues in `unused_import` rule when correcting violations in files
containing `@testable` imports where more than the unused imports would be
removed.
[JP Simard](https://github.com/jpsim)

## 0.38.1: Extra Shiny Pulsator Cap

#### Breaking

* None.

#### Experimental

* None.

#### Enhancements

* Make `weak_delegate` rule correctable.
[MaxHaertwig](https://github.com/maxhaertwig)

* Allow `SubstitutionCorrectableRule` to return `nil` instead of a correction
to indicate that a suitable correction couldn't be found for a specific case.
[MaxHaertwig](https://github.com/maxhaertwig)

* Add `enum_case_associated_value_count` opt-in rule.
[lakpa](https://github.com/lakpa)
[#2997](https://github.com/realm/SwiftLint/issues/2997)

* Add `optional_enum_case_matching` opt-in rule to validate that
optional enum cases are matched without using `?` when using Swift 5.1 or
above. See [SR-7799](https://bugs.swift.org/browse/SR-7799) for more
details.
[Marcelo Fabri](https://github.com/marcelofabri)

* Add `prefer_self_type_over_type_of_self` opt-in rule to enforce using
`Self` instead of `type(of: self)` when using Swift 5.1 or above.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3003](https://github.com/realm/SwiftLint/issues/3003)

#### Bug Fixes

* Fix crash in `unused_import` rule when unused imports have trailing
Expand All @@ -23,6 +296,20 @@
[JP Simard](https://github.com/jpsim)
[#2877](https://github.com/realm/SwiftLint/issues/2877)

* Fix false positives from the `unused_declaration` rule involving
functions in protocol extensions.
[JP Simard](https://github.com/jpsim)

* Fix parsing of SwiftLint commands containing a URL in their trailing comment.
[Sven Münnich](https://github.com/svenmuennich)

* Added missing parameters to `FileNameConfiguration.consoleDescription`.
[timcmiller](https://github.com/timcmiller)
[#3009](https://github.com/realm/SwiftLint/issues/3009)

* Fix crash when SourceKit returns out of bounds string byte offsets.
[JP Simard](https://github.com/jpsim)

## 0.38.0: Toroidal Agitation

#### Breaking
Expand Down Expand Up @@ -288,7 +575,9 @@ This is the last release to support building with Swift 4.2.x.

#### Enhancements

* None.
* Added 'file_name_no_space' opt-in rule.
[timcmiller](https://github.com/timcmiller)
[#3007](https://github.com/realm/SwiftLint/issues/3007)

#### Bug Fixes

Expand Down Expand Up @@ -354,7 +643,7 @@ This is the last release to support building with Swift 4.2.x.
[Kevin Randrup](https://github.com/kevinrandrup)

* Make `testSimulateHomebrewTest()` test opt-in because it may fail on unknown
condition. Set `SWIFTLINT_FRAMEWORK_TEST_ENABLE_SIMULATE_HOMEBREW_TEST`
condition. Set `SWIFTLINT_FRAMEWORK_TEST_ENABLE_SIMULATE_HOMEBREW_TEST`
environment variable to test like:
```terminal.sh-session
$ SWIFTLINT_FRAMEWORK_TEST_ENABLE_SIMULATE_HOMEBREW_TEST=1 \
Expand Down Expand Up @@ -398,7 +687,7 @@ This is the last release to support building with Swift 4.2.x.
[alvarhansen](https://github.com/alvarhansen)
[#2746](https://github.com/realm/SwiftLint/issues/2746)

* Don't trigger `file_types_order` violations in files only containing
* Don't trigger `file_types_order` violations in files only containing
extensions.
[Sam Rayner](https://github.com/samrayner)
[#2749](https://github.com/realm/SwiftLint/issues/2749)
Expand Down Expand Up @@ -505,7 +794,7 @@ This is the last release to support building with Swift 4.2.x.
declaring extensions that add protocol conformances with Swift 5.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2705](https://github.com/realm/SwiftLint/issues/2705)

* Let `disable all` command override `superfluous_disable_command` rule.
[Frederick Pietschmann](https://github.com/fredpi)
[#2670](https://github.com/realm/SwiftLint/issues/2670)
Expand Down
Loading

0 comments on commit a7729f1

Please sign in to comment.