Skip to content

Commit f54c866

Browse files
Merge pull request #9 from steeple-org/report-unspecified-columns
feat: Add ignored columns reporting
2 parents 96386a2 + f3957e1 commit f54c866

37 files changed

+262
-199
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
os: [ubuntu-latest, macos-latest]
24-
ruby: ['2.7', '3.0', '3.1', '3.2']
24+
ruby: ['3.2', '3.3']
2525
include:
2626
- os: ubuntu-latest
27-
ruby: '3.2'
27+
ruby: '3.3'
2828
coverage: true
2929
runs-on: ${{ matrix.os }}
3030
steps:
@@ -41,7 +41,7 @@ jobs:
4141
COVERAGE: ${{ matrix.coverage }}
4242
- name: Generate coverage artifact
4343
if: ${{ matrix.coverage }}
44-
uses: actions/upload-artifact@v3
44+
uses: actions/upload-artifact@v4
4545
with:
4646
name: docs-coverage
4747
path: docs/coverage
@@ -50,7 +50,7 @@ jobs:
5050
runs-on: ubuntu-latest
5151
steps:
5252
- name: Checkout repository
53-
uses: actions/checkout@v3
53+
uses: actions/checkout@v4
5454
- name: Setup Ruby
5555
uses: ruby/setup-ruby@v1
5656
with:
@@ -59,7 +59,7 @@ jobs:
5959
- name: Generate Ruby API documentation
6060
run : bundle exec yard doc
6161
- name: Generate Ruby API documentation artifact
62-
uses: actions/upload-artifact@v3
62+
uses: actions/upload-artifact@v4
6363
with:
6464
name: docs-ruby
6565
path: docs/ruby
@@ -80,12 +80,12 @@ jobs:
8080
url: ${{ steps.deployment.outputs.page_url }}
8181
steps:
8282
- name: Fetch Ruby API documentation artifact
83-
uses: actions/download-artifact@v3
83+
uses: actions/download-artifact@v4
8484
with:
8585
name: docs-ruby
8686
path: docs/ruby
8787
- name: Fetch coverage artifact
88-
uses: actions/download-artifact@v3
88+
uses: actions/download-artifact@v4
8989
with:
9090
name: docs-coverage
9191
path: docs/coverage

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require:
66
- rubocop-rspec
77

88
AllCops:
9-
TargetRubyVersion: 2.7
9+
TargetRubyVersion: 3.2
1010
NewCops: enable
1111
Exclude:
1212
- bin/rspec

Gemfile.lock

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ GEM
1212
docile (1.4.0)
1313
json (2.6.3)
1414
language_server-protocol (3.17.0.3)
15-
nokogiri (1.15.4-x86_64-darwin)
15+
nokogiri (1.18.8-arm64-darwin)
1616
racc (~> 1.4)
17-
nokogiri (1.15.4-x86_64-linux)
17+
nokogiri (1.18.8-x86_64-darwin)
18+
racc (~> 1.4)
19+
nokogiri (1.18.8-x86_64-linux-gnu)
1820
racc (~> 1.4)
1921
parallel (1.23.0)
2022
parser (3.2.2.3)
2123
ast (~> 2.4.1)
2224
racc
23-
racc (1.7.1)
25+
racc (1.8.1)
2426
rainbow (3.1.1)
2527
regexp_parser (2.8.1)
2628
rexml (3.2.6)
@@ -77,6 +79,8 @@ GEM
7779
yard (0.9.34)
7880

7981
PLATFORMS
82+
arm64-darwin-23
83+
arm64-darwin-24
8084
x86_64-darwin
8185
x86_64-linux
8286

lib/sheetah/attribute.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def each_column(config)
3131
header, header_pattern = config.header(key, index)
3232

3333
yield Column.new(
34-
key: key,
34+
key:,
3535
type: compiled_type,
36-
index: index,
37-
header: header,
38-
header_pattern: header_pattern,
39-
required: required
36+
index:,
37+
header:,
38+
header_pattern:,
39+
required:
4040
)
4141
end
4242
end

lib/sheetah/backends.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ module Backends
1313
class << self
1414
attr_reader :registry
1515

16-
def open(*args, **opts, &block)
17-
backend = opts.delete(:backend) || registry.get(*args, **opts)
16+
def open(*, **opts, &)
17+
backend = opts.delete(:backend) || registry.get(*, **opts)
1818

