megalinter icon indicating copy to clipboard operation
megalinter copied to clipboard

Linting swift code does not work. Error: No lintable files found at paths: '/tmp/lint'

Open r3econ opened this issue 3 years ago • 19 comments

Describe the bug

Linting swift code does not work. The error appears:

...
Status: Downloaded newer image for norionomura/swiftlint:latest
The `swiftlint autocorrect` command is no longer available.
Please use `swiftlint --fix` instead.
Error: No lintable files found at paths: '/tmp/lint'
Correcting Swift files at paths /tmp/lint

To Reproduce Steps to reproduce the behavior:

  1. Follow the quick start CLI to add mega-linter to the iOS Swift project
  2. Accept default values (except one case where you choose that it's a Swift project)
  3. Push to the repo, create a PR to trigger the GitHub Action
  4. See swift-lint error (not related to the codebase)

Expected behavior

  • swift-lint starts linting the code base.

Screenshots

Screenshot 2021-04-29 at 13 26 35
  • Contents of ERROR-SWIFT_SWIFTLINT.log
Results of swiftlint linter (version 0.43.1)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/swift_swiftlint/
-----------------------------------------------

❌ [ERROR] for workspace /github/workspace
Linter raw log:
Unable to find image 'norionomura/swiftlint:latest' locally
latest: Pulling from norionomura/swiftlint
34667c7e4631: Pulling fs layer
d18d76a881a4: Pulling fs layer
119c7358fbfc: Pulling fs layer
2aaf13f3eff0: Pulling fs layer
969975223755: Pulling fs layer
1ea85296b57d: Pulling fs layer
178f29677290: Pulling fs layer
5f015d65fccd: Pulling fs layer
2aaf13f3eff0: Waiting
969975223755: Waiting
1ea85296b57d: Waiting
178f29677290: Waiting
5f015d65fccd: Waiting
d18d76a881a4: Verifying Checksum
d18d76a881a4: Download complete
119c7358fbfc: Verifying Checksum
119c7358fbfc: Download complete
2aaf13f3eff0: Verifying Checksum
2aaf13f3eff0: Download complete
1ea85296b57d: Verifying Checksum
1ea85296b57d: Download complete
34667c7e4631: Verifying Checksum
34667c7e4631: Download complete
5f015d65fccd: Verifying Checksum
5f015d65fccd: Download complete
969975223755: Verifying Checksum
969975223755: Download complete
34667c7e4631: Pull complete
178f29677290: Verifying Checksum
178f29677290: Download complete
d18d76a881a4: Pull complete
119c7358fbfc: Pull complete
2aaf13f3eff0: Pull complete
969975223755: Pull complete
1ea85296b57d: Pull complete
178f29677290: Pull complete
5f015d65fccd: Pull complete
Digest: sha256:2b118a4b74998159c4aa3cd3ccf6d73074bec6ad70cfab0be28f4459754a0640
Status: Downloaded newer image for norionomura/swiftlint:latest
The `swiftlint autocorrect` command is no longer available.
Please use `swiftlint --fix` instead.
Error: No lintable files found at paths: '/tmp/lint'
Correcting Swift files at paths /tmp/lint
  • Contents of .swiftlint.yml
excluded: # paths to ignore during linting. Takes precedence over `included`.
  - Pods

disabled_rules: # rule identifiers to exclude from running
  - force_cast
  - force_try # Remove when done
  - type_name
  - identifier_name
  - type_body_length
  - file_length

cyclomatic_complexity:
  ignores_case_statements: true

r3econ avatar Apr 29 '21 11:04 r3econ

Is there anyone able to help with this?

r3econ avatar May 10 '21 07:05 r3econ

@r3econ I can, but i have a lot of work for the job i'm actually paid for, but I promise I'll try to solve that in y available free time :) If someone else want to give it a try before that, it would be very welcome of course !

nvuillam avatar May 10 '21 16:05 nvuillam

I could also try to solve it but I'd need some hints. Do you know what is causing the problem there, where to start looking?.

r3econ avatar May 14 '21 14:05 r3econ

You could try to replace --fix by autocorrect in the swift descriptor cli_lint_fix_arg, maybe it would solve the issue

nvuillam avatar May 14 '21 17:05 nvuillam

@r3econ i made the update I suggested, the test case passes, but please you check if it works with latest/insiders version ? ( not V4) and close the issue if it is fixed ?

nvuillam avatar May 15 '21 20:05 nvuillam

Thanks a lot! I tested, changed the action invocation in the workflow to use the latest tag like in the screenshot below.

Screenshot 2021-05-17 at 11 58 28

