【问题标题】:How to exclude Pod Warnings with SwiftLint如何使用 SwiftLint 排除 Pod 警告
【发布时间】:2019-08-02 23:17:58
【问题描述】:

Xcode 对我的一些 Pod 文件显示警告,尤其是关于已弃用变量的警告。

我已经有一个 .swiftlint.yml 文件,它与我的 Pods 文件夹位于同一个文件夹中。

这是我的文件的样子:

excluded:
   - Pods
   - Localization
line_length: 200
type_body_length:
   - 300 # warning
   - 400 # error
file_length:
warning: 500
error: 1200
function_body_length:
warning: 50
error: 100

我不明白为什么当我排除它们时它仍然显示这些警告。

【问题讨论】:

  • 这些可能不是 SwiftLint 警告。对于 Pod 警告,您可以随时尝试inhibit_all_warnings!
  • @user28434 谢谢你,这对我有用!

标签: ios swift xcode swiftlint


【解决方案1】:

以下将忽略 Pod 文件。

excluded: 
  - Pods

您只需要确保您的 .swiftlint.yml 文件必须位于项目的根路径上。

【讨论】:

    【解决方案2】:

    试试看

    platform :ios
    
    # ignore all warnings from all pods
    inhibit_all_warnings!
    
    # ignore warnings from a specific pod
    pod 'SwiftLint', :inhibit_warnings => true
    

    【讨论】:

      猜你喜欢
      • 2018-12-15
      • 2017-06-18
      • 2018-12-29
      • 2020-12-04
      • 2017-07-13
      • 2017-11-08
      • 2019-09-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多