Loading lib/jsduck/class.rb +6 −3 Original line number Diff line number Diff line Loading @@ -147,8 +147,10 @@ module JsDuck # Singletons have no static members if @doc[:singleton] && context == :statics # Warn if singleton has static members if @doc[context][type].length > 0 Logger.instance.warn(:sing_static, "Singleton class #{@doc[:name]} can't have static members, remove the @static tag.") @doc[context][type].each do |m| ctx = m[:files][0] msg = "Singleton class #{@doc[:name]} can't have static members, remove the @static tag." Logger.instance.warn(:sing_static, msg, ctx[:filename], ctx[:linenr]) end return {} end Loading Loading @@ -185,7 +187,8 @@ module JsDuck hash1.delete(name) else ctx = m[:files][0] Logger.instance.warn(:hide, "@hide used but #{m[:tagname]} #{m[:name]} not found in parent class", ctx[:filename], ctx[:linenr]) msg = "@hide used but #{m[:tagname]} #{m[:name]} not found in parent class" Logger.instance.warn(:hide, msg, ctx[:filename], ctx[:linenr]) end else if hash1[name] Loading lib/jsduck/doc_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ module JsDuck out += replace_link_tag(s.scan(@link_re)) elsif substitute = @inline_img.replace(s) out += substitute elsif substitute = @inline_video.replace(s) elsif substitute = @inline_video.replace(s, @doc_context) out += substitute elsif s.check(/[{]/) # There might still be "{" that doesn't begin {@link} or {@img} - ignore it Loading lib/jsduck/examples.rb +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ module JsDuck @groups = JsonDuck.read(filename) @opts = opts fix_examples_data build_map_by_name("Two examples have the same name") build_map_by_name("Two examples have the same name", filename) end # Prefix all relative URL-s in examples list with path given in --examples-base-url Loading lib/jsduck/file_categories.rb +3 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ module JsDuck # Don't crash if old syntax is used. if @categories.is_a?(Hash) && @categories["categories"] Logger.instance.warn(nil, 'Update categories file to contain just the array inside {"categories": [...]}') Logger.instance.warn(nil, 'Update categories file to contain just the array inside {"categories": [...]}', @filename) @categories = @categories["categories"] end Loading @@ -36,7 +36,7 @@ module JsDuck re = Regexp.new("^" + name.split(/\*/, -1).map {|part| Regexp.escape(part) }.join('.*') + "$") classes = @relations.to_a.find_all {|cls| re =~ cls[:name] && !cls[:private] }.map {|cls| cls[:name] }.sort if classes.length == 0 Logger.instance.warn(:cat_no_match, "No class found matching a pattern '#{name}' in categories file.") Logger.instance.warn(:cat_no_match, "No class found matching a pattern '#{name} in categories file'", @filename) end classes end Loading @@ -56,7 +56,7 @@ module JsDuck # Check that each existing non-private class is listed @relations.each do |cls| unless listed_classes[cls[:name]] || cls[:private] Logger.instance.warn(:cat_class_missing, "Class '#{cls[:name]}' not found in categories file") Logger.instance.warn(:cat_class_missing, "Class '#{cls[:name]}' not found in categories file", @filename) end end end Loading lib/jsduck/grouped_asset.rb +2 −2 Original line number Diff line number Diff line Loading @@ -13,13 +13,13 @@ module JsDuck # # Prints warning when there is a duplicate item within a group. # The warning message should say something like "duplicate <asset type>" def build_map_by_name(warning_msg) def build_map_by_name(warning_msg, filename) @map_by_name = {} @groups.each do |group| group_map = {} group["items"].each do |item| if group_map[item["name"]] Logger.instance.warn(:dup_asset, "#{warning_msg} '#{item['name']}'") Logger.instance.warn(:dup_asset, "#{warning_msg} '#{item['name']}'", filename) end @map_by_name[item["name"]] = item group_map[item["name"]] = item Loading Loading
lib/jsduck/class.rb +6 −3 Original line number Diff line number Diff line Loading @@ -147,8 +147,10 @@ module JsDuck # Singletons have no static members if @doc[:singleton] && context == :statics # Warn if singleton has static members if @doc[context][type].length > 0 Logger.instance.warn(:sing_static, "Singleton class #{@doc[:name]} can't have static members, remove the @static tag.") @doc[context][type].each do |m| ctx = m[:files][0] msg = "Singleton class #{@doc[:name]} can't have static members, remove the @static tag." Logger.instance.warn(:sing_static, msg, ctx[:filename], ctx[:linenr]) end return {} end Loading Loading @@ -185,7 +187,8 @@ module JsDuck hash1.delete(name) else ctx = m[:files][0] Logger.instance.warn(:hide, "@hide used but #{m[:tagname]} #{m[:name]} not found in parent class", ctx[:filename], ctx[:linenr]) msg = "@hide used but #{m[:tagname]} #{m[:name]} not found in parent class" Logger.instance.warn(:hide, msg, ctx[:filename], ctx[:linenr]) end else if hash1[name] Loading
lib/jsduck/doc_formatter.rb +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ module JsDuck out += replace_link_tag(s.scan(@link_re)) elsif substitute = @inline_img.replace(s) out += substitute elsif substitute = @inline_video.replace(s) elsif substitute = @inline_video.replace(s, @doc_context) out += substitute elsif s.check(/[{]/) # There might still be "{" that doesn't begin {@link} or {@img} - ignore it Loading
lib/jsduck/examples.rb +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ module JsDuck @groups = JsonDuck.read(filename) @opts = opts fix_examples_data build_map_by_name("Two examples have the same name") build_map_by_name("Two examples have the same name", filename) end # Prefix all relative URL-s in examples list with path given in --examples-base-url Loading
lib/jsduck/file_categories.rb +3 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ module JsDuck # Don't crash if old syntax is used. if @categories.is_a?(Hash) && @categories["categories"] Logger.instance.warn(nil, 'Update categories file to contain just the array inside {"categories": [...]}') Logger.instance.warn(nil, 'Update categories file to contain just the array inside {"categories": [...]}', @filename) @categories = @categories["categories"] end Loading @@ -36,7 +36,7 @@ module JsDuck re = Regexp.new("^" + name.split(/\*/, -1).map {|part| Regexp.escape(part) }.join('.*') + "$") classes = @relations.to_a.find_all {|cls| re =~ cls[:name] && !cls[:private] }.map {|cls| cls[:name] }.sort if classes.length == 0 Logger.instance.warn(:cat_no_match, "No class found matching a pattern '#{name}' in categories file.") Logger.instance.warn(:cat_no_match, "No class found matching a pattern '#{name} in categories file'", @filename) end classes end Loading @@ -56,7 +56,7 @@ module JsDuck # Check that each existing non-private class is listed @relations.each do |cls| unless listed_classes[cls[:name]] || cls[:private] Logger.instance.warn(:cat_class_missing, "Class '#{cls[:name]}' not found in categories file") Logger.instance.warn(:cat_class_missing, "Class '#{cls[:name]}' not found in categories file", @filename) end end end Loading
lib/jsduck/grouped_asset.rb +2 −2 Original line number Diff line number Diff line Loading @@ -13,13 +13,13 @@ module JsDuck # # Prints warning when there is a duplicate item within a group. # The warning message should say something like "duplicate <asset type>" def build_map_by_name(warning_msg) def build_map_by_name(warning_msg, filename) @map_by_name = {} @groups.each do |group| group_map = {} group["items"].each do |item| if group_map[item["name"]] Logger.instance.warn(:dup_asset, "#{warning_msg} '#{item['name']}'") Logger.instance.warn(:dup_asset, "#{warning_msg} '#{item['name']}'", filename) end @map_by_name[item["name"]] = item group_map[item["name"]] = item Loading