Commit 35f6161b authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Unify interface of all extra processing classes.

So they're all called using the pattern:

    SomeClass.new(@relations).process_all!
parent 4fd68a03
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -102,11 +102,11 @@ module JsDuck

    # Do all kinds of post-processing on relations.
    def apply_extra_processing
      CircularDeps.new(@relations).check_all
      InheritDoc.new(@relations).resolve_all
      Importer.import(@opts.imports, @relations, @opts.new_since)
      ReturnValues.auto_detect(@relations)
      Lint.new(@relations).run
      CircularDeps.new(@relations).process_all!
      InheritDoc.new(@relations).process_all!
      Importer.new(@relations, @opts).process_all!
      ReturnValues.new(@relations).process_all!
      Lint.new(@relations).process_all!
    end

  end
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ module JsDuck
    # Checks all classes for circular dependencies.
    #
    # When found, exits with a fatal error message.
    def check_all
    def process_all!
      @classes.each do |cls|
        if chain = check(cls)
          Logger.fatal("Class #{cls[:name]} has a circular dependency: #{chain}")
+10 −6
Original line number Diff line number Diff line
@@ -6,13 +6,17 @@ require 'jsduck/util/parallel'
module JsDuck

  # Reads in JSDuck exports of different versions of docs.
  module Importer
    module_function
  class Importer
    def initialize(relations, opts={})
      @relations = relations
      @opts = opts
    end

    # Loads in exported docs and generates @since and @new tags based on that data.
    def import(imports, relations, new_since=nil)
      if imports.length > 0
        generate_since_tags(read_all(imports), relations, new_since)
    # Loads in exported docs and generates @since and @new tags based
    # on that data.
    def process_all!
      if @opts[:imports].length > 0
        generate_since_tags(read_all(@opts[:imports]), @relations, @opts[:new_since])
      end
    end

+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ module JsDuck
    end

    # Performs all inheriting
    def resolve_all
    def process_all!
      @relations.each do |cls|
        resolve_class(cls) if cls[:inheritdoc]

+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ module JsDuck
    end

    # Runs the linter
    def run
    def process_all!
      warn_no_doc
      warn_unnamed
      warn_optional_params
Loading