SwiftLint
SwiftLint copied to clipboard
SwiftLint Analyze fails with "Error: Could not read compiler invocations"
New Issue Checklist
- [x] Updated SwiftLint to the latest version
- [x] I searched for existing GitHub issues
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-rulesto quickly test if your example is really demonstrating the issue. If your example is more complex, you can useswiftlint lint --path [file here] --no-cache --enable-all-rules.
No, the issue is specific to analyze. Other linting works fine
I had a hard time with these instructions also. They're saying that you
- Clean
DerivedData(incremental builds won't work withanalyze) - Run
xcodebuild -workspace {WORKSPACE}.xcworkspace -scheme {SCHEME} > xcodebuild.log - 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?