Class: EmergeCLI::Commands::Reaper::DeadCodeResult
- Inherits:
-
Object
- Object
- EmergeCLI::Commands::Reaper::DeadCodeResult
- Defined in:
- lib/commands/reaper/reaper.rb
Instance Attribute Summary collapse
-
#counts ⇒ Object
readonly
Returns the value of attribute counts.
-
#dead_code ⇒ Object
readonly
Returns the value of attribute dead_code.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#pagination ⇒ Object
readonly
Returns the value of attribute pagination.
Instance Method Summary collapse
- #filtered_unseen_classes ⇒ Object
-
#initialize(data) ⇒ DeadCodeResult
constructor
A new instance of DeadCodeResult.
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ DeadCodeResult
Returns a new instance of DeadCodeResult.
155 156 157 158 159 160 |
# File 'lib/commands/reaper/reaper.rb', line 155 def initialize(data) @metadata = data['metadata'] @dead_code = data['dead_code'] @counts = data['counts'] @pagination = data['pagination'] end |
Instance Attribute Details
#counts ⇒ Object (readonly)
Returns the value of attribute counts.
153 154 155 |
# File 'lib/commands/reaper/reaper.rb', line 153 def counts @counts end |
#dead_code ⇒ Object (readonly)
Returns the value of attribute dead_code.
153 154 155 |
# File 'lib/commands/reaper/reaper.rb', line 153 def dead_code @dead_code end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
153 154 155 |
# File 'lib/commands/reaper/reaper.rb', line 153 def @metadata end |
#pagination ⇒ Object (readonly)
Returns the value of attribute pagination.
153 154 155 |
# File 'lib/commands/reaper/reaper.rb', line 153 def pagination @pagination end |
Instance Method Details
#filtered_unseen_classes ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/commands/reaper/reaper.rb', line 162 def filtered_unseen_classes @filtered_unseen_classes ||= dead_code .reject { |item| item['seen'] } .reject do |item| paths = item['paths'] next false if paths.nil? || paths.empty? next true if paths.any? do |path| path.include?('/SourcePackages/checkouts/') || path.include?('/Pods/') || path.include?('/Carthage/') || path.include?('/Vendor/') || path.include?('/Sources/') || path.include?('/DerivedSources/') end next false if paths.none? do |path| path.end_with?('.swift', '.java', '.kt') end end end |
#to_s ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/commands/reaper/reaper.rb', line 184 def to_s <<~SUMMARY.yellow Dead Code Analysis Results: App ID: #{@metadata['app_id']} App Version: #{@metadata['version']} Platform: #{@metadata['platform']} Statistics: - Total User Sessions: #{@counts['user_sessions']} - Seen Classes: #{@counts['seen_classes']} - Unseen Classes: #{@counts['unseen_classes']} SUMMARY end |