From 25075999dc69ba225ed67175324650084f8c6641 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Tue, 23 Jul 2013 16:04:05 +0200 Subject: [PATCH] report problematic code when buildin is called in wrong way (gh#yast/ycp-killer#575) --- src/ruby/yast/builtins.rb | 2 +- src/ruby/yast/ops.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ruby/yast/builtins.rb b/src/ruby/yast/builtins.rb index 4dc75191..c9de4bdf 100644 --- a/src/ruby/yast/builtins.rb +++ b/src/ruby/yast/builtins.rb @@ -868,7 +868,7 @@ def self.tostring val, width=nil val.signature.match /(.*)\((.*)\)/ "" else - y2warning "tostring builtin called on wrong type #{val.class}" + y2warning 1, "tostring builtin called on wrong type #{val.class}" return val.inspect end end diff --git a/src/ruby/yast/ops.rb b/src/ruby/yast/ops.rb index 82a7a3cf..5ea1191a 100644 --- a/src/ruby/yast/ops.rb +++ b/src/ruby/yast/ops.rb @@ -64,11 +64,11 @@ def self.get (object, indexes, default=nil) if (0..res.size-1).include? i res = res[i] else - Yast.y2milestone "Index #{i} is out of array size" + Yast.y2milestone 1, "Index #{i} is out of array size" return block_given? ? yield : default end else - Yast.y2warning "Passed #{i.inspect} as index key for array." + Yast.y2warning 1, "Passed #{i.inspect} as index key for array." return block_given? ? yield : default end when ::Hash @@ -81,7 +81,7 @@ def self.get (object, indexes, default=nil) Yast.y2milestone 1, "Builtin index called on nil." return block_given? ? yield : default else - Yast.y2warning "Builtin index called on wrong type #{res.class} from #{caller.inspect}" + Yast.y2warning 1, "Builtin index called on wrong type #{res.class}" return block_given? ? yield : default end end @@ -102,11 +102,11 @@ def self.set (object, indexes, value) if (0..res.size-1).include? i res = res[i] else - Yast.y2warning "Index #{i} is out of array size" + Yast.y2warning 1, "Index #{i} is out of array size" return end else - Yast.y2warning "Passed #{i.inspect} as index key for array." + Yast.y2warning 1, "Passed #{i.inspect} as index key for array." return end when ::Hash @@ -116,7 +116,7 @@ def self.set (object, indexes, value) return end else - Yast.y2warning "Builtin assign called on wrong type #{res.class}" + Yast.y2warning 1, "Builtin assign called on wrong type #{res.class}" return end end @@ -124,7 +124,7 @@ def self.set (object, indexes, value) when ::Array, Yast::Term, ::Hash res[last] = Yast.deep_copy(value) else - Yast.y2warning "Builtin assign called on wrong type #{res.class}" + Yast.y2warning 1, "Builtin assign called on wrong type #{res.class}" end end