ios - 如何禁用 swiftlint 配置文件中的字符限制

标签 ios swift swiftlint

我正在做一个项目,我需要如何禁用 swiftlint 配置文件中的字符限制,那么如何禁用字符限制??

这是 swiftlint 文件

disabled_rules:
  - force_cast
  - force_try
  - variable_name
  - type_name
  - file_length
  - type_body_length
  - cyclomatic_complexity
  - function_body_length
  - valid_docs
  - trailing_whitespace

opt_in_rules:
  - empty_string

excluded:
  - Carthage
  - Pods
  - SwiftLint/Common/3rdPartyLib

line_length:
    warning: 150
    error: 200
    ignores_function_declarations: true
    ignores_comments: true
    ignores_urls: true

custom_rules:
  smiley_face:
    name: "Smiley Face"
    regex: '( :\))'
    match_kinds:
      - comment
      - string
    message: "A closing parenthesis smiley :) creates a half-hearted smile, and thus is not preferred. Use :]"
severity: warning

最佳答案

如果您遇到此警告的问题:

Identifier Name Violation: Variable name should be between 3 and 40 characters long: 'by' (identifier_name) 

您可以将这些命令添加到您的配置文件中:

variable_name:   
max_length:
    warning: 45
    error: 60   
min_length:
    warning: 1

我希望这对您有所帮助并符合您的问题。

关于ios - 如何禁用 swiftlint 配置文件中的字符限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53980576/

相关文章:

ios - Swift 从 UITableView 创建 CSV 并附加到电子邮件

xcode - 如何使用 CocoaPods 排除 SwiftLint 的文件/文件夹?

ios - 根据条件更新约束

iphone - 显示 UIAlertView 会导致 EXC_BAD_ACCESS

ios - 从特定点启动 AKSequencer

swift - 将 SwiftLint 作为依赖项添加到 Podspec 项目

ios - 在 Swift 中将参数从一个 View Controller 传递到另一个 View Controller

ios - 如何在 iPad 应用程序的弹出窗口中打开 google map ?

swift - 在子类 : Swift and SpriteKit 中循环 Initialization 的 drain