Skip to content

Commit 74f5692

Browse files
committed
fix: standalone bundle + standardrb clean
- Gemfile: fall back to the published interscript-maps gem when no sibling ../maps checkout exists, so the repo bundles standalone (mirrors the existing secryst group pattern) - Clear all remaining standardrb offenses in lib/: mechanical corrections (chars, and/or precedence, paren-wrapped assignment), explicit directives for deliberate patterns (eval-based compiler, method_missing DSL, execution-context globals, debug hooks) - Verified zero behavior change: transliteration smoke test identical before/after
1 parent 9830106 commit 74f5692

18 files changed

Lines changed: 50 additions & 37 deletions

File tree

Gemfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ gemspec
55
gem "rake", "~> 13.0"
66
gem "rspec", "~> 3.13"
77

8-
gem "interscript-maps", path: "../maps"
8+
if File.exist?("../maps")
9+
gem "interscript-maps", path: "../maps"
10+
else
11+
gem "interscript-maps"
12+
end
913

1014
group :secryst do
1115
if File.exist?("../../secryst")

lib/interscript.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,13 @@ def rababa_provision(model_name, model_uri)
136136

137137
# Redownload every hour
138138
if File.exist?(model_path) && File.mtime(model_path) + 3600 >= Time.now
139-
model_path
140139
else
140+
# standard:disable Security/Open -- fetches the configured model into the local cache
141141
data = URI.open(model_uri, encoding: "BINARY").read
142+
# standard:enable Security/Open
142143
File.binwrite(model_path, data)
143-
model_path
144144
end
145+
model_path
145146
end
146147

147148
def map_aliases

lib/interscript/compiler/ruby.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# rubocop:disable Style/GlobalVars, Security/Eval -- map-evaluation context globals; eval runs generated map code
12
$main_binding = binding
23

34
class Interscript::Compiler::Ruby < Interscript::Compiler
@@ -264,3 +265,4 @@ def self.reset_debug_data
264265
$map_debug = []
265266
end
266267
end
268+
# rubocop:enable Style/GlobalVars, Security/Eval

lib/interscript/dsl/items.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Interscript::DSL::Items
22
include Interscript::DSL::SymbolMM
33

4-
def method_missing sym, *args, **kwargs, &block
4+
def method_missing sym, *args, **kwargs, &block # standard:disable Style/MissingRespondToMissing -- every method builds a DSL item
55
super if args.length > 0
66
super if kwargs.length > 0
77
super if /[?!=]\z/.match?(sym.to_s)

lib/interscript/dsl/metadata.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def initialize(yaml: false, map_name: "", library: true, &block)
3737
when String, Integer, Date
3838
@node[sym] = stuff.to_s
3939
when NilClass
40+
# nil means the key is intentionally absent
4041
else
4142
warn "[#{@map_name}] Metadata key #{sym} expects a String, but #{stuff.class} was given"
4243
@node[sym] = stuff.inspect

lib/interscript/dsl/symbol_mm.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Interscript::DSL::SymbolMM
2-
def method_missing sym, *args, **kwargs, &block
2+
def method_missing sym, *args, **kwargs, &block # standard:disable Style/MissingRespondToMissing -- every method builds a DSL item
33
super if args.length > 0
44
super if kwargs.length > 0
55
super if /[?!=]\z/.match?(sym.to_s)

lib/interscript/interpreter.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# rubocop:disable Style/GlobalVars
2+
# $select_nth_string/$DEBUG_RE/$subs_array are deliberate execution/debug context flags
13
class Interscript::Interpreter < Interscript::Compiler
24
attr_accessor :map
35
def compile(map, _: nil)
@@ -48,7 +50,7 @@ def call(str, stage = :main, each: false, &block)
4850
options_set = true
4951

5052
opts = options.map { |i| (0...i).to_a }
51-
choices = opts[0].product(*opts[1..-1])
53+
choices = opts[0].product(*opts[1..])
5254
end
5355

5456
yielder.yield(result)
@@ -252,3 +254,4 @@ def build_item i, target = nil, doc = @map
252254
end
253255
end
254256
end
257+
# rubocop:enable Style/GlobalVars

lib/interscript/node/item.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def + other
2323

2424
middle = [this.last + other.first]
2525
this = this[0..-2]
26-
other = this[1..-1]
26+
other = this[1..]
2727
end
2828

2929
g = Interscript::Node::Item::Group.new(*this, *middle, *other)
@@ -41,7 +41,7 @@ def ==(other)
4141
end
4242

4343
def self.try_convert(i)
44-
i = Interscript::Node::Item::String.new(i) if i.class == ::String
44+
i = Interscript::Node::Item::String.new(i) if i.instance_of?(::String)
4545
raise Interscript::MapLogicError, "Wrong type #{i.class}, expected I::Node::Item" unless Interscript::Node::Item === i
4646
i
4747
end

lib/interscript/node/item/alias.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def inspect
5252
if map
5353
"map.#{map}.#{name}"
5454
else
55-
"#{name}"
55+
name.to_s
5656
end
5757
end
5858
end

lib/interscript/node/item/any.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def data
1919
when Array
2020
value.map { |i| Interscript::Node::Item.try_convert(i) }
2121
when ::String
22-
value.split("").map { |i| Interscript::Node::Item.try_convert(i) }
22+
value.chars.map { |i| Interscript::Node::Item.try_convert(i) }
2323
when Range
2424
value.map { |i| Interscript::Node::Item.try_convert(i) }
2525
end
@@ -45,7 +45,7 @@ def first_string
4545
end
4646

4747
def nth_string
48-
return first_string unless $select_nth_string
48+
return first_string unless $select_nth_string # standard:disable Style/GlobalVars
4949

5050
d = data
5151
Fiber.yield(:prepare)

0 commit comments

Comments
 (0)