dtaniwaki/e2e-tester

View on GitHub

Showing 259 of 259 total issues

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

    def notify?(name, test = nil)
      name = "notify_#{name}"
      user_notification_settings.detect { |us| us.test == test }&.public_send(name) ||
        user_notification_settings.detect { |us| us.test.nil? }&.public_send(name) ||
        user_notification_settings.defaults[name]
Severity: Minor
Found in app/models/user_integration/base.rb and 1 other location - About 30 mins to fix
app/models/user.rb on lines 63..68

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 33.

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

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

  def notify?(name, test = nil)
    name = "notify_#{name}"
    global_notification_settings.detect { |us| us.test == test }&.public_send(name) ||
      global_notification_settings.detect { |us| us.test.nil? }&.public_send(name) ||
      global_notification_settings.defaults[name]
Severity: Minor
Found in app/models/user.rb and 1 other location - About 30 mins to fix
app/models/user_integration/base.rb on lines 29..34

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 33.

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

Avoid too many return statements within this method.
Open

    return false if title != other.title
Severity: Major
Found in app/models/test_step_set.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return false if description != other.description
    Severity: Major
    Found in app/models/test_step_set.rb - About 30 mins to fix

      Loofah 2.0.3 is vulnerable (CVE-2018-8048). Upgrade to 2.1.2
      Open

          loofah (2.0.3)
      Severity: Minor
      Found in Gemfile.lock by brakeman

      rails-html-sanitizer 1.0.3 is vulnerable (CVE-2018-3741). Upgrade to 1.0.4
      Open

          rails-html-sanitizer (1.0.3)
      Severity: Minor
      Found in Gemfile.lock by brakeman

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

          if @credential.save
            flash[:notice] = t('shared.update_success', target: UserCredential::Browserstack.model_name.human)
          else
            flash[:alert] = t('shared.update_failure', target: UserCredential::Browserstack.model_name.human, errors: @credential.errors.full_messages.join(', '))
      Severity: Minor
      Found in app/controllers/browserstack_credentials_controller.rb and 1 other location - About 25 mins to fix
      app/controllers/browserstack_credentials_controller.rb on lines 6..9

      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 31.

      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

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

          if @credential.save
            flash[:notice] = t('shared.create_success', target: UserCredential::Browserstack.model_name.human)
          else
            flash[:alert] = t('shared.update_failure', target: UserCredential::Browserstack.model_name.human, errors: @credential.errors.full_messages.join(', '))
      Severity: Minor
      Found in app/controllers/browserstack_credentials_controller.rb and 1 other location - About 25 mins to fix
      app/controllers/browserstack_credentials_controller.rb on lines 20..23

      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 31.

      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

      Method update_all! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.update_all!
            ids = []
            update_source.each do |params|
              browser = find_by(params)
              if browser.present?
      Severity: Minor
      Found in app/models/browser/base.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

      Method translate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def translate(key, options = {})
          options = options.dup
          options[:raise] = true
          if key.to_s !~ /^(devise|simple_form|activerecord|models|active_admin)/
            options[:scope] = ['views']
      Severity: Minor
      Found in app/helpers/i18n_helper.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

      Method translate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def translate(key, options = {})
          options = options.dup
          options[:raise] = true
          if key.to_s !~ /^(devise|simple_form|activerecord|models)/
            options[:scope] = ['controllers']
      Severity: Minor
      Found in app/controllers/concerns/i18n_concern.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

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

        def destroy
          @user_test_version = UserTestVersion.find(params[:id])
          authorize @user_test_version
      
          @user_test_version.destroy!
      Severity: Minor
      Found in app/controllers/user_test_versions_controller.rb and 2 other locations - About 15 mins to fix
      app/controllers/user_shared_test_step_sets_controller.rb on lines 27..35
      app/controllers/user_tests_controller.rb on lines 40..48

      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 26.

      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

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

          panel 'Browser Sets' do
            table_for browser.browser_sets do
              column :id do |browser_set|
                link_to browser_set.id, admin_browser_set_path(browser_set)
              end
      Severity: Minor
      Found in app/admin/browser.rb and 1 other location - About 15 mins to fix
      app/admin/test_version.rb on lines 54..60

      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 26.

      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

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

        def destroy
          @user_shared_test_step_set = UserSharedTestStepSet.find(params[:id])
          authorize @user_shared_test_step_set
      
          @user_shared_test_step_set.destroy!
      Severity: Minor
      Found in app/controllers/user_shared_test_step_sets_controller.rb and 2 other locations - About 15 mins to fix
      app/controllers/user_test_versions_controller.rb on lines 40..48
      app/controllers/user_tests_controller.rb on lines 40..48

      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 26.

      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

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

          panel 'Browsers' do
            table_for test_version.browsers do
              column :id do |b|
                link_to b.id, admin_browser_path(b)
              end
      Severity: Minor
      Found in app/admin/test_version.rb and 1 other location - About 15 mins to fix
      app/admin/browser.rb on lines 72..78

      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 26.

      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

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

        def destroy
          @user_test = UserTest.find(params[:id])
          authorize @user_test
      
          @user_test.destroy!
      Severity: Minor
      Found in app/controllers/user_tests_controller.rb and 2 other locations - About 15 mins to fix
      app/controllers/user_shared_test_step_sets_controller.rb on lines 27..35
      app/controllers/user_test_versions_controller.rb on lines 40..48

      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 26.

      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

      Specify a :dependent option.
      Open

        has_many :inherited_test_step_sets, class_name: 'TestStepSet', foreign_key: 'base_test_step_set_id', inverse_of: :base_test_step_set
      Severity: Minor
      Found in app/models/test_step_set.rb by rubocop

      This cop looks for has_many or has_one associations that don't specify a :dependent option. It doesn't register an offense if :through option was specified.

      Example:

      # bad
      class User < ActiveRecord::Base
        has_many :comments
        has_one :avatar
      end
      
      # good
      class User < ActiveRecord::Base
        has_many :comments, dependent: :restrict_with_exception
        has_one :avatar, dependent: :destroy
        has_many :patients, through: :appointments
      end

      Specify a :dependent option.
      Open

        has_many :test_execution_browsers, inverse_of: :test_execution
      Severity: Minor
      Found in app/models/test_execution.rb by rubocop

      This cop looks for has_many or has_one associations that don't specify a :dependent option. It doesn't register an offense if :through option was specified.

      Example:

      # bad
      class User < ActiveRecord::Base
        has_many :comments
        has_one :avatar
      end
      
      # good
      class User < ActiveRecord::Base
        has_many :comments, dependent: :restrict_with_exception
        has_one :avatar, dependent: :destroy
        has_many :patients, through: :appointments
      end

      Add an empty line after magic comments.
      Open

      require 'faraday'
      Severity: Minor
      Found in lib/browserstack/automate/client.rb by rubocop

      Checks for a newline after the final magic comment.

      Example:

      # good
      # frozen_string_literal: true
      
      # Some documentation for Person
      class Person
        # Some code
      end
      
      # bad
      # frozen_string_literal: true
      # Some documentation for Person
      class Person
        # Some code
      end

      Use %i or %I for an array of symbols.
      Open

      gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
      Severity: Minor
      Found in Gemfile by rubocop

      This cop can check for array literals made up of symbols that are not using the %i() syntax.

      Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

      Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

      Example: EnforcedStyle: percent (default)

      # good
      %i[foo bar baz]
      
      # bad
      [:foo, :bar, :baz]

      Example: EnforcedStyle: brackets

      # good
      [:foo, :bar, :baz]
      
      # bad
      %i[foo bar baz]
      Severity
      Category
      Status
      Source
      Language