We currently try to derive the root path by using the path passed in. However, this doesn't allow us to actually get the root, just the containing directory of the path passed in. We also don't currently have a heuristic to use for deriving the root path for multiple paths passed in.
The fix (which fixes#3383) is to remove our root path calculation and just use the current working directory as the root instead.
This Fixes case when the right part of the expression is an array or a string
Previously, strings and comments tokens were ignored.
In the current implementation, matching done first and then those are filtered if the operator is within the string token
This was previously attempted in #3342, but produced a bug in the case where `--config` is used to specify a config from outside of the source tree. The `--config` argument wasn't always being used as an override, and was being merged with the config in the source tree. This has now been addressed and reverts the revert done in #3362.
Fixes#3341
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.
Some attributes are parameterized, such as `@objc(name)`. Previously
these reported `attributes` violations because their contents weren't
included in the configuration, which would just have `@objc`.
As we discussed here https://github.com/realm/SwiftLint/pull/3325 sometimes current excluding algorithm maybe slower than excluding paths by absolute prefix. So I added option for such cases.
Based on what I've checked it works faster for next scenarios:
- the number of input files is relatively small (e.g. when using `use-script-input-files`) and excluded directories contain relatively big number of lintable files
- the number of excluded directories relatively small (e.g. Pods + ThirdParty) and globs not used
* Use the severity from the configuration
It was previously using a hardcoded value, that of the default configuration.
* Update CHANGELOG.md
* Correctly format CHANGELOG addition
* Improve "Working Directory" instructions in CONTRIBUTING.md (#1280)
The instruction wasn't clear to me and it took me some time to figure out what to insert into the "Working Directory" option.
Co-Authored-By: oonoo <2565796+oonoo@users.noreply.github.com>
* Improve "Arguments Passed On Launch" instructions in CONTRIBUTING.md (#1280)
I wasn't sure which arguments could be passed to SwiftLint. I referenced the Command Line paragraph in the README, it already lists the available arguments.
Co-Authored-By: oonoo <2565796+oonoo@users.noreply.github.com>
* Add more details to "Submodules" in CONTRIBUTING.md (#1280)
The reason to checkout git submodules wasn't mentioned. I added the use cases for submodules, as Swift Package Manager doesn't make use of the git submodules.
* Format "Using Xcode" in CONTRIBUTING.md (#1280)
Limit line length to 80 characters in "Using Xcode" section of CONTRIBUTING.md.
* Document changes in CHANGELOG.md (#1280)
* Add missing word
Co-authored-by: oonoo <2565796+oonoo@users.noreply.github.com>
Co-authored-by: JP Simard <jp@jpsim.com>
We weren't properly handling some new Xcode 12 compiler logs.
We also were marking declarations used by SwiftUI as unused
(`@main` and preview providers).
Fixes#3341
When SwiftLint searches for nested configurations and only one file has been passed in via the `paths` argument, SwiftLint returns early after inadvertently comparing the containing directory of the file-to-be-linted to itself. This happens because `rootDirectory` is calculated from `rootPath`, which is set to the file being linted in this scenario.
* Include Linux zip in list of GitHub release binaries
This matches what has been included in recent releases.
* Fix one more Linux zip reference
* Use all 1s for the numbered list in Releasing.md
Markdown renders the numbered list correctly, and this way one can easily reorder the steps
or add new steps without needing to renumber everything.