hummingbird-me/kitsu-server

View on GitHub

Showing 98 of 164 total issues

Avoid too many return statements within this method.
Open

      return false if banned_from_group?
Severity: Major
Found in app/policies/post_like_policy.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return false if group.closed? && !member?
    Severity: Major
    Found in app/policies/comment_like_policy.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return false if group.closed? && !member?
      Severity: Major
      Found in app/policies/post_policy.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return true if group && has_group_permission?(:content)
        Severity: Major
        Found in app/policies/comment_policy.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return true if group && has_group_permission?(:content)
          Severity: Major
          Found in app/policies/post_policy.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return false if user.has_role?(:banned)
            Severity: Major
            Found in app/policies/comment_like_policy.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return false if group.restricted? && !has_group_permission?(:content)
              Severity: Major
              Found in app/policies/post_policy.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return false unless /[a-z]{2}(_[a-z]{2})?/.match?(title)
                Severity: Major
                Found in app/resources/library_entry_resource.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return false if banned_from_group?
                  Severity: Major
                  Found in app/policies/comment_policy.rb - About 30 mins to fix

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

                      def self.trace(key, data)
                        if key.start_with?('execute_query')
                          # Set the transaction name based on the operation type and name
                          selected_op = data[:query].selected_operation
                          if selected_op
                    Severity: Minor
                    Found in app/graphql/sentry_tracing.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 validate_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def validate_value(name, value, target)
                        return unless target
                        return if target === value # rubocop:disable Style/CaseEquality
                    
                        if target.respond_to?(:begin) && target.respond_to?(:end)
                    Severity: Minor
                    Found in app/validators/image_dimensions_validator.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 apply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def apply(relation, _order_options)
                        if offset?
                          paginator.apply(relation, _order_options)
                        else
                          # We apply the PagedPaginator logic ourselves because it uses offset/limit
                    Severity: Minor
                    Found in lib/universal_paginator.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 resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def resolve(**input)
                        AccountMutator.create(**input)
                      rescue ActiveRecord::RecordInvalid => e
                        validation_errors = Types::Errors::Validation.for_record(e.record, transform_path: ->(path) {
                          path = path.map { |p| p == 'password_digest' ? 'password' : p }
                    Severity: Minor
                    Found in app/graphql/mutations/account/create.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 should_query? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def should_query?(filters)
                          return false unless filters.respond_to?(:keys)
                          return false unless @_query_fields
                          filters.keys.any? { |key| @_query_fields.include?(key) }
                        end
                    Severity: Minor
                    Found in app/resources/concerns/algolia_searchable_resource.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 edit_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def edit_page
                            return @edit_page if @edit_page
                            raise ListSync::NotFoundError unless mal_id
                    
                            url = "https://myanimelist.net/ownlist/#{media_kind}/#{mal_id}/edit"
                    Severity: Minor
                    Found in app/services/list_sync/my_anime_list/mechanized_edit_page.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 behind_feature_flag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def behind_feature_flag(flag)
                          if method_defined?(:visible?)
                            define_method(:visible?) do |context|
                              super(context) && Flipper[flag].enabled?(context[:user])
                            end
                    Severity: Minor
                    Found in app/graphql/concerns/behind_feature_flag.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 should_query? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def should_query?(filters)
                          return false unless filters.respond_to?(:keys)
                          return false unless @_query_fields
                          filters.keys.any? { |key| @_query_fields.include?(key) }
                        end
                    Severity: Minor
                    Found in app/resources/concerns/searchable_resource.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 download_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def download_xml
                        head 404 unless User.current.present?
                        head 404 unless Flipper[:xml_download].enabled?(User.current)
                        head 400 unless params[:kind].in?(%w[anime manga])
                    
                    
                    Severity: Minor
                    Found in app/controllers/library_entries_controller.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