Skip to content

Commit

Permalink
Merge branch 'master-upstream'
Browse files Browse the repository at this point in the history
* master-upstream: (98 commits)
  Fix some false positives in rule `explicit_self` (realm#3368)
  Update SourceKitten to 0.30.1 (realm#3367)
  Fix issues with analyzer rules, Xcode 12 & SwiftUI (realm#3366)
  Add empty changelog section
  release 0.40.3
  Fix false positives for 'multiple_closures_with_trailing_closure' (realm#3353)
  [UnusedDeclarationRule] Work around SR-11985 (realm#3363)
  Revert "Fix finding the nested config when a single file path is passed (realm#3342)" (realm#3362)
  [CONTRIBUTING] Add building & running tips (realm#3360)
  Fix finding the nested config when a single file path is passed (realm#3342)
  Include Linux zip in list of GitHub release binaries (realm#3350)
  [UnusedDeclarationRule] Add more tests (realm#3359)
  Test CI with official Swift 5.3 release (realm#3356)
  Don't mark `@NSApplicationMain` or `@UIApplicationMain` classes as unused (realm#3355)
  [Fix] `UnusedCaptureListRule`: implicit self in @escaping closures (realm#3352)
  Skip correcting files with parser diagnostics (realm#3349)
  [SwiftLintFile] Remove lock in favor of UUID (realm#3347)
  [UnusedDeclarationRule] Speed up and detect more dead code (realm#3340)
  Add empty changelog section
  release 0.40.2
  ...

# Conflicts:
#	Source/swiftlint/Helpers/LintableFilesVisitor.swift
  • Loading branch information
optionalendeavors committed Oct 4, 2020
2 parents a7729f1 + da408b5 commit 3a2a6a2
Show file tree
Hide file tree
Showing 251 changed files with 3,045 additions and 917 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ SwiftLint.pkg
SwiftLintFramework.framework.zip
benchmark_*
portable_swiftlint.zip
swiftlint_linux.zip
osscheck/
docs/
rule_docs/
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0
5.1
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ opt_in_rules:
- legacy_random
- let_var_whitespace
- last_where
- legacy_multiple
- literal_expression_end_indentation
- lower_acl_than_parent
- modifier_order
Expand All @@ -47,6 +48,7 @@ opt_in_rules:
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- prefer_self_type_over_type_of_self
- private_action
- private_outlet
- prohibited_interface_builder
Expand Down
216 changes: 211 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,209 @@

#### Enhancements

* JUnit reporter for GitLab artifact:report:junit with better representation of found issues.
* None.

#### Bug Fixes

* Fix parsing of Xcode 12 compiler logs for analyzer rules.
[JP Simard](https://github.com/jpsim)
[#3365](https://github.com/realm/SwiftLint/issues/3365)

* Fix some SwiftUI unused declaration rule false positives.
[JP Simard](https://github.com/jpsim)
[#3365](https://github.com/realm/SwiftLint/issues/3365)

* Fix some false positives in rule `explicit_self`.
[Sven Münnich](https://github.com/svenmuennich)

## 0.40.3: Greased Up Drum Bearings

#### Breaking

* None.

#### Experimental

* None.

#### Enhancements

* Make the `unused_declaration` rule run 3-5 times faster, and
enable it to detect more occurrences of unused declarations.
[JP Simard](https://github.com/jpsim)

* Remove unneeded internal locking overhead, leading to increased
performance in multithreaded operations.
[JP Simard](https://github.com/jpsim)

* Skip correcting file if the swift parser reports a warning or an
error.
[JP Simard](https://github.com/jpsim)
[#3343](https://github.com/realm/SwiftLint/issues/3343)

#### Bug Fixes

* Rule `unused_capture_list` should not be triggered by self keyword.
[hank121314](https://github.com/hank121314)
[#2367](https://github.com/realm/SwiftLint/issues/3267)

* Rule `multiple_closures_with_trailing_closure` no longer triggers when Swift
5.3's 'multiple trailing closures' feature is used.
[Jumhyn](https://github.com/jumhyn)
[#3295](https://github.com/realm/SwiftLint/issues/3295)

## 0.40.2: Demo Unit

#### Breaking

* None.

#### Experimental

* None.

#### Enhancements

* Improve description for `empty_enum_arguments`.
[Lukas Schmidt](https://github.com/lightsprint09)

* Add support for `excluded_match_kinds` custom rule config parameter.
[Ryan Demo](https://github.com/ryandemo)

#### Bug Fixes

* None.

## 0.40.1: A Baffling Response

#### Breaking

* None.

#### Experimental

* None.

#### Enhancements

* Add support for params files for file paths.
[keith](https://github.com/keith)

#### Bug Fixes

* Fix .swift-version to use Swift 5.1.
[cfiken](https://github.com/cfiken)
[#3297](https://github.com/realm/SwiftLint/issues/3297)

* Fix test `testDetectSwiftVersion` for Swift 5.2.5.
[cfiken](https://github.com/cfiken)
[#3299](https://github.com/realm/SwiftLint/pull/3299)

## 0.40.0: Washable Mask

#### Breaking

* SwiftLint now requires Swift 5.1 or higher to build.
[JP Simard](https://github.com/jpsim)

* Improve compile commands json file validation. If you previously
provided invalid files or arguments, the command will now abort.
[Keith Smiley](https://github.com/keith)

#### Experimental

* None.

#### 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)

* Add opt-in `ibinspectable_in_extension` rule to lint against `@IBInspectable`
properties in `extensions`.
[Keith Smiley](https://github.com/keith)

* Add `computed_accessors_order` rule to validate the order of `get` and `set`
accessors in computed properties and subscripts.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3158](https://github.com/realm/SwiftLint/issues/3158)

* Extend `empty_enum_arguments` rule to support `if case` and `guard case`.
[Zsolt Kovács](https://github.com/lordzsolt)
[#3103](https://github.com/realm/SwiftLint/issues/3103)

* Add `prefer_zero_over_explicit_init` opt-in rule to enforce using
`.zero` instead of calling constructor with zero arguments
(e.g. `CGPoint(x: 0, y: 0)`) when using CoreGraphics types.
[Anton Nazarov](https://github.com/MortyMerr)
[#3190](https://github.com/realm/SwiftLint/issues/3190)

* Add `swiftlint docs` command to easily open online documentation.
[417-72KI](https://github.com/417-72KI)

* Add `unneeded_notification_center_removal` rule to warn against using
`NotificationCenter.removeObserver(self)` in `deinit` since it's not required
after iOS 9/macOS 10.11.
[Amzd](https://github.com/Amzd)
[#2755](https://github.com/realm/SwiftLint/issues/2755)

#### Bug Fixes

* None.
* Fix UnusedImportRule breaking transitive imports.
[keith](https://github.com/keith)

* Fix severity level configuration for `duplicate_imports`.
[Yusuke Goto](https://github.com/yusukegoto)

* Fixes false positives for `multiline_parameters_brackets` and
`multiline_arguments_brackets`.
[Noah Gilmore](https://github.com/noahsark769)
[#3167](https://github.com/realm/SwiftLint/issues/3167)

* Fix conflict of 'opening_brace' with 'implicit_return' for functions
implicitly returning a closure.
[SimplyDanny](https://github.com/SimplyDanny)
[#3034](https://github.com/realm/SwiftLint/issues/3034)

* Fix false positive on `switch_case_on_newline` rule with `do/catch`
statements when using Swift 5.3.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3253](https://github.com/realm/SwiftLint/issues/3253)

* Fix false positive uppercase enum case in
`raw_value_for_camel_cased_codable_enum` rule.
[Teameh](https://github.com/teameh)

* Fix false positive in `no_space_in_method_call` rule with multiple trailing
closures (Swift 5.3).
[Marcelo Fabri](https://github.com/marcelofabri)
[#3259](https://github.com/realm/SwiftLint/issues/3259)

* Fix false negative in `explicit_acl` rule when using `extension` with
Swift 5.2+.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3186](https://github.com/realm/SwiftLint/issues/3186)

* `closure_parameter_position` now triggers in closures that are not inside a
function call and also validates captured variables.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3225](https://github.com/realm/SwiftLint/issues/3225)

* Fix some cases where the output would be incomplete when running
SwiftLint on Linux.
[Marcelo Fabri](https://github.com/marcelofabri)
[#3214](https://github.com/realm/SwiftLint/issues/3214)

* `compiler_protocol_init` now triggers on `IndexSet(arrayLiteral:)`.
[Janak Shah](https://github.com/janakshah)
[#3284](https://github.com/realm/SwiftLint/pull/3284)

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

## 0.39.2: Stay Home

Expand Down Expand Up @@ -153,8 +349,18 @@ This is the last release to support building with Swift 5.0.x.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2086](https://github.com/realm/SwiftLint/issues/2086)

* Add case `preview_provider` to the order list of `file_types_order` to fix
an issue with false positives for `PreviewProvider` subclasses in SwiftUI.
[Cihat Gündüz](https://github.com/Jeehut)
[#2860](https://github.com/realm/SwiftLint/issues/2860)

#### Bug Fixes

* Fix false positive in `attributes` rule with `@autoclosure` parameters when
using Swift 5.2.
[Mateusz Matrejek](https://github.com/matrejek)
[#3079](https://github.com/realm/SwiftLint/issues/3112)

* Fix `discarded_notification_center_observer` false positives when
capturing observers into an array.
[Petteri Huusko](https://github.com/PetteriHuusko)
Expand Down Expand Up @@ -221,7 +427,7 @@ This is the last release to support building with Swift 5.0.x.
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)
Expand Down Expand Up @@ -440,7 +646,7 @@ This is the last release to support building with Swift 5.0.x.
using `flatMap` over `map { ... }.reduce([], +)`.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2883](https://github.com/realm/SwiftLint/issues/2883)

* Add autocorrection to `syntactic_sugar`.
[Ivan Vavilov](https://github.com/vani2)

Expand All @@ -454,7 +660,7 @@ This is the last release to support building with Swift 5.0.x.
[Marcelo Fabri](https://github.com/marcelofabri)
[#2874](https://github.com/realm/SwiftLint/issues/2874)

* Add `raw_value_for_camel_cased_codable_enum` opt-in rule to enforce raw values
* Add `raw_value_for_camel_cased_codable_enum` opt-in rule to enforce raw values
for camel cased Codable String enum cases.
[Marko Pejovic](https://github.com/00FA9A)
[#2888](https://github.com/realm/SwiftLint/issues/2888)
Expand Down
29 changes: 28 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@ _If you have commit access to SwiftLint and believe your change to be trivial
and not worth waiting for review, you may open a pull request and merge
immediately, but this should be the exception, not the norm._

### Building And Running Locally

#### Using Xcode

1. `git clone https://github.com/realm/SwiftLint.git`
1. `cd SwiftLint`
1. `xed .`
1. Select the "swiftlint" scheme
1. `cmd-opt-r` open the scheme options
1. Set the "Arguments Passed On Launch" you want in the "Arguments" tab
1. Set the "Working Directory" you want in the "Options" tab
1. Hit "Run"

|Arguments|Options|
|-|-|
|![image](https://user-images.githubusercontent.com/474794/93893073-1676b000-fca2-11ea-9428-20423c5f5237.png)|![image](https://user-images.githubusercontent.com/474794/93893135-27bfbc80-fca2-11ea-805a-ee21b446c3f0.png)|

Then you can use the full power of Xcode/LLDB/Instruments to develop and debug your changes to SwiftLint.

#### Using the command line

1. `git clone https://github.com/realm/SwiftLint.git`
1. `cd SwiftLint`
1. `swift build [-c release]`
1. Use the produced `swiftlint` binary from the command line, either by running `swift run [-c release] [swiftlint] [arguments]` or by invoking the binary directly at `.build/[release|debug]/swiftlint`
1. [Optional] Attach LLDB: `lldb -- .build/[release|debug]/swiftlint [arguments]`

### Submodules

This SwiftLint repository uses submodules for its dependencies.
Expand Down Expand Up @@ -112,7 +139,7 @@ the `CHANGELOG.md` file.
We follow the same syntax as CocoaPods' CHANGELOG.md:

1. One Markdown unnumbered list item describing the change.
2. 2 trailing spaces on the last line describing the change.
2. 2 trailing spaces on the last line describing the change (so that Markdown renders each change [on its own line](https://daringfireball.net/projects/markdown/syntax#p)).
3. A list of Markdown hyperlinks to the contributors to the change. One entry
per line. Usually just one.
4. A list of Markdown hyperlinks to the issues the change addresses. One entry
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "jpsim/SourceKitten" ~> 0.29.0
github "jpsim/SourceKitten" ~> 0.30.1
github "scottrhoyt/SwiftyTextTable" ~> 0.9.0
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Carthage/Commandant" ~> 0.17.0
github "jpsim/Yams" ~> 2.0.0
github "jpsim/Yams" ~> 4.0.0
github "jspahrsummers/xcconfigs" ~> 0.12.0
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github "Carthage/Commandant" "0.17.0"
github "drmohundro/SWXMLHash" "5.0.1"
github "jpsim/SourceKitten" "0.29.0"
github "jpsim/Yams" "2.0.0"
github "jpsim/SourceKitten" "0.30.1"
github "jpsim/Yams" "4.0.0"
github "jspahrsummers/xcconfigs" "0.12"
github "scottrhoyt/SwiftyTextTable" "0.9.0"
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ GEM
sqlite3 (~> 1.3)
xcinvoke (~> 0.3.0)
json (2.3.0)
kramdown (2.1.0)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liferaft (0.0.6)
Expand All @@ -117,6 +118,7 @@ GEM
public_suffix (4.0.3)
rchardet (1.8.0)
redcarpet (3.5.0)
rexml (3.2.4)
rouge (3.17.0)
ruby-macho (1.4.0)
sassc (2.2.1)
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ portable_zip: installables
cp -f "$(LICENSE_PATH)" "$(TEMPORARY_FOLDER)"
(cd "$(TEMPORARY_FOLDER)"; zip -yr - "swiftlint" "LICENSE") > "./portable_swiftlint.zip"

zip_linux:
$(eval TMP_FOLDER := $(shell mktemp -d))
docker run -v `pwd`:`pwd` -w `pwd` --rm swift:latest swift build -c release
mv .build/release/swiftlint "$(TMP_FOLDER)"
cp -f "$(LICENSE_PATH)" "$(TMP_FOLDER)"
(cd "$(TMP_FOLDER)"; zip -yr - "swiftlint" "LICENSE") > "./swiftlint_linux.zip"

package: installables
pkgbuild \
--identifier "io.realm.swiftlint" \
Expand All @@ -119,10 +126,10 @@ archive:
carthage build --no-skip-current --platform mac
carthage archive SwiftLintFramework

release: package archive portable_zip
release: package archive portable_zip zip_linux

docker_test:
docker run -v `pwd`:`pwd` -w `pwd` --name swiftlint --rm norionomura/swift:51 swift test --parallel
docker run -v `pwd`:`pwd` -w `pwd` --name swiftlint --rm swift:5.3 swift test --parallel

docker_htop:
docker run -it --rm --pid=container:swiftlint terencewestphal/htop || reset
Expand Down
Loading

0 comments on commit 3a2a6a2

Please sign in to comment.