flood-io/ruby-jmeter

View on GitHub

Showing 44 of 173 total issues

Method run has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def run(params = {})
      file(params)
      logger.warn 'Test executing locally ...'

      cmd = "#{params[:path] ? File.join(params[:path], 'jmeter') : 'jmeter'} #{"-n" unless params[:gui] } -t #{params[:file]} -j #{params[:log] ? params[:log] : 'jmeter.log' } -l #{params[:jtl] ? params[:jtl] : 'jmeter.jtl' } #{build_properties(params[:properties]) if params[:properties]}"
Severity: Minor
Found in lib/ruby-jmeter/dsl.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

      def initialize(params={})
        testname = params.kind_of?(Array) ? 'CompositeGraph' : (params[:name] || 'CompositeGraph')
        graphNodes = params.collect { |g| "<stringProp name=\"\">#{g[:graph]}</stringProp>"}
        metricNodes = params.collect { |m| "<stringProp name=\"\">#{m[:metric]}</stringProp>"}

Severity: Major
Found in lib/ruby-jmeter/plugins/composite_graph.rb - About 2 hrs to fix

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

        def initialize(params={})
          testname = params.kind_of?(Array) ? 'JavaRequest' : (params[:name] || 'JavaRequest')
          @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
    <JavaSampler guiclass="JavaTestSamplerGui" testclass="JavaSampler" testname="#{testname}" enabled="true">
      <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
    Severity: Major
    Found in lib/ruby-jmeter/dsl/java_request.rb - About 2 hrs to fix

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

          def initialize(params={})
            testname = params.kind_of?(Array) ? 'JavaRequestDefaults' : (params[:name] || 'JavaRequestDefaults')
            @doc = Nokogiri::XML(<<-EOS.strip_heredoc)
      <JavaConfig guiclass="JavaConfigGui" testclass="JavaConfig" testname="#{testname}" enabled="true">
        <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
      Severity: Major
      Found in lib/ruby-jmeter/dsl/java_request_defaults.rb - About 2 hrs to fix

        Method parse_url has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_url(params)
              return if params[:url].empty?
              if params[:url] =~ /https?:\/\/\$/ || params[:url][0] == '$'
                params[:path] = params[:url] # special case for named expressions
              else
        Severity: Minor
        Found in lib/ruby-jmeter/helpers/parser.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

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

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

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

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

                  def initialize(params = {})
                    @doc = Nokogiri::XML(<<-XML.strip_heredoc)
                      <kg.apc.jmeter.perfmon.PerfMonCollector guiclass="kg.apc.jmeter.vizualizers.PerfMonGui" testclass="kg.apc.jmeter.perfmon.PerfMonCollector" testname="#{params[:name] || 'PerfmonCollector'}" enabled="true">
                        <boolProp name="ResultCollector.error_logging">false</boolProp>
                        <objProp>
            Severity: Minor
            Found in lib/ruby-jmeter/plugins/perfmon_collector.rb - About 1 hr to fix

              Method flood has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def flood(token, params = {})
                    RestClient.proxy = params[:proxy] if params[:proxy]
                    begin
                      file = Tempfile.new(['ruby-jmeter', '.jmx'])
                      file.write(doc.to_xml(indent: 2))
              Severity: Minor
              Found in lib/ruby-jmeter/extend/misc/flood.rb - About 1 hr to fix

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

                      def initialize(params={})
                        testname = params.kind_of?(Array) ? 'ResponseTimesPercentiles' : (params[:name] || 'ResponseTimesPercentiles')
                        @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
                          <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesPercentilesGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
                            <boolProp name="ResultCollector.error_logging">false</boolProp>
                Severity: Minor
                Found in lib/ruby-jmeter/plugins/response_times_percentiles.rb - About 1 hr to fix

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

                        def initialize(params={})
                          testname = params.kind_of?(Array) ? 'ResponseTimesOverTime' : (params[:name] || 'ResponseTimesOverTime')
                          @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
                            <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
                              <boolProp name="ResultCollector.error_logging">false</boolProp>
                  Severity: Minor
                  Found in lib/ruby-jmeter/plugins/response_times_over_time.rb - About 1 hr to fix

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

                          def initialize(params={})
                            testname = params.kind_of?(Array) ? 'ResponseTimesDistribution' : (params[:name] || 'ResponseTimesDistribution')
                            @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
                              <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseTimesDistributionGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
                                <boolProp name="ResultCollector.error_logging">false</boolProp>
                    Severity: Minor
                    Found in lib/ruby-jmeter/plugins/response_times_distribution.rb - About 1 hr to fix

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

                            def initialize(params={})
                              testname = params.kind_of?(Array) ? 'ResponseCodesPerSecond' : (params[:name] || 'ResponseCodesPerSecond')
                              @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
                                <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.ResponseCodesPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
                                  <boolProp name="ResultCollector.error_logging">false</boolProp>
                      Severity: Minor
                      Found in lib/ruby-jmeter/plugins/response_codes_per_second.rb - About 1 hr to fix

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

                              def initialize(params={})
                                testname = params.kind_of?(Array) ? 'LatenciesOverTime' : (params[:name] || 'LatenciesOverTime')
                                @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
                                  <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.LatenciesOverTimeGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
                                    <boolProp name="ResultCollector.error_logging">false</boolProp>
                        Severity: Minor
                        Found in lib/ruby-jmeter/plugins/latencies_over_time.rb - About 1 hr to fix

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

                                def initialize(params={})
                                  testname = params.kind_of?(Array) ? 'TransactionsPerSecond' : (params[:name] || 'TransactionsPerSecond')
                                  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
                                    <kg.apc.jmeter.vizualizers.CorrectedResultCollector guiclass="kg.apc.jmeter.vizualizers.TransactionsPerSecondGui" testclass="kg.apc.jmeter.vizualizers.CorrectedResultCollector" testname="#{testname}" enabled="#{enabled(params)}">
                                      <boolProp name="ResultCollector.error_logging">false</boolProp>
                          Severity: Minor
                          Found in lib/ruby-jmeter/plugins/transactions_per_second.rb - About 1 hr to fix

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

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

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

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

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

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

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

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

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

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