suma 0.1.21 → 0.1.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ecda4b9c1b5f6b13d039f0e75b204530e35dd46c60050793e1587a5e472a335
4
- data.tar.gz: 69e12ab803b5bb531ee254b8e10035e8c49962880d1e27199b198ff12050b4cd
3
+ metadata.gz: 414cf7549060d821671a08771418a9f3c163ba23af62ef980eb4b12ccd0f5ad4
4
+ data.tar.gz: 0b30377a2b1db558bf62c765f136c5c505ba905b387a5d76e249fc48fce8c237
5
5
  SHA512:
6
- metadata.gz: bbaa072bf34862849489945df470195035711bde43b41b149014cb26888da6553349aac7e5c553651c61cfe6e6dfc50b6c610afbfb494d99541b4a87f755071a
7
- data.tar.gz: 4d96196454b0fc0eb01b0c6d247e9e624f6ef4dc3b1a286c969af66f05788919fb34eff70586bbc7c16ec8c59ea654a7a19a84b01d2f6d9cf60d692c03a2218c
6
+ metadata.gz: 7e899f31a08df29536d7abe1e8d2fc29a0c20038e1bb7dcedda35a7b9fa5d5041046e963d543401b4eaa100fa9d1aff19218b4e1c72457fb2a081a34211072f5
7
+ data.tar.gz: c764fc1985311dafb09074a498cfc30694427e95c2f29d4d243872fca5ddfa0ab6df3d323d785254b3ef69848cf3114c8b0b44b483ae09b97a1e293b05f82356
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-10-03 00:48:06 UTC using RuboCop version 1.81.1.
3
+ # on 2025-10-04 11:33:46 UTC using RuboCop version 1.81.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -68,11 +68,6 @@ Metrics/CyclomaticComplexity:
68
68
  - 'lib/suma/jsdai/figure_image.rb'
69
69
  - 'lib/suma/thor_ext.rb'
70
70
 
71
- # Offense count: 8
72
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
73
- Metrics/MethodLength:
74
- Max: 27
75
-
76
71
  # Offense count: 1
77
72
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
78
73
  Metrics/PerceivedComplexity:
@@ -2,9 +2,10 @@
2
2
 
3
3
  require "thor"
4
4
  require "yaml"
5
- require "terminal-table"
5
+ require "paint"
6
6
  require "plurimath"
7
7
  require "set" # For using Set in unique_character_count
8
+ require "table_tennis"
8
9
  require_relative "../thor_ext"
9
10
 
10
11
  module Suma
@@ -188,12 +189,18 @@ module Suma
188
189
 
189
190
  # Print each file's violations
190
191
  @file_violations.each_value do |file_violation|
191
- puts "\n#{file_violation.display_path}:"
192
+ puts "\n#{Paint[file_violation.display_path, :cyan, :bold]}:"
192
193
 
193
194
  file_violation.violations.each do |v|
194
- puts " Line #{v[:line_number]}, Column #{v[:column]}:"
195
+ puts " #{Paint['Line',
196
+ :blue]} #{Paint[v[:line_number],
197
+ :yellow]}, #{Paint['Column',
198
+ :blue]} #{Paint[v[:column],
199
+ :yellow]}:"
195
200
  puts " #{v[:line]}"
196
- puts " #{' ' * v[:column]}#{'^' * v[:match].length} Non-ASCII sequence"
201
+ puts " #{' ' * v[:column]}#{Paint['^' * v[:match].length,
202
+ :red]} #{Paint['Non-ASCII sequence',
203
+ :red]}"
197
204
 
198
205
  v[:char_details].each do |cd|
199
206
  character = file_violation.unique_characters.find do |c|
@@ -201,29 +208,42 @@ module Suma
201
208
  end
202
209
  next unless character
203
210
 
204
- puts " \"#{cd[:char]}\" - Hex: #{cd[:hex]}, UTF-8 bytes: #{cd[:utf8]}"
205
- puts " Replacement: #{character.replacement_text}"
211
+ puts " #{Paint["\"#{cd[:char]}\"",
212
+ :yellow]} - Hex: #{Paint[cd[:hex],
213
+ :magenta]}, UTF-8 bytes: #{Paint[cd[:utf8],
214
+ :magenta]}"
215
+ puts " #{Paint['Replacement:',
216
+ :green]} #{character.replacement_text}"
206
217
  end
