Skip to content
Find in Swift repeated strings that could be replaced by a constant using SwiftSyntax
Swift Makefile
Branch: master
Clone or download
Latest commit 5ee4db6 Sep 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources Update Commandant Sep 26, 2019
Tests Check min length and threshold for strings Sep 20, 2019
.gitignore Run "swift package init --type executable" Mar 21, 2019
LICENSE Initial commit Mar 21, 2019
Makefile Remove statically linking option Jun 12, 2019
Package.resolved Update Commandant Sep 26, 2019
Package.swift Update Commandant Sep 26, 2019
README.md Update README.md Jun 12, 2019
bitrise.yml Add bitrise yml Apr 3, 2019
codecov.yml Add codecov yml Apr 3, 2019

README.md

swiftconst

Swift 5.1 Build Status codecov

Overview

Find in Swift repeated strings that could be replaced by a constant using SwiftSyntax.

This is highly inspired by goconst and Swift version of it.

Requirements

Swift 5.1+
Xcode 11.0+ beta

How to use

Installation

Run below command

$ make install
$ swiftconst help

Available Commands

help

Display general or command-specific help

run --path <path> --ignore <path,path...>

Display repeated strings

Examples

$ swiftconst run --ignore "/Users/kitasuke/SwiftConst/Tests/,/Users/kitasuke/SwiftConst/Package.swift"
other occurrence(s) of "error" found in: /Users/kitasuke/SwiftConst/main.swift:7:11
other occurrence(s) of "help" found in: /Users/kitasuke/SwiftConst/main.swift:18:19
other occurrence(s) of "error" found in: /Users/kitasuke/SwiftConst/main.swift:19:28
other occurrence(s) of "help" found in: /Users/kitasuke/SwiftConst/main.swift:21:19

TODOs

  • Recursive run in subfolders

Acknowledgements

You can’t perform that action at this time.