Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix swiftlint error that is unable to find lintable swift files #4427

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,7 @@
"linelength",
"linesep",
"linkcheck",
"lintable",
"linterkey",
"linterrc",
"linterversion",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
Learn more about context on [GH-4328](https://github.com/oxsecurity/megalinter/issues/4328)

- Fixes
- [swiftlint](https://github.com/realm/SwiftLint) Fix swiftlint error where linter is unable to find lintable files. Fixes [#440](https://github.com/oxsecurity/megalinter/issues/440).

- Reporters

Expand Down
8 changes: 4 additions & 4 deletions docs/descriptors/swift_swiftlint.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ description: How to use swiftlint (configure, ignore files, ignore errors, help

- Version in MegaLinter: **0.57.1**
- Visit [Official Web Site](https://github.com/realm/SwiftLint#readme){target=_blank}
- Docker image: [norionomura/swiftlint:latest](https://hub.docker.com/r/norionomura/swiftlint){target=_blank}
- arguments: `-v {{WORKSPACE}}:/tmp/lint:rw`
- Docker image: [ghcr.io/realm/swiftlint:latest](https://hub.docker.com/r/ghcr.io/realm/swiftlint){target=_blank}
- arguments: `-v {{WORKSPACE}}:/tmp/lint:rw -w /tmp/lint`
- See [How to configure swiftlint rules](https://github.com/realm/SwiftLint#configuration){target=_blank}
- See [How to disable swiftlint rules in files](https://github.com/realm/SwiftLint#disable-rules-in-code){target=_blank}
- See [Index of problems detected by swiftlint](https://realm.github.io/SwiftLint/rule-directory.html){target=_blank}
Expand Down Expand Up @@ -82,11 +82,11 @@ swiftlint is called once on the whole project directory (`project` CLI lint mode
### Example calls

```shell
docker run -v /tmp/lint:/tmp/lint:rw norionomura/swiftlint:latest swiftlint lint --path /tmp/lint --strict
docker run -v /tmp/lint:/tmp/lint:rw ghcr.io/realm/swiftlint:latest swiftlint --strict
```

```shell
docker run -v /tmp/lint:/tmp/lint:rw norionomura/swiftlint:latest swiftlint --fix --path /tmp/lint --strict
docker run -v /tmp/lint:/tmp/lint:rw ghcr.io/realm/swiftlint:latest swiftlint --fix --strict
```


Expand Down
9 changes: 5 additions & 4 deletions megalinter/descriptors/swift.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,25 @@ linters:
cli_lint_extra_args:
- "lint"
cli_lint_extra_args_after:
- "/tmp/lint"
- "--strict"
cli_lint_fix_arg_name: "--fix"
cli_lint_fix_remove_args:
- "lint"
cli_docker_image: norionomura/swiftlint
cli_docker_image: ghcr.io/realm/swiftlint
cli_docker_args:
- "-v"
- "{{WORKSPACE}}:/tmp/lint:rw"
- "-w"
- "/tmp/lint"
config_file_name: ".swiftlint.yml"
cli_config_arg_name: ""
cli_help_arg_name: "help"
cli_version_arg_name: "version"
cli_lint_errors_count: regex_number
cli_lint_errors_regex: "Found ([0-9]+) violations"
examples:
- "docker run -v /tmp/lint:/tmp/lint:rw norionomura/swiftlint:latest swiftlint lint --path /tmp/lint --strict"
- "docker run -v /tmp/lint:/tmp/lint:rw norionomura/swiftlint:latest swiftlint --fix --path /tmp/lint --strict"
- "docker run -v /tmp/lint:/tmp/lint:rw ghcr.io/realm/swiftlint:latest swiftlint --strict"
- "docker run -v /tmp/lint:/tmp/lint:rw ghcr.io/realm/swiftlint:latest swiftlint --fix --strict"
ide:
atom:
- name: linter-swiftlint
Expand Down
Loading