gitshowcase/gitshowcase

View on GitHub

Showing 12 of 883 total issues

Class SnapshotService has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

class SnapshotService < ApplicationService
  # Constraints
  TYPE_TOTAL = :total
  TYPE_DAILY = :daily

Severity: Minor
Found in app/services/snapshot_service.rb - About 4 hrs to fix

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

      def github
        auth = request.env['omniauth.auth']
    
        @user = User.where(github_uid: auth.uid).first_or_initialize
        github_user_service = GithubUserService.new(@user)
    Severity: Minor
    Found in app/controllers/users/omniauth_callbacks_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 index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def index
        @levels = levels = User::CompletenessService::LEVELS.keys
        @search_fields = SEARCH_FIELDS
    
        query = User.order('id DESC')
    Severity: Minor
    Found in app/controllers/admin/users_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 sync has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def sync
        raise "Project ##{@project.id} - #{@project.title} does not have a homepage to sync" unless @project.homepage.present?
    
        params = {connection_timeout: 5, read_timeout: 3, retries: 0, download_images: false}
        page = MetaInspector.new(@project.homepage, params) rescue nil
    Severity: Minor
    Found in app/services/project_inspector_service.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 change has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def change
        create_table :snapshots do |t|
          t.date :date, null: false
    
          # Total values
    Severity: Minor
    Found in db/migrate/20170502201750_create_snapshots.rb - About 1 hr to fix

      Method github has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def github
          auth = request.env['omniauth.auth']
      
          @user = User.where(github_uid: auth.uid).first_or_initialize
          github_user_service = GithubUserService.new(@user)
      Severity: Minor
      Found in app/controllers/users/omniauth_callbacks_controller.rb - About 1 hr to fix

        Method index has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def index
            @levels = levels = User::CompletenessService::LEVELS.keys
            @search_fields = SEARCH_FIELDS
        
            query = User.order('id DESC')
        Severity: Minor
        Found in app/controllers/admin/users_controller.rb - About 1 hr to fix

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

            def set(skills)
              keys = skills.keys
              skills = convert_from_arrays(skills) if keys.size == 2 && keys.include?(:name) && keys.include?(:mastery)
          
              parsed = {}
          Severity: Minor
          Found in app/services/user/skills_service.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 change has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def change
              add_column :users, :name, :string
              add_column :users, :username, :string
              add_column :users, :avatar, :string
              add_column :users, :cover, :string
          Severity: Minor
          Found in db/migrate/20170111021222_add_info_to_user.rb - About 1 hr to fix

            Method set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def set(field, value)
                field = field.to_sym
            
                field = :socials if User::SOCIALS.key?(field)
                return unless FIELDS.key? field
            Severity: Minor
            Found in app/services/user/completeness_service.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 website_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.website_url(website, path, protocol = 'http')
                return nil unless path.present?
                return path if is_url(path)
                return url(path, protocol) if !website.present? || path.include?(extract(website))
            
            
            Severity: Minor
            Found in app/helpers/url_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 update_domain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def update_domain
                old_domain = @user.domain
                new_domain = user_params(:domain)[:domain]
            
                if old_domain != new_domain
            Severity: Minor
            Found in app/controllers/dashboard/users_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

            Severity
            Category
            Status
            Source
            Language