6

Introducing, DeepSource for Swift

 1 year ago
source link: https://deepsource.com/blog/swift-static-analysis
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Introducing, DeepSource for Swift

July 11, 2023

Swift has rapidly risen to prominence as a preferred programming language for Apple's ecosystem. With 30m+ registered developers on Apple's development platform, it's the primary programming language for developing applications on iOS and macOS platforms, including iPhone, iPad, Mac, and other Apple devices.

Today, I'm excited to announce DeepSource's Swift Analyzer, with support for static analysis, Static Application Security Testing (SAST), code coverage, and Autofix™️. The Swift Analyzer is available to all users and teams on DeepSource Cloud and Enterprise, and coming to Enterprise Server in the next release.

If you're an existing DeepSource user, simply enable the Analyzer on one of your repositories. If you're not on DeepSource yet, sign up here or request for a personalized demo for your team.

Write clean and secure Swift code

The Swift Analyzer detects 75+ issues as part of this release, with which it can flag potential bugs, performance bottlenecks, bad programming practices, and security vulnerabilities in your Swift code. We're working on adding more checks as part of our upcoming releases which should be available to you automatically. The analyzer is also designed to integrate seamlessly with SwiftLint, which is a widely used open-source linter in the Swift community. We understand the importance of compatibility with existing tools. This is why we respect any SwiftLint configuration you may have set up in your project.

Explore all issues that we can detect in the Directory here.

Autofix™️ for Swift

If you haven't seen Autofix™️ yet, here's the gist — DeepSource can automatically create fixes for issues detected in your code and create pull-requests in a couple of clicks. We've built Autofix™️ ground-up for Swift, starting with 14 checks. This will enable you to resolve hundreds of occurrences of issues across your entire repository easily.

64ad3d4db1e527a200ade747_swift-image-1.png

Repository metrics for Swift

In addition to detecting issues in your Swift code, DeepSource also helps you understand your code health through several metrics, such as documentation coverage, number of external dependencies, and code coverage. With the Swift Analyzer, you get all of these metrics tracked out-of-the-box. You can set thresholds and configure quality gates to block pull-requests if any of these thresholds fail.

The Documentation Coverage metric calculates and displays the percentage of functions, classes, etc in your codebase that have been documented. Not only this, but it also flags the specific functions, classes, and other constructs in your codebase that is not documented, so that you can take action and document them.

64ad3dc30f83b3bea75a92f5_swift-image-2.png

The Swift analyzer also displays the number of dependencies that are currently being used by your Swift project. The analyzer currently supports Swift Package Manager. Support for more package managers is on the way!

64ad3dfdc3b8f8489f5cc5cd_swift-image-3.png

Getting started with Swift on DeepSource

If your repository is already active on DeepSource, you can enable the DeepSource Swift Analyzer by adding the below entry in your .deepsource.toml file.

[[analyzers]]
name = "swift"

More information on how to configure the analyzer can be found here.

If you're not on DeepSource yet, sign up here or request for a personalized demo for your team. We're excited for you to try out DeepSource for Swift!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK