美文网首页
swiftlint使用

swiftlint使用

作者: 智能老树皮 | 来源:发表于2021-08-18 11:33 被阅读0次

网上教程比较多,本文适合小白适用

1、安装

 brew install swiftlint

2、根目录添加.swiftlint.yml(里面规则可以根据项目需要,适当修改)

# 黑名单,不检测哪些目录

excluded:

  - Pods

# 行的长度

line_length:200

# 执行时排除掉的规则

disabled_rules:

    - trailing_whitespace  # 行末尾不加空格

    - identifier_name  # 参数变量命名规则

3、避免未安装swiftlint报错,在工程配置脚本即可

# Type a script or drag a script file from your workspace to insert its path.

ifwhich swiftlint >/dev/null;then

  swiftlint

else

  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"

fi

相关文章

网友评论

      本文标题:swiftlint使用

      本文链接:https://www.haomeiwen.com/subject/vclgbltx.html