fui 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +16 -12
- data/RELEASING.md +1 -1
- data/bin/fui +18 -10
- data/lib/fui/finder.rb +13 -16
- data/lib/fui/project.rb +1 -1
- data/lib/fui/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1b8934ca5afcaf97a11129a196887f07aa1596113b40c18e061db018410df26
|
|
4
|
+
data.tar.gz: d8639e7b395f89c874c81cbe0d5613dea5e5db59a7e0ceb389e0ea32a361a0be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8bc77ab09250e68b6ff3f54111f107852d1a988cabfb875c167662363c3040cc904d37ac9133275741190aa11f72477e3bf19d5b6074d9ceffc6bfadc22ff5a1
|
|
7
|
+
data.tar.gz: 4397a5d1a4c8b19d7b4dc91b50808200c30d96083e311a3f7bf816df3b1b58922827e98bcfb77955fb02a4d977a8763bf03d5d59bf3c4ac45ff51f499b7ad72a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
### 0.6.0 (2026/04/12)
|
|
2
|
+
|
|
3
|
+
* [#45](https://github.com/dblock/fui/pull/45): Migrated from Travis CI to GitHub Actions with danger-pr-comment workflow - [@dblock](https://github.com/dblock).
|
|
4
|
+
* [#47](https://github.com/dblock/fui/pull/47): Fixed `ArgumentError: invalid byte sequence in UTF-8` when processing files with non-UTF-8 encoding - [@dblock](https://github.com/dblock).
|
|
5
|
+
* [#48](https://github.com/dblock/fui/pull/48): Fixed `NameError: undefined local variable or method 'project_path'` in verbose mode - [@dblock](https://github.com/dblock).
|
|
6
|
+
* [#49](https://github.com/dblock/fui/pull/49): Added summary output to `find` command: prints `Found N unused header(s).` or `No unused imports found.` - [@dblock](https://github.com/dblock).
|
|
7
|
+
* [#50](https://github.com/dblock/fui/pull/50): Fixed `delete` command to also remove `.mm` (Objective-C++) implementation files - [@dblock](https://github.com/dblock).
|
|
8
|
+
* [#51](https://github.com/dblock/fui/pull/51): Added support for Ruby 4.x - [@dblock](https://github.com/dblock).
|
|
9
|
+
* [#52](https://github.com/dblock/fui/pull/52): Clarified README: fui finds unreferenced header files, not unused imports within files - [@dblock](https://github.com/dblock).
|
|
10
|
+
|
|
1
11
|
### 0.5.0 (2018/12/19)
|
|
2
12
|
|
|
3
13
|
* [#29](https://github.com/dblock/fui/pull/29): Added support for ignoring paths through `-i`, `--ignore-path` - [@jeffctown](https://github.com/jeffctown).
|
data/README.md
CHANGED
|
@@ -2,10 +2,14 @@ Fui
|
|
|
2
2
|
==========
|
|
3
3
|
|
|
4
4
|
[](https://badge.fury.io/rb/fui)
|
|
5
|
-
[](https://github.com/dblock/fui/actions/workflows/test.yml)
|
|
6
6
|
|
|
7
7
|
Find unused Objective-C imports.
|
|
8
8
|
|
|
9
|
+
> **What fui does:** finds header (`.h`) files that are never imported anywhere in your project — i.e. classes that can potentially be deleted entirely.
|
|
10
|
+
>
|
|
11
|
+
> **What fui does not do:** find `#import` statements within a file that are unused by that file's code. For that, use a tool like [Clang's unused-includes warning](https://clang.llvm.org/docs/DiagnosticsReference.html) or AppCode.
|
|
12
|
+
|
|
9
13
|
# Table of Contents
|
|
10
14
|
|
|
11
15
|
- [Usage](#usage)
|
|
@@ -24,27 +28,27 @@ Find unused Objective-C imports.
|
|
|
24
28
|
|
|
25
29
|
## Usage
|
|
26
30
|
|
|
27
|
-
```
|
|
31
|
+
```sh
|
|
28
32
|
gem install fui
|
|
29
33
|
```
|
|
30
34
|
|
|
31
35
|
### Get Help
|
|
32
36
|
|
|
33
|
-
```
|
|
37
|
+
```sh
|
|
34
38
|
fui help
|
|
35
39
|
```
|
|
36
40
|
|
|
37
41
|
### Find Unused Classes in the Current Directory
|
|
38
42
|
|
|
39
|
-
```
|
|
43
|
+
```sh
|
|
40
44
|
fui find
|
|
41
45
|
```
|
|
42
46
|
|
|
43
|
-
The `find` command lists all
|
|
47
|
+
The `find` command lists all header (`.h`) files that are not imported anywhere in the project, and exits with the number of such files found.
|
|
44
48
|
|
|
45
49
|
### Find Unused Classes in any Path
|
|
46
50
|
|
|
47
|
-
```
|
|
51
|
+
```sh
|
|
48
52
|
fui --path=~/source/project/Name find
|
|
49
53
|
```
|
|
50
54
|
|
|
@@ -52,7 +56,7 @@ fui --path=~/source/project/Name find
|
|
|
52
56
|
|
|
53
57
|
Running `fui` with `-x` (or `--ignore-xib-files`) will, for example, mark `Foo.h` as unused when `Foo.xib` holds a reference to the `Foo` class and no other references to Foo.h exist.
|
|
54
58
|
|
|
55
|
-
```
|
|
59
|
+
```sh
|
|
56
60
|
fui -x --path=~/source/project/Name find
|
|
57
61
|
```
|
|
58
62
|
|
|
@@ -60,7 +64,7 @@ fui -x --path=~/source/project/Name find
|
|
|
60
64
|
|
|
61
65
|
Running `fui` with `-l` (or `--ignore-local-imports`) will, for example, mark `Foo.h` as unused when `Bar.h` contains a local (quotation syntax) import of `Foo.h` (eg. `#import Foo.h`).
|
|
62
66
|
|
|
63
|
-
```
|
|
67
|
+
```sh
|
|
64
68
|
fui -l --path=~/source/project/Name find
|
|
65
69
|
```
|
|
66
70
|
|
|
@@ -68,7 +72,7 @@ fui -l --path=~/source/project/Name find
|
|
|
68
72
|
|
|
69
73
|
Running `fui` with `-g` (or `--ignore-global-imports`) will, for example, mark `Foo.h` as unused when `Bar.h` contains a global (bracket syntax) import of `Foo.h` (eg. `#import <Framework/Foo.h>`).
|
|
70
74
|
|
|
71
|
-
```
|
|
75
|
+
```sh
|
|
72
76
|
fui -g --path=~/source/project/Name find
|
|
73
77
|
```
|
|
74
78
|
|
|
@@ -76,7 +80,7 @@ fui -g --path=~/source/project/Name find
|
|
|
76
80
|
|
|
77
81
|
Running `fui` with `-i` (or `--ignore-path`) will, for example, ignore a `Pods` folder when searching for headers or referencing files.
|
|
78
82
|
|
|
79
|
-
```
|
|
83
|
+
```sh
|
|
80
84
|
fui --path=~/source/project/Name --ignore-path=Pods find
|
|
81
85
|
```
|
|
82
86
|
|
|
@@ -84,13 +88,13 @@ fui --path=~/source/project/Name --ignore-path=Pods find
|
|
|
84
88
|
|
|
85
89
|
Running `fui` with `-i` (or `--ignore-path`) can ignore multiple folders when searching for headers or referencing files.
|
|
86
90
|
|
|
87
|
-
```
|
|
91
|
+
```sh
|
|
88
92
|
fui --path=~/source/project/Name --ignore-path=Pods --ignore-path=Libraries find
|
|
89
93
|
```
|
|
90
94
|
|
|
91
95
|
### Delete All Unused Class Files with Prompt
|
|
92
96
|
|
|
93
|
-
```
|
|
97
|
+
```sh
|
|
94
98
|
fui --path=~/source/project/Name delete --perform --prompt
|
|
95
99
|
```
|
|
96
100
|
|
data/RELEASING.md
CHANGED
|
@@ -11,7 +11,7 @@ bundle install
|
|
|
11
11
|
rake
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Check that the last build succeeded in [
|
|
14
|
+
Check that the last build succeeded in [GitHub Actions](https://github.com/dblock/fui/actions).
|
|
15
15
|
|
|
16
16
|
Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
|
|
17
17
|
|
data/bin/fui
CHANGED
|
@@ -37,7 +37,13 @@ command :find do |c|
|
|
|
37
37
|
puts relative_path
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
|
|
40
|
+
count = $fui.unused_references.count
|
|
41
|
+
if count > 0
|
|
42
|
+
puts "Found #{count} unused #{count == 1 ? 'header' : 'headers'}."
|
|
43
|
+
else
|
|
44
|
+
puts 'No unused imports found.'
|
|
45
|
+
end
|
|
46
|
+
exit_now! nil, count
|
|
41
47
|
end
|
|
42
48
|
end
|
|
43
49
|
|
|
@@ -57,7 +63,7 @@ command :delete do |c|
|
|
|
57
63
|
end.each do |k, _v|
|
|
58
64
|
relative_path = Pathname.new(k.path).relative_path_from(root).to_s
|
|
59
65
|
if options[:prompt]
|
|
60
|
-
print "Remove #{relative_path}(.m) [y/N] "
|
|
66
|
+
print "Remove #{relative_path}(.m/.mm) [y/N] "
|
|
61
67
|
response = STDIN.getc.upcase
|
|
62
68
|
puts "#{response.chr}\r\n"
|
|
63
69
|
next unless response.chr == 'Y'
|
|
@@ -68,16 +74,18 @@ command :delete do |c|
|
|
|
68
74
|
puts "#{relative_path}#{options[:perform] ? '' : ' (simulation)'}\r\n"
|
|
69
75
|
end
|
|
70
76
|
File.delete(k.path) if options[:perform]
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
['.m', '.mm'].each do |ext|
|
|
78
|
+
impl_path = k.path.gsub(/\.h$/, ext)
|
|
79
|
+
next unless File.exist?(impl_path)
|
|
73
80
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
relative_path = Pathname.new(impl_path).relative_path_from(root).to_s
|
|
82
|
+
if global_options[:verbose]
|
|
83
|
+
puts "Removing #{relative_path}#{options[:perform] ? '' : ' (simulation)'}\r\n"
|
|
84
|
+
else
|
|
85
|
+
puts "#{relative_path}#{options[:perform] ? '' : ' (simulation)'}\r\n"
|
|
86
|
+
end
|
|
87
|
+
File.delete(impl_path) if options[:perform]
|
|
79
88
|
end
|
|
80
|
-
File.delete(impl_path) if options[:perform]
|
|
81
89
|
end
|
|
82
90
|
ensure
|
|
83
91
|
system('stty -raw echo')
|
data/lib/fui/finder.rb
CHANGED
|
@@ -84,26 +84,23 @@ module Fui
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def process_code(references, path)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
references[header] << path if filename_without_extension != header.filename_without_extension && (local_import_exists || global_import_exists)
|
|
95
|
-
end
|
|
87
|
+
yield path if block_given?
|
|
88
|
+
file_contents = File.read(path, encoding: 'binary').encode('UTF-8', invalid: :replace, undef: :replace)
|
|
89
|
+
headers.each do |header|
|
|
90
|
+
filename_without_extension = File.basename(path, File.extname(path))
|
|
91
|
+
global_import_exists = global_imported(file_contents, header)
|
|
92
|
+
local_import_exists = local_imported(file_contents, header)
|
|
93
|
+
references[header] << path if filename_without_extension != header.filename_without_extension && (local_import_exists || global_import_exists)
|
|
96
94
|
end
|
|
97
95
|
end
|
|
98
96
|
|
|
99
97
|
def process_xml(references, path)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
end
|
|
98
|
+
yield path if block_given?
|
|
99
|
+
file_contents = File.read(path, encoding: 'binary').encode('UTF-8', invalid: :replace, undef: :replace)
|
|
100
|
+
headers.each do |header|
|
|
101
|
+
filename_without_extension = File.basename(path, File.extname(path))
|
|
102
|
+
check_xibs = !options['ignore-xib-files']
|
|
103
|
+
references[header] << path if (check_xibs || filename_without_extension != header.filename_without_extension) && file_contents.include?("customClass=\"#{header.filename_without_extension}\"")
|
|
107
104
|
end
|
|
108
105
|
end
|
|
109
106
|
end
|
data/lib/fui/project.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Fui
|
|
|
22
22
|
|
|
23
23
|
path_tokens = tokens[1].split('/')
|
|
24
24
|
bridging_header = path_tokens[path_tokens.length - 1]
|
|
25
|
-
puts "Bridging Header Found: #{bridging_header} in #{
|
|
25
|
+
puts "Bridging Header Found: #{bridging_header} in #{path}." if verbose
|
|
26
26
|
bridging_headers << bridging_header
|
|
27
27
|
end
|
|
28
28
|
bridging_headers.uniq
|
data/lib/fui/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Doubrovkine
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gli
|
|
@@ -24,7 +24,7 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
-
description:
|
|
27
|
+
description:
|
|
28
28
|
email: dblock@dblock.org
|
|
29
29
|
executables:
|
|
30
30
|
- fui
|
|
@@ -46,7 +46,7 @@ homepage: http://github.com/dblock/fui
|
|
|
46
46
|
licenses:
|
|
47
47
|
- MIT
|
|
48
48
|
metadata: {}
|
|
49
|
-
post_install_message:
|
|
49
|
+
post_install_message:
|
|
50
50
|
rdoc_options: []
|
|
51
51
|
require_paths:
|
|
52
52
|
- lib
|
|
@@ -61,9 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
62
|
version: 1.3.6
|
|
63
63
|
requirements: []
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
signing_key:
|
|
64
|
+
rubygems_version: 3.5.16
|
|
65
|
+
signing_key:
|
|
67
66
|
specification_version: 4
|
|
68
67
|
summary: Find unused Objective-C imports.
|
|
69
68
|
test_files: []
|