forked from PaulTaykalo/swift-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
194e5e5
commit 2798552
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Unused | ||
`unused.sh` Searches for unused swift functions at specified path | ||
|
||
## Usage | ||
``` | ||
cd <path-to-the-project> | ||
<path-to-unused.sh>/unused.sh | ||
``` | ||
|
||
## Generated files | ||
- `raw_functions.txt` - a list of all found (declared) functions | ||
- `filtered_functions.txt`- a list of all found functions filtered by some euristics like (override, @IBAction, testXXX) | ||
- `unique_functions.txt`- unique functions names | ||
- `usage.txt` - functions usage (ATM only functions that appeared once are shown) | ||
- `sorted_usage.txt` - functions sorted by the usage (and name) | ||
- `delete_me.txt` - file that contains information about the function and where it is used | ||
|
||
## output | ||
``` | ||
Gathering functions | ||
There are 1898 potential functions found | ||
Gathering usage information | ||
There are 32 potential functions to be deleted found | ||
Gathering usage per each of them | ||
It took 197 seconds. | ||
``` | ||
|
||
## delete_me.txt | ||
This is an example of how outptut can look like | ||
``` | ||
---- selectionColor ---- | ||
ProjectPath/UIColorExtensions.swift- return UIColor(red: 220.0/255, green: 220.0/255, blue: 220.0/255, alpha: 1) | ||
ProjectPath/UIColorExtensions.swift- } | ||
ProjectPath/UIColorExtensions.swift- | ||
ProjectPath/UIColorExtensions.swift: static func selectionColor() -> UIColor { | ||
ProjectPath/UIColorExtensions.swift- return UIColor(red: 240.0/255, green: 240.0/255, blue: 240.0/255, alpha: 1) | ||
ProjectPath/UIColorExtensions.swift- } | ||
ProjectPath/UIColorExtensions.swift- | ||
``` | ||
|
||
## Known issues: | ||
- Fully text search (no fancy stuff) | ||
- A lot of false-positives (protocol functions and overrides) | ||
- A lot of false-negatives (text search, yep) |