1919
if backend.nil?
2020
return Utils::MonadicResult::Failure.new(SimpleError.new("no_applicable_backend"))
2121
end
2222

23-
backend.open(*args, **opts, &block)
23+
backend.open(*, **opts, &)
2424
end
2525
end
2626
end

lib/sheetah/backends/csv.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def each_header
5959
@headers.each_with_index do |header, col_idx|
6060
col = Sheet.int2col(col_idx + 1)
6161

62-
yield Header.new(col: col, value: header)
62+
yield Header.new(col:, value: header)
6363
end
6464

6565
self
@@ -72,10 +72,10 @@ def each_row
7272
value = Array.new(@cols_count) do |col_idx|
7373
col = Sheet.int2col(col_idx + 1)
7474

75-
Cell.new(row: row, col: col, value: raw[col_idx])
75+
Cell.new(row:, col:, value: raw[col_idx])
7676
end
7777

78-
yield Row.new(row: row, value: value)
78+
yield Row.new(row:, value:)
7979
end
8080

8181
self

lib/sheetah/backends/wrapper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def each_row
4040
raw = @table[row]
4141

4242
value = Array.new(@cols_count) do |col_idx|
43-
Cell.new(row: row, col: Sheet.int2col(col_idx + 1), value: raw[col_idx])
43+
Cell.new(row:, col: Sheet.int2col(col_idx + 1), value: raw[col_idx])
4444
end
4545

46-
yield Row.new(row: row, value: value)
46+
yield Row.new(row:, value:)
4747
end
4848

4949
self

lib/sheetah/backends/xlsx.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def each_header
4141
@headers.each_with_index do |header, col_idx|
4242
col = Sheet.int2col(col_idx + 1)
4343

44-
yield Header.new(col: col, value: header)
44+
yield Header.new(col:, value: header)
4545
end
4646

4747
self
@@ -63,10 +63,10 @@ def each_row
6363
value = Array.new(@cols_count) do |col_idx|
6464
col = Sheet.int2col(col_idx + 1)
6565

66-
Cell.new(row: row, col: col, value: raw[col_idx])
66+
Cell.new(row:, col:, value: raw[col_idx])
6767
end
6868

69-
yield Row.new(row: row, value: value)
69+
yield Row.new(row:, value:)
7070
end
7171

7272
self

lib/sheetah/headers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require "set"
4-
53
module Sheetah
64
class Headers
75
include Utils::MonadicResult
@@ -72,6 +70,8 @@ def add_ensure_column_is_specified(header, column)
7270
@messenger.error("invalid_header", header.value)
7371
end
7472

73+
@messenger.warn("ignored_column", header.value) if @specification.report_ignored_columns?
74+
7575
false
7676
end
7777

lib/sheetah/messaging.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def scoping(...)
107107
dup.scoping!(...)
108108
end
109109

110-
def scope_row!(row, &block)
110+
def scope_row!(row, &)
111111
scope = case @scope
112112
when SCOPES::COL, SCOPES::CELL
113113
SCOPES::CELL
@@ -118,10 +118,10 @@ def scope_row!(row, &block)
118118
scope_data = @scope_data.dup || {}
119119
scope_data[:row] = row
120120

121-
scoping!(scope, scope_data, &block)
121+
scoping!(scope, scope_data, &)
122122
end
123123

124-
def scope_col!(col, &block)
124+
def scope_col!(col, &)
125125
scope = case @scope
126126
when SCOPES::ROW, SCOPES::CELL
127127
SCOPES::CELL
@@ -132,7 +132,7 @@ def scope_col!(col, &block)
132132
scope_data = @scope_data.dup || {}
133133
scope_data[:col] = col
134134

135-
scoping!(scope, scope_data, &block)
135+
scoping!(scope, scope_data, &)
136136
end
137137

138138
def scope_row(...)
@@ -159,11 +159,11 @@ def exception(error)
159159

160160
def add(severity, code, data)
161161
messages << Message.new(
162-
code: code,
162+
code:,
163163
code_data: data,
164164
scope: @scope,
165165
scope_data: @scope_data,
166-
severity: severity
166+
severity:
167167
)
168168

169169
self

0 commit comments

Comments
 (0)