flood-io/ruby-jmeter

View on GitHub
lib/ruby-jmeter/dsl/summary_report.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method initialize has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(params={})
      testname = params.kind_of?(Array) ? 'SummaryReport' : (params[:name] || 'SummaryReport')
      @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="#{testname}" enabled="true">
  <boolProp name="ResultCollector.error_logging">false</boolProp>
Severity: Minor
Found in lib/ruby-jmeter/dsl/summary_report.rb - About 1 hr to fix

    Similar blocks of code found in 108 locations. Consider refactoring.
    Open

      class SummaryReport
        attr_accessor :doc
        include Helper
    
        def initialize(params={})
    Severity: Major
    Found in lib/ruby-jmeter/dsl/summary_report.rb and 107 other locations - About 45 mins to fix
    lib/ruby-jmeter/dsl/access_log_sampler.rb on lines 9..29
    lib/ruby-jmeter/dsl/aggregate_graph.rb on lines 9..52
    lib/ruby-jmeter/dsl/aggregate_report.rb on lines 9..52
    lib/ruby-jmeter/dsl/assertion_results.rb on lines 9..52
    lib/ruby-jmeter/dsl/beanshell_assertion.rb on lines 9..25
    lib/ruby-jmeter/dsl/beanshell_listener.rb on lines 9..25
    lib/ruby-jmeter/dsl/beanshell_postprocessor.rb on lines 9..25
    lib/ruby-jmeter/dsl/beanshell_preprocessor.rb on lines 9..25
    lib/ruby-jmeter/dsl/beanshell_sampler.rb on lines 9..25
    lib/ruby-jmeter/dsl/beanshell_timer.rb on lines 9..25
    lib/ruby-jmeter/dsl/bsf_assertion.rb on lines 9..25
    lib/ruby-jmeter/dsl/bsf_listener.rb on lines 9..25
    lib/ruby-jmeter/dsl/bsf_postprocessor.rb on lines 9..25
    lib/ruby-jmeter/dsl/bsf_preprocessor.rb on lines 9..25
    lib/ruby-jmeter/dsl/bsf_sampler.rb on lines 9..25
    lib/ruby-jmeter/dsl/bsf_timer.rb on lines 9..25
    lib/ruby-jmeter/dsl/compare_assertion.rb on lines 9..24
    lib/ruby-jmeter/dsl/comparison_assertion_visualizer.rb on lines 9..52
    lib/ruby-jmeter/dsl/constant_throughput_timer.rb on lines 9..23
    lib/ruby-jmeter/dsl/constant_timer.rb on lines 9..22
    lib/ruby-jmeter/dsl/counter.rb on lines 9..28
    lib/ruby-jmeter/dsl/cssjquery_extractor.rb on lines 9..28
    lib/ruby-jmeter/dsl/csv_data_set_config.rb on lines 9..30
    lib/ruby-jmeter/dsl/debug_postprocessor.rb on lines 9..25
    lib/ruby-jmeter/dsl/debug_sampler.rb on lines 9..24
    lib/ruby-jmeter/dsl/distribution_graphalpha.rb on lines 9..52
    lib/ruby-jmeter/dsl/duration_assertion.rb on lines 9..22
    lib/ruby-jmeter/dsl/foreach_controller.rb on lines 9..24
    lib/ruby-jmeter/dsl/ftp_request.rb on lines 9..31
    lib/ruby-jmeter/dsl/ftp_request_defaults.rb on lines 9..29
    lib/ruby-jmeter/dsl/gaussian_random_timer.rb on lines 9..23
    lib/ruby-jmeter/dsl/generate_summary_results.rb on lines 9..20
    lib/ruby-jmeter/dsl/graph_results.rb on lines 9..52
    lib/ruby-jmeter/dsl/html_assertion.rb on lines 9..27
    lib/ruby-jmeter/dsl/html_link_parser.rb on lines 9..20
    lib/ruby-jmeter/dsl/html_parameter_mask.rb on lines 9..29
    lib/ruby-jmeter/dsl/http_authorization_manager.rb on lines 9..30
    lib/ruby-jmeter/dsl/http_cache_manager.rb on lines 9..23
    lib/ruby-jmeter/dsl/http_cookie_manager.rb on lines 9..25
    lib/ruby-jmeter/dsl/http_header_manager.rb on lines 9..27
    lib/ruby-jmeter/dsl/http_url_rewriting_modifier.rb on lines 9..27
    lib/ruby-jmeter/dsl/if_controller.rb on lines 9..24
    lib/ruby-jmeter/dsl/include_controller.rb on lines 9..22
    lib/ruby-jmeter/dsl/java_request.rb on lines 9..66
    lib/ruby-jmeter/dsl/java_request_defaults.rb on lines 9..66
    lib/ruby-jmeter/dsl/jdbc_connection_configuration.rb on lines 9..34
    lib/ruby-jmeter/dsl/jdbc_postprocessor.rb on lines 9..30
    lib/ruby-jmeter/dsl/jdbc_preprocessor.rb on lines 9..30
    lib/ruby-jmeter/dsl/jdbc_request.rb on lines 9..30
    lib/ruby-jmeter/dsl/jms_publisher.rb on lines 9..40
    lib/ruby-jmeter/dsl/jms_subscriber.rb on lines 9..32
    lib/ruby-jmeter/dsl/json_path_postprocessor.rb on lines 9..24
    lib/ruby-jmeter/dsl/jsr223_assertion.rb on lines 9..26
    lib/ruby-jmeter/dsl/jsr223_listener.rb on lines 9..26
    lib/ruby-jmeter/dsl/jsr223_postprocessor.rb on lines 9..26
    lib/ruby-jmeter/dsl/jsr223_preprocessor.rb on lines 9..26
    lib/ruby-jmeter/dsl/jsr223_sampler.rb on lines 9..26
    lib/ruby-jmeter/dsl/jsr223_timer.rb on lines 9..26
    lib/ruby-jmeter/dsl/junit_request.rb on lines 9..34
    lib/ruby-jmeter/dsl/keystore_configuration.rb on lines 9..25
    lib/ruby-jmeter/dsl/ldap_extended_request.rb on lines 9..39
    lib/ruby-jmeter/dsl/ldap_extended_request_defaults.rb on lines 9..39
    lib/ruby-jmeter/dsl/login_config_element.rb on lines 9..23
    lib/ruby-jmeter/dsl/loop_controller.rb on lines 9..23
    lib/ruby-jmeter/dsl/mail_reader_sampler.rb on lines 9..34
    lib/ruby-jmeter/dsl/mailer_visualizer.rb on lines 9..61
    lib/ruby-jmeter/dsl/md5hex_assertion.rb on lines 9..22
    lib/ruby-jmeter/dsl/module_controller.rb on lines 9..22
    lib/ruby-jmeter/dsl/monitor_results.rb on lines 9..52
    lib/ruby-jmeter/dsl/once_only_controller.rb on lines 9..20
    lib/ruby-jmeter/dsl/poisson_random_timer.rb on lines 9..23
    lib/ruby-jmeter/dsl/random_controller.rb on lines 9..22
    lib/ruby-jmeter/dsl/random_order_controller.rb on lines 9..20
    lib/ruby-jmeter/dsl/random_variable.rb on lines 9..27
    lib/ruby-jmeter/dsl/recording_controller.rb on lines 9..20
    lib/ruby-jmeter/dsl/regex_user_parameters.rb on lines 9..24
    lib/ruby-jmeter/dsl/regular_expression_extractor.rb on lines 9..29
    lib/ruby-jmeter/dsl/response_assertion.rb on lines 9..28
    lib/ruby-jmeter/dsl/response_time_graph.rb on lines 9..52
    lib/ruby-jmeter/dsl/result_status_action_handler.rb on lines 9..22
    lib/ruby-jmeter/dsl/runtime_controller.rb on lines 9..22
    lib/ruby-jmeter/dsl/save_responses_to_a_file.rb on lines 9..26
    lib/ruby-jmeter/dsl/simple_config_element.rb on lines 9..20
    lib/ruby-jmeter/dsl/simple_controller.rb on lines 9..20
    lib/ruby-jmeter/dsl/simple_data_writer.rb on lines 9..52
    lib/ruby-jmeter/dsl/smime_assertion.rb on lines 9..32
    lib/ruby-jmeter/dsl/smtp_sampler.rb on lines 9..48
    lib/ruby-jmeter/dsl/soapxmlrpc_request.rb on lines 9..30
    lib/ruby-jmeter/dsl/spline_visualizer.rb on lines 9..52
    lib/ruby-jmeter/dsl/switch_controller.rb on lines 9..22
    lib/ruby-jmeter/dsl/synchronizing_timer.rb on lines 9..23
    lib/ruby-jmeter/dsl/tcp_sampler.rb on lines 9..30
    lib/ruby-jmeter/dsl/tcp_sampler_config.rb on lines 9..28
    lib/ruby-jmeter/dsl/test_action.rb on lines 9..24
    lib/ruby-jmeter/dsl/test_fragment.rb on lines 9..20
    lib/ruby-jmeter/dsl/throughput_controller.rb on lines 9..29
    lib/ruby-jmeter/dsl/transaction_controller.rb on lines 9..23
    lib/ruby-jmeter/dsl/uniform_random_timer.rb on lines 9..23
    lib/ruby-jmeter/dsl/user_defined_variables.rb on lines 9..30
    lib/ruby-jmeter/dsl/user_parameters.rb on lines 9..27
    lib/ruby-jmeter/dsl/view_results_in_table.rb on lines 9..52
    lib/ruby-jmeter/dsl/view_results_tree.rb on lines 9..52
    lib/ruby-jmeter/dsl/while_controller.rb on lines 9..22
    lib/ruby-jmeter/dsl/xml_assertion.rb on lines 9..20
    lib/ruby-jmeter/dsl/xml_schema_assertion.rb on lines 9..22
    lib/ruby-jmeter/dsl/xpath_assertion.rb on lines 9..28
    lib/ruby-jmeter/dsl/xpath_extractor.rb on lines 9..28

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status