Summary
The website content outlines four essential tools for enhancing code quality and productivity in iOS projects through Git hooks: SwiftFormat, SwiftLint, Periphery, and Terminal-notifier.
Abstract
The article discusses the implementation of Git hooks in iOS development projects to improve code quality and developer workflow efficiency. It recommends four specific tools that serve different purposes within the Git hook framework. SwiftFormat is suggested as a pre-commit tool for code formatting, emphasizing its flexibility and the importance of not using it on the CI side. SwiftLint is presented as a mandatory linter to prevent code smells, with advice on running it in strict mode pre-commit and avoiding certain configurations in Xcode. Periphery is introduced as a dead code detector that can also identify regressions, with a recommendation to use it in pre-push hooks for larger projects. Lastly, Terminal-notifier is proposed to alert developers after hook processes complete, allowing them to attend to other tasks and return to review the results of the checks. The article encourages contributions from readers for additional tools and invites them to engage with the content through clapping and following the author.
Opinions
- SwiftFormat is considered the top tool for code formatting and should be integrated into the pre-commit hook to avoid slowing down the build process or losing file history in Xcode.
- SwiftLint is deemed mandatory for code linting and should be run in strict mode pre-commit to ensure code quality without hindering the development workflow.
- Periphery is valued for its ability to detect dead code and potential regressions, with a preference for its use in pre-push hooks, especially for larger projects.
- Terminal-notifier is appreciated for its utility in notifying developers of the status of pre-commit or pre-push checks, enhancing multitasking and productivity.
- The author expresses a strong preference against using SwiftLint in Xcode with warnings as errors and suggests a custom approach to run it on modified files only to avoid slowing down the build process.
- The article emphasizes that formatting source code should not be a responsibility of the Continuous Integration (CI) system.