Skip to content

Commit

Permalink
Fix swiftlint error that is unable to find lintable swift files
Browse files Browse the repository at this point in the history
- Update swiftlint documentation

- Update to use swiftlint's Docker image

Fixes oxsecurity#440
  • Loading branch information
Noraldeno committed Dec 24, 2024
1 parent 7d5af4e commit 0cd5cab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
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

- 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

0 comments on commit 0cd5cab

Please sign in to comment.