<commit_before>=begin
                  Arachni
  Copyright (c) 2010 Tasos "Zapotek" Laskos <<EMAIL>>

  This is free software; you can copy and distribute and modify
  this program under the term of the GPL v2.0 License
  (See LICENSE file for details)

=end

module Arachni

#
# The namespace under which all modules exist
#
module Reports

    #
    # Resets the namespace unloading all module classes
    #
    def self.reset
        constants.each {
            |const|
            remove_const( const )
        }
    end
end

module Report

#
# Arachni::Report::Manager class
#
# Holds and manages the registry of the reports.
#
# @author: Tasos "Zapotek" Laskos
#                                      <<EMAIL>>
#                                      <<EMAIL>> <br/>
# @version: 0.1
#
class Manager < Arachni::ComponentManager

    # the extension of the Arachni Framework Report files
    EXTENSION   = '.afr'

    def initialize( opts )
        super( opts.dir['reports'], Arachni::Reports )
        @opts = opts
    end

    #
    # Takes care of report execution
    #
    # @see AuditStore
    #
    # @param  [AuditStore]  audit_store
    #
    def run( audit_store )
        self.each {
            |name, report|
            run_one( name, audit_store )
        }

        # run the default report
        run_one( 'afr', audit_store )
    end

    def run_one( name, audit_store )
        report = self.[](name).new( audit_store.deep_clone,
            prep_opts( name, self.[](name), @opts.reports[name] ) )

        report.run( )
    end

    def self.reset
        Arachni::Reports.reset
    end

    def extension
        return EXTENSION
    end

end

end
end
<commit_msg>run(): added a flag for the default afr report<commit_after>=begin
                  Arachni
  Copyright (c) 2010 Tasos "Zapotek" Laskos <<EMAIL>>

  This is free software; you can copy and distribute and modify
  this program under the term of the GPL v2.0 License
  (See LICENSE file for details)

=end

module Arachni

#
# The namespace under which all modules exist
#
module Reports

    #
    # Resets the namespace unloading all module classes
    #
    def self.reset
        constants.each {
            |const|
            remove_const( const )
        }
    end
end

module Report

#
# Arachni::Report::Manager class
#
# Holds and manages the registry of the reports.
#
# @author: Tasos "Zapotek" Laskos
#                                      <<EMAIL>>
#                                      <<EMAIL>> <br/>
# @version: 0.1
#
class Manager < Arachni::ComponentManager

    # the extension of the Arachni Framework Report files
    EXTENSION   = '.afr'

    def initialize( opts )
        super( opts.dir['reports'], Arachni::Reports )
        @opts = opts
    end

    #
    # Takes care of report execution
    #
    # @see AuditStore
    #
    # @param  [AuditStore]  audit_store
    #
    def run( audit_store, run_afr = true )
        self.each {
            |name, report|
            run_one( name, audit_store )
        }

        # run the default report
        run_one( 'afr', audit_store ) if run_afr
    end

    def run_one( name, audit_store )
        report = self.[](name).new( audit_store.deep_clone,
            prep_opts( name, self.[](name), @opts.reports[name] ) )

        report.run( )
    end

    def self.reset
        Arachni::Reports.reset
    end

    def extension
        return EXTENSION
    end

end

end
end

{'fraction_non_alphanumeric': 0.08739837398373984, 'fraction_numerical': 0.004645760743321719, 'mean_word_length': 1.8852596314907872, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4586894', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1042, 'n_words': 326}