You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running swiftlint lint on the CLI works displays the following warning:
warning: Cannot parse YAML file: 95:21: error: scanner: while parsing a quoted scalar in line 95, column 12
found unknown escape character:
regex: "(?-s)(\n\s*){3,}\n(\t| )"
^ – Falling back to default configuration
but then continues on with:
Linting Swift files in current working directory
Linting 'AerisCustomLayerHost.swift' (1/98)
Linting 'MapsGL_PrototypeApp.swift' (2/98)
…
Done linting! Found 2384 violations, 53 serious in 98 files.
and does not crash.
(This is issue is not about the bad config itself; I'm aware and I'll fix it; this issue about about the plugin EXC_CRASH-ing.)
Environment
SwiftLint version: 0.53.0 package version (also 0.53.0 for the also-installed CLI standalone version)
Installation method used: SPM via Xcode project's Package Dependencies, and also via Package.swift (but also installed on the CLI with brew)
Paste your configuration file:
# By default, SwiftLint uses a set of sensible default rules you can adjust:disabled_rules: # rule identifiers turned on by default to exclude from running
- colon
- comment_spacing
- empty_enum_arguments
- identifier_name
- opening_brace
- private_over_fileprivate
- redundant_optional_initialization
- statement_position
- trailing_whitespaceopt_in_rules: # some rules are turned off by default, so you need to opt-in
- indentation_width
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- yoda_condition#- empty_count # find all the available rules by running: `swiftlint rules`# Alternatively, specify all rules explicitly by uncommenting this option:# only_rules: # delete `disabled_rules` & `opt_in_rules` if using this# - empty_parameters# - vertical_whitespaceanalyzer_rules: # rules run by `swiftlint analyze`
- explicit_selfincluded: # case-sensitive paths to include during linting. `--path` is ignored if present#- Sourcesexcluded: # case-sensitive paths to ignore during linting. Takes precedence over `included`
- Carthage
- Pods
- Sources/ExcludedFolder
- Sources/ExcludedFile.swift
- Sources/*/ExcludedFile.swift # exclude files with a wildcard# If true, SwiftLint will not fail if no lintable files are found.allow_zero_lintable_files: false# If true, SwiftLint will treat all warnings as errors.strict: false# configurable rules can be customized from this configuration file# binary rules can set their severity levelcyclomatic_complexity:
ignores_case_statements: trueforce_cast: warningforce_try: warningidentifier_name:
min_length:
warning: 2error: 1large_tuple:
warning: 3error: 999line_length:
warning: 200error: 999ignores_urls: trueignores_comments: trueignores_interpolated_strings: trueswitch_case_alignment:
indented_cases: truetrailing_comma:
mandatory_comma: truetype_name:
min_lenth:
warning: 2error: 1allowed_symbols: ["_"]vertical_whitespace:
max_empty_lines: 3reporter: "xcode"# reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging, summary)custom_rules:
stub:
included:
- ".*\\.swift"name: "Stub Violation"regex: "STUB"match_kinds:
- commentmessage: "STUB code should be resolved"severity: warning# This custom rule seems to be causing the crashes— comment it out and there's no issues.max_double_blank_lines_in_indented_code:
included:
- ".*\\.swift"name: "Maximum of Double Blank Lines In Indented Code"regex: "(?-s)(\n\s*){3,}\n(\t| )"message: "Maximum of Double Blank Lines In Indented Code"severity: warningtriple_blank_lines_before_sectional_mark:
included:
- ".*\\.swift"name: "Triple Blank Lines Before Sectional Mark"regex: "(?<!\n\n\n)\n// MARK: -"match_kinds:
- commentmessage: "`MARK -` comments should be preceded by 3 blank lines"severity: warningtriple_blank_lines_after_imports:
included:
- ".*\\.swift"name: "Triple Blank Lines After Imports"regex: "(?-s)import .+\n(?!\n\n\n|\n?(@testable )?import|\n?\/\/.+\nimport)"message: "The last import should be followed by 3 blank lines. (Up to 1 blank line and comments are allowed between imports.)"severity: warning
Are you using nested configurations? Nope
If so, paste their relative paths and respective contents.
Which Xcode version are you using (check xcodebuild -version)? Xcode 15.0 Build version 15A240d
Do you have a sample that shows the issue? Crash dialog pops up as soon as you run Product > Build (⌘B) in Xcode. Shouldn't require any specific source code.
The text was updated successfully, but these errors were encountered:
So this has been bothering me for a while. SwiftLint is a bit over-enthusiastic about calling its equivalent of fatalError in a few cases - maybe even just this one, and that function calls abort().
Your config will do the same on the command line - this is not Build Tool Plugin related.
% swiftlint --config /tmp/t.yml
The operation couldn’t be completed. (SwiftLintCore.Issue error 6.)
Could not read configuration: file Configuration.swift, line 236
zsh: abort swiftlint --config /tmp/t.yml
My expectation as a user is that Xcode's build process should abort, with a single error in the Issues Navigator explaining the .swiftlint.yml formatting error (or whatever other reason SwiftLint couldn't continue).
I'm not sure if that's as simple as reporting a single error line through the normal mechanisms (a stdout line with error: …, right?) before exit()ing, or it's more involved than that.
New Issue Checklist
Describe the bug
SwiftLint crashes (EXC_CRASH (SIGABRT)) when used as a Build Tool Plugin, with certain custom rules (see Environment).
macOS Problem Report dialog:
Running
swiftlint lint
on the CLI works displays the following warning:but then continues on with:
and does not crash.
(This is issue is not about the bad config itself; I'm aware and I'll fix it; this issue about about the plugin EXC_CRASH-ing.)
Environment
If so, paste their relative paths and respective contents.
xcodebuild -version
)? Xcode 15.0 Build version 15A240dThe text was updated successfully, but these errors were encountered: