diaspora/diaspora

View on GitHub

Showing 123 of 4,443 total issues

Method destroy_reported_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy_reported_item
    case item
    when Post
      if item.author.local?
        item.author.owner.retract(item)
Severity: Minor
Found in app/models/report.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 public has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def public
    if @user = User.find_by_username(params[:username])
      respond_to do |format|
        format.atom do
          @posts = Post.where(author_id: @user.person_id, public: true)
Severity: Minor
Found in app/controllers/users_controller.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 perform! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def perform!
    raise "already performed" if performed?
    validate_sender if locally_initiated?

    ActiveRecord::Base.transaction do
Severity: Minor
Found in app/models/account_migration.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

Function setupBloodhound has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  setupBloodhound: function(options) {
    var bloodhoundOptions = {
      datumTokenizer: function(datum) {
        // hashtags
        if(typeof datum.handle === "undefined") { return [datum.name]; }
Severity: Minor
Found in app/assets/javascripts/app/views/search_base_view.js - 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

Function comparator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  comparator : function(con1, con2) {
    if( !con1.person || !con2.person ) return 1;

    if(app.aspect) {
      var inAspect1 = con1.inAspect(app.aspect.get('id'));
Severity: Minor
Found in app/assets/javascripts/app/collections/contacts.js - 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 url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def url(name = nil)
    if remote_photo_path
      name = name.to_s + '_' if name
      image_url = remote_photo_path + name.to_s + remote_photo_name
      if AppConfig.privacy.camo.proxy_remote_pod_images?
Severity: Minor
Found in app/models/photo.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 local_recipients has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def local_recipients
    recipients.each do |recipient|
      if recipient.local?
        unless recipient.owner.contacts.where(person_id: author.id).any? ||
            (author.owner && author.owner.podmin_account?)
Severity: Minor
Found in app/models/conversation.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(user, klass, key, id, conditions={})
Severity: Minor
Found in lib/evil_query.rb - About 35 mins to fix

    Method perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def perform(sender_id, obj_str, urls, xml, retry_count=0)
    Severity: Minor
    Found in app/workers/send_public.rb - About 35 mins to fix

      Method perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def perform(user_id, retraction_class, retraction_data, recipient_ids, opts)
      Severity: Minor
      Found in app/workers/deferred_retraction.rb - About 35 mins to fix

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

            def share_with(person, aspect)
              return if blocks.where(person_id: person.id).exists?
        
              contact = contacts.find_or_initialize_by(person_id: person.id)
              return false unless contact.valid?
        Severity: Minor
        Found in app/models/user/connecting.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_user_preferences has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_user_preferences(pref_hash)
            if self.disable_mail
              UserPreference::VALID_EMAIL_TYPES.each{|x| self.user_preferences.find_or_create_by(email_type: x)}
              self.disable_mail = false
              self.save
        Severity: Minor
        Found in app/models/user.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def initialize(url, result=Result.new)
            @url ||= url
            @result ||= result
            @uri ||= URI.parse(@url)
            raise AddressFailure,
        Severity: Minor
        Found in lib/connection_tester.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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def destroy
            @vis = ConversationVisibility.where(:person_id => current_user.person.id,
                                                :conversation_id => params[:conversation_id]).first
            if @vis
              participants = @vis.conversation.participants.count
        Severity: Minor
        Found in app/controllers/conversation_visibilities_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

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

          def update_user(user_data)
            if user_data[:email_preferences]
              change_email_preferences(user_data)
            elsif user_data[:language]
              change_language(user_data)
        Severity: Minor
        Found in app/controllers/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

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

          def index
            conditions = {:recipient_id => current_user.id}
            if params[:type] && types.has_key?(params[:type])
              conditions[:type] = types[params[:type]]
            end
        Severity: Minor
        Found in app/controllers/notifications_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

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

          def create
            @aspect = current_user.aspects.build(aspect_params)
            aspecting_person_id = params[:person_id]
        
            if @aspect.save
        Severity: Minor
        Found in app/controllers/aspects_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

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

          def destroy
            if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
              current_user.close_account!
              sign_out current_user
              redirect_to(new_user_session_path(format: request[:format]), notice: I18n.t("users.destroy.success"))
        Severity: Minor
        Found in app/controllers/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

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

            def secret_token
              if heroku?
                return ENV["SECRET_TOKEN"] if ENV["SECRET_TOKEN"]
        
                warn "FATAL: Running on Heroku with SECRET_TOKEN unset"
        Severity: Minor
        Found in lib/configuration_methods.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 fetch_and_save_opengraph_data! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def fetch_and_save_opengraph_data!
            object = OpenGraphReader.fetch!(self.url)
        
            return unless object
        
        
        Severity: Minor
        Found in app/models/open_graph_cache.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