rokumatsumoto/boyutluseyler

View on GitHub

Showing 6 of 439 total issues

Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
Severity: Major
Found in babel.config.js - About 2 hrs to fix

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

      def active_nav_link?(options)
        if path = options.delete(:path)
          path = [path] unless path.respond_to?(:each)
    
          path.any? do |single_path|
    Severity: Minor
    Found in app/helpers/tab_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 is_owner? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def is_owner? # rubocop:disable Style/PredicateName
        return false unless user && record.respond_to?(:user)
        return false unless record.user_id == user.id
        return false if record.user_id_was && record.user_id_was != user.id
    
    
    Severity: Minor
    Found in app/policies/application_policy.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 omniauth_flow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def omniauth_flow(auth_module, identity_linker: nil)
        if current_user
          authorize :identity_provider, :link?
    
          identity_linker ||= auth_module::IdentityLinker.new(current_user, oauth)
    Severity: Minor
    Found in app/controllers/omniauth_callbacks_controller.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

    Avoid too many return statements within this function.
    Open

          return this.setUnavailableState();
    Severity: Major
    Found in app/javascript/pages/shared/username_validator.js - About 30 mins to fix

      Function usernameBlur has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        usernameBlur() {
          const username = this.inputElement.value;
          // look parent node (div) for valid state
          // for presence, length and format validations we use client_side_validations gem
          this.state.valid = !this.inputElement.parentNode.classList.contains(INVALID_FORM_GROUP_CLASS);
      Severity: Minor
      Found in app/javascript/pages/shared/username_validator.js - 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