Sha256: cde3cedc7f0473efe3c8122e8f107e8c3b80c3907104475086796ebe776cc83e

Contents?: true

Size: 1.23 KB

Versions: 16

Compression:

Stored size: 1.23 KB

Contents

require 'jsduck/logger'
require 'jsduck/class'

module JsDuck
  module Process

    # Reports missing documentation
    class NoDoc
      def initialize(relations)
        @relations = relations
      end

      # Prints warning for each class or public member with no name
      def process_all!
        @relations.each do |cls|

          if cls[:doc] == ""
            warn(:class, "No documentation for #{cls[:name]}", cls)
          end

          cls.all_local_members.each do |member|
            if !member[:hide] && !JsDuck::Class.constructor?(member)
              if member[:doc] == ""
                warn(:member, "No documentation for #{member[:owner]}##{member[:name]}", member)
              end

              (member[:params] || []).each do |p|
                if p[:doc] == ""
                  warn(:param, "No documentation for parameter #{p[:name]} of #{member[:owner]}##{member[:name]}", member)
                end
              end

            end
          end

        end
      end

      private

      def warn(type, msg, owner)
        visibility = owner[:private] ? :private : (owner[:protected] ? :protected : :public)

        Logger.warn(:nodoc, msg, owner[:files][0], [type, visibility])
      end

    end

  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
solvas-jsduck-6.0.0.30539 lib/jsduck/process/no_doc.rb
solvas-jsduck-6.0.0.9571 lib/jsduck/process/no_doc.rb
solvas-jsduck-6.0.0.6154 lib/jsduck/process/no_doc.rb
solvas-jsduck-6.0.0.4021 lib/jsduck/process/no_doc.rb
solvas-jsduck-6.0.0.2554 lib/jsduck/process/no_doc.rb
solvas-jsduck-6.0.0.1891 lib/jsduck/process/no_doc.rb
solvas-jsduck-6.0.0.beta.1888 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.10 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.9 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.8 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.7 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.5 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.4 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.3 lib/jsduck/process/no_doc.rb
jsduck-troopjs-0.0.1 lib/jsduck/process/no_doc.rb
jsduck-6.0.0beta lib/jsduck/process/no_doc.rb