Skip to content

xcode

An Xcode project: property lists that parse, complete string catalogs, asset catalogs that hold their images, Swift files that belong to a target, no arbitrary loads, and entitlements on a list. Guide: Swift.

A scope has a project file *.xcodeproj.

Parses every property list and entitlements file with plutil.

Runs at the commit stage, on macOS.

A broken plist fails the build, or ships an app whose settings fell back to their defaults.

Fix the element plutil names.

A plist with an unclosed dictionary fails plutil. Close the dictionary element.

gspot ignore xcode/plutil --paths "<path>" --reason "<why>"

Reports a target without strict concurrency, a run-script phase with no declared files, and a run-script phase that runs the linter or the formatter.

Runs at the commit stage, once per scope.

A phase with no declared files runs on every build, and data races pass the compiler without strict concurrency.

Set SWIFT_STRICT_CONCURRENCY = complete, declare the input and output files of each run-script phase, and take the linter and the formatter out of the build.

A run-script phase that calls swiftlint reports lint-script. Delete the phase: gspot runs SwiftLint before each commit.

Rule What it checks What to do
strict-concurrency Each target sets SWIFT_STRICT_CONCURRENCY = complete or builds with Swift 6. Set SWIFT_STRICT_CONCURRENCY = complete, or move the target to Swift 6.
undeclared-script Each run-script phase declares its input or output files. List the files that the script reads and writes in the phase.
lint-script No run-script phase runs SwiftLint or SwiftFormat. Remove the lint step from the build phase.
syntax A file that the check reads parses without errors. Fix the syntax at the reported line.
gspot ignore xcode/build-settings --paths "<path>" --reason "<why>"
gspot ignore xcode/build-settings --rule strict-concurrency --reason "<why>"

Checks that each string catalog parses and translates every string into all its locales.

Runs at the commit stage, once per scope.

A string with no translation shows its source language in the middle of a translated screen.

Add the translation, or mark the string as not translated in the catalog.

A catalog string that lacks a required locale reports a finding. Add the translation, or mark the string as not translated.

Rule What it checks What to do
missing-translation Each string of a catalog has a translation for each locale that the catalog uses. Translate the string, or set shouldTranslate to false for it.
syntax A file that the check reads parses without errors. Fix the syntax at the reported line.
gspot ignore xcode/xcstrings --paths "<path>" --reason "<why>"
gspot ignore xcode/xcstrings --rule missing-translation --reason "<why>"

Checks that each asset Contents.json parses, and that its image set holds each file it names.

Runs at the commit stage, once per scope.

An image set with no image draws nothing at run time.

Add the image or delete the asset.

A Contents.json that names a missing icon.png reports a finding. Add the image beside it, or remove the reference.

Rule What it checks What to do
empty-set Each image set names at least one image file. Add the image files to the set, or delete the set.
missing-image Each image file that a set names exists in the set folder. Add the file to the set folder, or remove its entry from Contents.json.
syntax A file that the check reads parses without errors. Fix the syntax at the reported line.
gspot ignore xcode/assets --paths "<path>" --reason "<why>"
gspot ignore xcode/assets --rule empty-set --reason "<why>"

Finds asset sets that no source or Xcode build setting names.

Runs at the commit stage, once per scope.

An asset nobody names ships in the app for nothing.

Delete the asset, or name it in the code that loads it.

An asset set that no source file or build setting names reports unused-asset. Delete it, or reference it where the app loads it.

gspot ignore xcode/unused-assets --paths "<path>" --reason "<why>"

Finds the Swift files in the tree that no target of the project names.

Runs at the commit stage, once per scope.

Xcode never compiles a Swift file that belongs to no target, so it breaks unnoticed.

Add the file to a target, or delete it.

A Swift file in no target reports a finding. Add the file to a target, or delete it.

gspot ignore xcode/files-without-target --paths "<path>" --reason "<why>"

Checks each entitlement against xcode.allowed_entitlements, when the settings hold that list.

Runs at the commit stage, once per scope. It skips until you set xcode.allowed_entitlements.

Each entitlement grants the app a system capability, so a new one needs its own review.

Remove the entitlement, or add it to xcode.allowed_entitlements.

An .entitlements key missing from xcode.allowed_entitlements reports a finding. Remove it, or add it to that list.

gspot ignore xcode/entitlements --paths "<path>" --reason "<why>"

Refuses a property list that allows arbitrary loads, which turns transport security off for every host.

Runs at the commit stage, once per scope.

Arbitrary loads let the app send plain HTTP to any host, and one forgotten debug setting ships that.

Remove the key, and add an exception for the one host that needs it.

An Info.plist with NSAllowsArbitraryLoads reports a finding. Remove the key, and add an exception only for a host that needs one.

gspot ignore xcode/app-transport-security --paths "<path>" --reason "<why>"
Setting What it sets
xcode.allowed_entitlements The entitlements the app may hold; empty turns the check off.
Rule file Installed when
.gspot/rules/XCODE.md Always
Tool Version
plutil Any, install it yourself

**/xcuserdata/** and **/*.xcuserstate. repository/local-files reports a tracked file at these paths.