207
218
  puts ""
208
219
  end
209
220
 
210
- puts " Found #{file_violation.violation_count} non-ASCII sequence(s) in #{file_violation.filename}\n"
221
+ puts " #{Paint['Found',
222
+ :green]} #{Paint[file_violation.violation_count,
223
+ :red]} #{Paint['non-ASCII sequence(s) in',
224
+ :green]} #{Paint[file_violation.filename,
225
+ :cyan]}\n"
211
226
  end
212
227
 
213
228
  # Print summary
214
- puts "\nSummary:"
215
- puts " Scanned #{@total_files} EXPRESS file(s)"
216
- puts " Found #{total_violations} non-ASCII sequence(s) in #{files_with_violations} file(s)"
229
+ puts "\n#{Paint['Summary:', :blue, :bold]}"
230
+ puts " #{Paint['Scanned',
231
+ :green]} #{Paint[@total_files,
232
+ :yellow]} #{Paint['EXPRESS file(s)',
233
+ :green]}"
234
+ puts " #{Paint['Found',
235
+ :green]} #{Paint[total_violations,
236
+ :red]} #{Paint['non-ASCII sequence(s) in',
237
+ :green]} #{Paint[files_with_violations,
238
+ :red]} #{Paint['file(s)',
239
+ :green]}"
217
240
  end
218
241
 
219
242
  def print_table_output
220
243
  return if @file_violations.empty?
221
244
 
222
- table = ::Terminal::Table.new(
223
- title: "Non-ASCII Characters Summary",
224
- headings: ["File", "Symbol", "Replacement", "Occurrences"],
225
- )
226
-
245
+ # Build rows array
246
+ rows = []
227
247
  total_occurrences = 0
228
248
 
229
249
  @file_violations.each_value do |file_violation|
@@ -231,25 +251,37 @@ module Suma
231
251
  occurrence_count = character.occurrence_count
232
252
  total_occurrences += occurrence_count
233
253
 
234
- table.add_row [
235
- file_violation.display_path,
236
- "\"#{character.char}\" (#{character.hex})",
237
- character.replacement_text,
238
- occurrence_count,
239
- ]
254
+ rows << {
255
+ file: file_violation.display_path,
256
+ symbol: "\"#{character.char}\" (#{character.hex})",
257
+ replacement: character.replacement_text,
258
+ occurrences: occurrence_count,
259
+ }
240
260
  end
241
261
  end
242
262
 
243
- # Add a separator and total row
244
- table.add_separator
245
- table.add_row [
246
- "TOTAL",
247
- "#{unique_character_count} unique",
248
- "",
249
- total_occurrences,
250
- ]
263
+ # Add total row
264
+ rows << {
265
+ file: "TOTAL",
266
+ symbol: "#{unique_character_count} unique",
267
+ replacement: "",
268
+ occurrences: total_occurrences,
269
+ }
270
+
271
+ # Use TableTennis to render
272
+ options = {
273
+ title: "Non-ASCII Characters Summary",
274
+ columns: %i[file symbol replacement occurrences],
275
+ headers: {
276
+ file: "File",
277
+ symbol: "Symbol",
278
+ replacement: "Replacement",
279
+ occurrences: "Occurrences",
280
+ },
281
+ mark: ->(row) { row[:file] == "TOTAL" },
282
+ }
251
283
 
252
- puts "\n#{table}\n"
284
+ puts "\n#{TableTennis.new(rows, options)}\n"
253
285
  end
254
286
 
255
287
  private
data/lib/suma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Suma
4
- VERSION = "0.1.21"
4
+ VERSION = "0.1.22"
5
5
  end
data/suma.gemspec CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
39
39
  spec.add_dependency "metanorma-cli"
40
40
  spec.add_dependency "plurimath"
41
41
  spec.add_dependency "ruby-progressbar"
42
- spec.add_dependency "terminal-table", "~> 3.0"
42
+ spec.add_dependency "table_tennis"
43
43
  spec.add_dependency "thor", ">= 0.20"
44
44
  spec.metadata["rubygems_mfa_required"] = "true"
45
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-03 00:00:00.000000000 Z
11
+ date: 2025-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir
@@ -95,19 +95,19 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: terminal-table
98
+ name: table_tennis
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: thor
113
113
  requirement: !ruby/object:Gem::Requirement