convio/watirmark

View on GitHub

Showing 25 of 25 total issues

Class Controller has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Controller
      attr_reader :model, :supermodel
      include Watirmark::Assertions
      include Watirmark::Dialogs
      include Watirmark::Actions
Severity: Minor
Found in lib/watirmark/controller/controller.rb - About 3 hrs to fix

    Class Factory has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Factory
          extend FactoryMethods
    
          include CucumberHelper
          include DebugMethods
    Severity: Minor
    Found in lib/watirmark/models/factory.rb - About 2 hrs to fix

      Method default_firefox_profile has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def default_firefox_profile
            file_types = "text/comma-separated-values,text/csv,application/pdf, application/x-msdos-program, application/x-unknown-application-octet-stream,
                    application/vnd.ms-powerpoint, application/excel, application/vnd.ms-publisher, application/x-unknown-message-rfc822, application/vnd.ms-excel,
                    application/msword, application/x-mspublisher, application/x-tar, application/zip, application/x-gzip, application/x-stuffit,
                    application/vnd.ms-works, application/powerpoint, application/rtf, application/postscript, application/x-gtar,
      Severity: Minor
      Found in lib/watirmark/session.rb - About 1 hr to fix

        Method sauce_config has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def sauce_config(sb)
              caps              = Selenium::WebDriver::Remote::Capabilities.send(sb.to_sym)
              caps.browser_name = sb
              case sb
                when "firefox"
        Severity: Minor
        Found in lib/watirmark/session.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 locate_model has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def locate_model(supermodel)
                case supermodel
                  when Hash
                    if self.class.model
                      self.class.model.new supermodel
        Severity: Minor
        Found in lib/watirmark/controller/controller.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 read_from_environment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def read_from_environment
              @settings.each_key do |var|
                next if var.to_s.upcase == "USERNAME"
                next if var.to_s.upcase == "HOSTNAME" && self.hostname
                env = ENV[var.to_s.upcase]
        Severity: Minor
        Found in lib/watirmark/configuration.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 default_firefox_profile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def default_firefox_profile
              file_types = "text/comma-separated-values,text/csv,application/pdf, application/x-msdos-program, application/x-unknown-application-octet-stream,
                      application/vnd.ms-powerpoint, application/excel, application/vnd.ms-publisher, application/x-unknown-message-rfc822, application/vnd.ms-excel,
                      application/msword, application/x-mspublisher, application/x-tar, application/zip, application/x-gzip, application/x-stuffit,
                      application/vnd.ms-works, application/powerpoint, application/rtf, application/postscript, application/x-gtar,
        Severity: Minor
        Found in lib/watirmark/session.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 insert_model has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def insert_model(text)
                # cucumber 2.0 defines a Core module between Cucumber and Ast
                doc_class = Cucumber::Ast.const_defined?(:DocString) ? Cucumber::Ast::DocString : Cucumber::Core::Ast::DocString
                return text unless text.is_a?(String) || text.is_a?(doc_class)
                result = text
        Severity: Minor
        Found in lib/watirmark/models/cucumber_helper.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 lookup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def lookup(x)
              return nil if x.nil?
              @maps.each do |map|
                if Array === map.list
                  map.list.each do |items|
        Severity: Minor
        Found in lib/watirmark/page/radio_maps.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 defaults has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def defaults
              {
                :configfile         => nil,
                :hostname           => nil,
                :email              => 'devnull',
        Severity: Minor
        Found in lib/watirmark/configuration.rb - About 1 hr to fix

          Method to_h has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def to_h
                  h = {}
                  @keywords.each do |key|
                    begin
                      name = key
          Severity: Minor
          Found in lib/watirmark/models/factory.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 column has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def column(what)
                column = 0
                parent.th(:text => what).when_present.parent.cells.each do |cell|
                  if what.kind_of? String
                    return self[column] if cell.text == what
          Severity: Minor
          Found in lib/watirmark/extensions/webdriver_extensions.rb - About 55 mins 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 set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def set val
                return if val.nil?
                element = get
                val = @map.lookup(val) if @map
                case val
          Severity: Minor
          Found in lib/watirmark/page/keyed_element.rb - About 55 mins 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 link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def link(how, matcher)
                links.each do |link|
                  case how
                    when :text
                      return link if /#{matcher}/.matches link.text
          Severity: Minor
          Found in lib/watirmark/cucumber/email_helper.rb - About 45 mins 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 actual_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def actual_value element, expected=nil
                case element
                  when Watir::Select
                    element.selected_options.first.text
                  when Watir::CheckBox
          Severity: Minor
          Found in lib/watirmark/controller/assertions.rb - About 45 mins 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize
                Watirmark.add_exit_task {
                  closebrowser if config.closebrowseronexit || config.headless
                  @driver.quit if config.webdriver.to_s.eql? 'sauce'
                }
          Severity: Minor
          Found in lib/watirmark/session.rb - About 45 mins 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 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initialize(name='', parent=nil, active_page=nil, navigate_page=nil, submit_page=nil)
          Severity: Minor
          Found in lib/watirmark/page/process_page.rb - About 35 mins to fix

            Method verify_failure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def verify_failure(tries_count=6, seconds_between_tries=30)
                counter = 0
                loop do
                  counter += 1
                  begin
            Severity: Minor
            Found in lib/watirmark/cucumber/cuke_helper.rb - About 35 mins 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 format_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def format_value(value)
                    value = insert_model(value)
                    case value
                      when String
                        if value[0, 1].eql?("=") #straight eval
            Severity: Minor
            Found in lib/watirmark/models/cucumber_helper.rb - About 35 mins 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 inspect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def inspect
                    model_friendly_name = @model_name ? "#@model_name: " : nil
                    model_details = " #{to_h}" unless to_h.empty?
                    included_models = "\n   #{@children.map(&:inspect).join("\n   ")}" unless @children.empty?
                    "#{model_friendly_name}#{model_class_name}#{model_details}#{included_models}"
            Severity: Minor
            Found in lib/watirmark/models/factory.rb - About 25 mins 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

            Severity
            Category
            Status
            Source
            Language