However, I'm still getting the same error ErrCorrecting Swift files at paths /tmp/lint or: No lintable files found at paths: '/tmp/lint'. Am I testing it correctly? I'm using the swift flavor.

Contents of ERROR-SWIFT_SWIFTLINT.log:

Results of swiftlint linter (version 0.43.1)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/swift_swiftlint/
-----------------------------------------------

❌ [ERROR] for workspace /github/workspace
Linter raw log:
Unable to find image 'norionomura/swiftlint:latest' locally
latest: Pulling from norionomura/swiftlint
34667c7e4631: Pulling fs layer
d18d76a881a4: Pulling fs layer
119c7358fbfc: Pulling fs layer
2aaf13f3eff0: Pulling fs layer
969975223755: Pulling fs layer
1ea85296b57d: Pulling fs layer
178f29677290: Pulling fs layer
5f015d65fccd: Pulling fs layer
969975223755: Waiting
1ea85296b57d: Waiting
178f29677290: Waiting
5f015d65fccd: Waiting
2aaf13f3eff0: Waiting
119c7358fbfc: Verifying Checksum
119c7358fbfc: Download complete
d18d76a881a4: Verifying Checksum
d18d76a881a4: Download complete
2aaf13f3eff0: Verifying Checksum
2aaf13f3eff0: Download complete
1ea85296b57d: Verifying Checksum
1ea85296b57d: Download complete
34667c7e4631: Verifying Checksum
34667c7e4631: Download complete
5f015d65fccd: Verifying Checksum
5f015d65fccd: Download complete
969975223755: Verifying Checksum
969975223755: Download complete
34667c7e4631: Pull complete
178f29677290: Verifying Checksum
178f29677290: Download complete
d18d76a881a4: Pull complete
119c7358fbfc: Pull complete
2aaf13f3eff0: Pull complete
969975223755: Pull complete
1ea85296b57d: Pull complete
178f29677290: Pull complete
5f015d65fccd: Pull complete
Digest: sha256:2b118a4b74998159c4aa3cd3ccf6d73074bec6ad70cfab0be28f4459754a0640
Status: Downloaded newer image for norionomura/swiftlint:latest
ErrCorrecting Swift files at paths /tmp/lint
or: No lintable files found at paths: '/tmp/lint'

r3econ avatar May 17 '21 10:05 r3econ

To be honest, switft linting has been tested only from Mega-Linter test cases, so the error you see is probably a real bug and not a mistake from you

Do you have a public repo where I could reproduce the problem ?

nvuillam avatar May 17 '21 10:05 nvuillam

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Jun 17 '21 00:06 github-actions[bot]

not stale

nvuillam avatar Jul 01 '21 13:07 nvuillam

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Aug 01 '21 00:08 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Sep 01 '21 00:09 github-actions[bot]

@nvuillam this is still happening. I believe the problem is with the paths: SwiftLint lint --path '/tmp/lint' this path should be the GitHub action repo workspace. Is there any way to change this path on the configurations?

goncalo-frade-iohk avatar Aug 10 '22 14:08 goncalo-frade-iohk

Any suggestion around this? :)

goncalo-frade-iohk avatar Aug 17 '22 09:08 goncalo-frade-iohk

It seems that swiftlint is the weak spot of MegaLinter... it indeed needs to be repaired, I'll try to succeed that someday:)

nvuillam avatar Aug 17 '22 09:08 nvuillam

I just made an attempt... let's see what CI says ^^

nvuillam avatar Aug 17 '22 09:08 nvuillam

Sure if you need any help. :) As far as I understand the problem is with the path passed down to SwiftLint SwiftLint lint --path '/tmp/lint' Im not sure what is in this folder. But if you would change for the workspace path of the GitHub action it should work.

goncalo-frade-iohk avatar Aug 17 '22 10:08 goncalo-frade-iohk

If you had an example of a full docker run command with swiftlint image it would help a lot :)

nvuillam avatar Aug 17 '22 10:08 nvuillam

Well there is this GitHub action that I know works that also uses docker :).

https://github.com/norio-nomura/action-swiftlint

And this as the entrypoint: https://github.com/norio-nomura/action-swiftlint/blob/master/entrypoint.sh

But don't know if this can help you.

goncalo-frade-iohk avatar Aug 17 '22 10:08 goncalo-frade-iohk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Sep 17 '22 01:09 github-actions[bot]

This isn't stale and is still currently happening.

keithrfung avatar Jun 14 '23 18:06 keithrfung

Reopened.... any help will be appreciated :)

nvuillam avatar Jun 18 '23 08:06 nvuillam

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

github-actions[bot] avatar Jul 19 '23 02:07 github-actions[bot]