realm / realm/SwiftLint

Swift Package Manager Plugin `SwiftLint Configuration Error: Unable to cache remote config`

Open
#4,787 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion integration
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
Describe the bug

When I try to use SwiftLint SPM plugin with my Package.swift project, load local non-nested configure is fine, but when I add parent_config, it seems got write permission issue when resolve the remote url

if I'm not wrong it hit here, because when running spm build command can't caching to rootDir as the default configure.

Screenshot 2023-02-28 at 1 53 35 PM
Complete output when running SwiftLint, including the stack trace and command used
/usr/bin/sandbox-exec -p "(version 1)
(deny default)
(import \"system.sb\")
(allow file-read*)
(allow process*)
(allow file-write*
    (subpath \"/private/tmp\")
    (subpath \"/private/var/folders/8c/kg72g5051tvcx9yzc4_7qh180000gn/T\")
)
(deny file-write*
    (subpath \"/Users/user007/Documents/user007/CommonModuleLib\")
)
(allow file-write*
    (subpath \"/Users/user007/Library/Developer/Xcode/DerivedDaTM/CommonModuleLib-fpzeyejjipbikmaamsqhxtbqyfph/SourcePackages/plugins/CommonModuleLib.output/CommonModuleLib/SwiftLintPlugin\")
)
" /Users/user007/Library/Developer/Xcode/DerivedDaTM/CommonModuleLib-fpzeyejjipbikmaamsqhxtbqyfph/SourcePackages/artifacts/swiftlint/SwiftLintBinary.artifactbundle/swiftlint-0.50.3-macos/bin/swiftlint lint --quiet --cache-path /Users/user007/Library/Developer/Xcode/DerivedDaTM/CommonModuleLib-fpzeyejjipbikmaamsqhxtbqyfph/SourcePackages/plugins/CommonModuleLib.output/CommonModuleLib/SwiftLintPlugin --config /Users/user007/Documents/user007/CommonModuleLib/.swiftlint.yml /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Cache/TMTemplate.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Cache/TMWebViewPool.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Cache/TMWebviewCache.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Cache/TMWebviewCollection.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Models/AnyDecodable.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Models/TMElementFrame.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Models/TMJavascriptMessage.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Plugins/TMCheckCompatibilityPlugin/TMCheckCompatibilityPlugin.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Plugins/TMHeightObserverPlugin/TMHeightObserverPlugin.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Plugins/TMLifeCyclePlugin/TMLifeCyclePlugin.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Plugins/TMLogPlugin/TMLogPlugin.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Protocols/CommonModuleLibDelegate.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Protocols/CommonModuleLibPluginProtocol.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/Protocols/CommonModuleLibTemplate.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/TMEventHandler.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/TMMessageParser.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/TMURLSchemeHandler.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/BundleExtension.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/CodableTransform.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/LRUCache.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/StringExtension.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/TMConsTMnts.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/TMError.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/TMMapper.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibHelpers/TMNotificationNames.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibViewController+Helper.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibViewController+TMWebViewDelegate.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/CommonModuleLibViewController.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/WebView/STMteOperation/AsyncOperation.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/WebView/STMteOperation/CommonModuleLibOperation.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/WebView/TMSTMteHistory.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/WebView/TMWebView.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/WebView/CommonModuleLibSTMte.swift /Users/user007/Documents/user007/CommonModuleLib/Sources/CommonModuleLib/WebView/CommonModuleLibSTMteSync.swift

error: SwiftLint Configuration Error: Unable to cache remote config from "http://dest/.parent_swiftlint.yml". Also didn't found cached version to fallback to.
Could not read configuration: file Configuration.swift, line 241
Environment
  • SwiftLint version (run swiftlint version to be sure)? 0.50.3
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? SPM, work with Swift Package Manager Plug-in
  • Paste your configuration file:
parent_config: http://localhost:8000/.parent_swiftlint.yml
remote_timeout: 10

included:
- Sources

excluded:
- Tests
- Demo
- .build
line_length:
    warning: 500
    error: 1000
    ignores_function_declarations: true
    ignores_comments: true
    ignores_urls: true
function_body_length:
    warning: 300
    error: 500
function_parameter_count:
    warning: 6
    error: 8
type_body_length:
    warning: 300
    error: 500
file_length:
    warning: 1000
    error: 1500
    ignore_comment_only_lines: true
cyclomatic_complexity:
    warning: 15
    error: 25
...
disabled_rules:
    - trailing_whitespace
    - multiple_closures_with_trailing_closure
    - todo
    - convenience_type
    - for_where
    - force_unwrapping
    - large_tuple
    - force_cast
    - force_try
    - nesting    

opt_in_rules:
    - attributes
    - closure_end_indentation
    - closure_spacing
    - collection_alignment
    - conditional_returns_on_newline
    - contains_over_filter_count
    - contains_over_filter_is_empty
    - contains_over_first_not_nil
    - contains_over_range_nil_comparison
    - discouraged_object_literal
    - empty_collection_literal
    - empty_count
    - empty_string
    - enum_case_associated_values_count
    - explicit_init
    - fatal_error_message
    - file_name_no_space
    - first_where
    - last_where
    - flatmap_over_map_reduce
    - legacy_multiple
    - legacy_random
    - let_var_whitespace
    - literal_expression_end_indentation
    - multiline_arguments
    - multiline_function_chains
    - multiline_parameters
    - operator_usage_whitespace
    - prefer_self_type_over_type_of_self
    - prefer_zero_over_explicit_init
    - reduce_into
    - sorted_first_last
    - yoda_condition

excluded:
    - ${PWD}/Carthage
    - ${PWD}/Pods
    - ${PWD}/SwiftLint/Common/3rdPartyLib
    - Carthage
    - Pods
    - SwiftLint/Common/3rdPartyLib

line_length:
    warning: 150
    error: 200
    ignores_function_declarations: true
    ignores_comments: true
    ignores_urls: true
    
function_body_length:
    warning: 300
    error: 500
    
function_parameter_count:
    warning: 6
    error: 8
    
type_body_length:
    warning: 300
    error: 500
    
file_length:
    warning: 1000
    error: 1500
    ignore_comment_only_lines: true
    
cyclomatic_complexity:
    warning: 15
    error: 25
    
identifier_name:
    excluded:
        - id
        - ad
        - lhs
        - rhs
        - id
        - ad
        - zb
        - sm
        - wb
        - vc
        - vm
        - zh
        - x
        - y
        - i
        - j
        - k
        - x1
        - y1
    allowed_symbols: ["_"]
    
attributes:
    always_on_same_line: ["@discardableResult", "@objc", "@IBAction", "@IBDesignable", "@IBInspectable"]
    
reporter: "xcode"
  • Which Xcode version are you using (check xcodebuild -version)? Version 14.2 (14C18)
  • 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. No, the issue is not related to rule itself, it related to load configratiion

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Configuration.swift line 241 and reproduce the failure with the Swift Package Manager plugin, the shown Package.swift project, and a .swiftlint.yml using parent_config. Inspect how the plugin invokes SwiftLint and caches the remote configuration under the sandboxed paths. Done means the parent configuration resolves and caches without the reported permission error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.