Commit ed3d0c96 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Create new warning type for @aside warnings.

Also output file and linenr when context available.
parent 8ae6a412
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ module JsDuck
        [:cat_no_match, "Class pattern in categories file matches nothing"],
        [:cat_class_missing, "Class is missing from categories file"],
        [:guide, "Guide is missing from --guides dir"],
        [:aside, "Problem with @aside tag"],
      ]
      # Turn off all warnings by default.
      # This is good for testing.
+7 −5
Original line number Diff line number Diff line
@@ -34,11 +34,6 @@ module JsDuck::Tag
      end.compact
    end

    def warn(msg)
      JsDuck::Logger.instance.warn(nil, msg)
      nil
    end

    def to_html(asides)
      asides.map do |aside|
        asset = get_asset(aside[:type], aside[:name])
@@ -61,6 +56,13 @@ module JsDuck::Tag
        else nil
      end
    end

    def warn(msg)
      ctx = @context ? @context[:files][0] : {}
      JsDuck::Logger.instance.warn(:aside, msg, ctx[:filename], ctx[:linenr])
      nil
    end

  end
end