Loading lib/jsduck/lint.rb +20 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ module JsDuck warn_unnamed warn_optional_params warn_duplicate_params warn_duplicate_members end # print warning for each global member Loading Loading @@ -84,6 +85,25 @@ module JsDuck end end # print warnings for duplicate member names def warn_duplicate_members @relations.each do |cls| members = {:members => {}, :statics => {}} cls.all_local_members.each do |m| group = (m[:meta] && m[:meta][:static]) ? :statics : :members type = m[:tagname] name = m[:name] hash = members[group][type] || {} if hash[name] warn(:dup_member, "Duplicate #{type} name #{name}", hash[name]) warn(:dup_member, "Duplicate #{type} name #{name}", m) end hash[name] = m members[group][type] = hash end end end # Loops through all members of all classes def each_member(&block) @relations.each {|cls| cls.all_local_members.each(&block) } Loading lib/jsduck/logger.rb +2 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ module JsDuck [:alt_name, "Name used as both classname and alternate classname"], [:name_missing, "Member or parameter has no name"], [:no_doc, "Member or class without documentation"], [:dup_param, "Method has two parameters with same name"], [:dup_param, "Method has two parameters with the same name"], [:dup_member, "Class has two members with the same name"], [:req_after_opt, "Required parameter comes after optional"], [:subproperty, "@param foo.bar where foo param doesn't exist"], [:sing_static, "Singleton class member marked as @static"], Loading Loading
lib/jsduck/lint.rb +20 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ module JsDuck warn_unnamed warn_optional_params warn_duplicate_params warn_duplicate_members end # print warning for each global member Loading Loading @@ -84,6 +85,25 @@ module JsDuck end end # print warnings for duplicate member names def warn_duplicate_members @relations.each do |cls| members = {:members => {}, :statics => {}} cls.all_local_members.each do |m| group = (m[:meta] && m[:meta][:static]) ? :statics : :members type = m[:tagname] name = m[:name] hash = members[group][type] || {} if hash[name] warn(:dup_member, "Duplicate #{type} name #{name}", hash[name]) warn(:dup_member, "Duplicate #{type} name #{name}", m) end hash[name] = m members[group][type] = hash end end end # Loops through all members of all classes def each_member(&block) @relations.each {|cls| cls.all_local_members.each(&block) } Loading
lib/jsduck/logger.rb +2 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ module JsDuck [:alt_name, "Name used as both classname and alternate classname"], [:name_missing, "Member or parameter has no name"], [:no_doc, "Member or class without documentation"], [:dup_param, "Method has two parameters with same name"], [:dup_param, "Method has two parameters with the same name"], [:dup_member, "Class has two members with the same name"], [:req_after_opt, "Required parameter comes after optional"], [:subproperty, "@param foo.bar where foo param doesn't exist"], [:sing_static, "Singleton class member marked as @static"], Loading