SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

SwiftLint Analyze fails with "Error: Could not read compiler invocations"

Open VidaHasan opened this issue 5 years ago • 1 comments

New Issue Checklist

Describe the bug

A clear and concise description of what the bug is. Whenever I run swiftlint analyze, I get error of 'Error: Could not read compiler invocations"

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint analyze

Error: Could not read compiler invocations

Environment

Version: 0.43.1 Installation Method: Homebrew

  • homebrew
  • Paste your configuration file:
disabled_rules: # rule identifiers to exclude from running
- colon
- comma
- control_statement
- nesting
- comment_spacing
- identifier_name # probably want to put this back in.
opt_in_rules: # some rules are only opt-in
- empty_count
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
-[../redacted]
excluded: # paths to ignore during linting. Takes precedence over `included`.

analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
- explicit_self


# configure
line_length: 350
cyclomatic_complexity: 11
function_parameter_count: 10
large_tuple: 3
type_name:
    min_length: 3 # only warning
    max_length: # warning and error
        warning: 160    
        error: 200
  • Are you using nested configurations? No If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcodebuild -version)? 12.5 12E262
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules to quickly test if your example is really demonstrating the issue. If your example is more complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.

No, the issue is specific to analyze. Other linting works fine

VidaHasan avatar May 18 '21 16:05 VidaHasan

I had a hard time with these instructions also. They're saying that you

  1. Clean DerivedData (incremental builds won't work with analyze)
  2. Run xcodebuild -workspace {WORKSPACE}.xcworkspace -scheme {SCHEME} > xcodebuild.log
  3. Run swiftlint analyze --compiler-log-path xcodebuild.log

I initially read the instructions as meaning that there was some info in xcodebuild.log that I should be looking for to pass in with --compiler-log but it's actually the file itself.

Could the instructions be more explicit, like the list I made above?

timothycosta avatar May 21 '21 02:05 timothycosta