Xcode 项目代码检查
这个项目还很新,并且存在一些不足之处。但是,它基本上能用!所以,请务必尝试一下。
XCLint 可以作为命令行工具和库使用。
工具
brew tap mattmassicotte/XCLint https://github.com/mattmassicotte/XCLint.git
brew install xclint
包
dependencies: [
.package(url: "https://github.com/mattmassicotte/XCLint", branch: "main")
],
targets: [
.testTarget(name: "MyTarget", dependencies: ["XCLinting"]),
]
只需在你的项目目录中运行 xclint
二进制文件。查看它的 -h
标志以获取更多用法。
# cd my/project
# xclint
这将运行默认的规则集。但是,你可以使用 .xclint.yml
文件自定义其行为。基本结构很大程度上借鉴了 SwiftLint。
# Some rules may not be appropriate for all projects. You must opt-in those.
opt_in_rules:
- embedded_build_setting # checks for build settings in the project file
- groups_sorted # checks that all group contents are alphabetically sorted
- implicit_dependencies # checks for any schemes that have "Find Implicit Dependencies" enabled
- targets_use_xcconfig # checks for any targets without a XCConfig file set
- projects_use_xcconfig # checks for any projects without a XCConfig file set
- shared_scheme_skips_tests # checks for any shared schemes that have disabled tests
- shared_schemes # checks that all targets have a shared scheme present
# Other rules make sense for all projects by default. You must opt-out of those.
disabled_rules:
- build_files_ordered # checks that the ordering of techincally-unordered collections Xcode writes out is preserved
- validate_build_settings # checks that build settings have valid values
- relative_paths # checks for any absolute file references
我曾希望有人已经构建了类似的东西。而且确实有人做过!然而,我找到的所有项目都不再维护了。
我很乐意听到你的反馈!通过 mastodon、issue 或 pull request 联系我。
我更倾向于协作,并且如果你有类似的项目,我很乐意找到合作的方式。
我更喜欢使用制表符缩进以提高可访问性。但是,我更希望你使用你想要的系统并提交 PR,而不是因为空格而犹豫。
通过参与此项目,你同意遵守 贡献者行为准则。