diaspora/diaspora

View on GitHub

Showing 123 of 4,486 total issues

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

  def local_or_remote_person_path(person, opts={})
    opts.merge!(:protocol => AppConfig.pod_uri.scheme, :host => AppConfig.pod_uri.authority)
    absolute = opts.delete(:absolute)

    if person.local?
Severity: Minor
Found in app/helpers/people_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 copy_hidden_share_visibilities_to_users has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def self.copy_hidden_share_visibilities_to_users(only_recent = false)
    query = ShareVisibility.where(:hidden => true).includes(:contact => :user)
    query = query.where('share_visibilities.updated_at > ?', RECENT.weeks.ago) if only_recent
    count = query.count
    puts "Updating #{count} records in batches of 1000..."
Severity: Minor
Found in lib/share_visibility_converter.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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    # upload and set new profile photo
    @profile_attrs = profile_params

    munge_tag_string
Severity: Minor
Found in app/controllers/profiles_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 show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    partial_dir = Rails.root.join("app", "views", "home")
    if user_signed_in?
      redirect_to stream_path
    elsif request.format == :mobile
Severity: Minor
Found in app/controllers/home_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

Function isRTL has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    isRTL: function(str) {
      if(typeof str !== "string" || str.length < 1) {
                return false;
      }

Severity: Minor
Found in app/assets/javascripts/app/helpers/direction_detector.js - About 1 hr to fix

    Function DirectionDetector has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var DirectionDetector = function() {
        var self = this;
        this.binds = [];
        this.cleaner = new RegExp("@[^ ]+|^RT[: ]{1}| RT | RT: |[♺♻:]+", "g");
    
    
    Severity: Minor
    Found in app/assets/javascripts/widgets/direction-detector.js - About 1 hr to fix

      Function bottomBarLazy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          bottomBarLazy: function(bottomBar) {
            return  {
              loader: function(){
                return bottomBar.find(".ajax-loader");
              },
      Severity: Minor
      Found in app/assets/javascripts/mobile/mobile_comments.js - About 1 hr to fix

        Function onReshare has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            onReshare: function(evt) {
              evt.preventDefault();
        
              var link = $(this).closest(".reshare-action"),
                  href = link.attr("href"),
        Severity: Minor
        Found in app/assets/javascripts/mobile/mobile_post_actions.js - About 1 hr to fix

          Function onInputBoxKeyDown has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            onInputBoxKeyDown: function(e) {
              // This also matches HOME/END on OSX which is CMD+LEFT, CMD+RIGHT
              if(e.which === Keycodes.LEFT || e.which === Keycodes.RIGHT ||
                 e.which === Keycodes.HOME || e.which === Keycodes.END) {
                _.defer(_.bind(this.updateTypeaheadInput, this));
          Severity: Minor
          Found in app/assets/javascripts/app/views/publisher/mention_view.js - About 1 hr to fix

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

              def next_stream_path
                if current_page?(:stream)
                  stream_path(max_time: time_for_scroll(@stream))
                elsif current_page?(:activity_stream)
                  activity_stream_path(max_time: time_for_scroll(@stream))
            Severity: Minor
            Found in app/helpers/stream_helper.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 translate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def translate(locale, key, options = {})
                    default = extract_non_symbol_default!(options) if options[:default]
                    options.merge!(:default => default) if default
            
                    original_exception = nil
            Severity: Minor
            Found in lib/i18n_interpolation_fallbacks.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

            Function clearForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            $.fn.clearForm = function() {
              return this.each(function() {
                if ($(this).is('form')) {
                  return $(':input', this).clearForm();
                }
            Severity: Minor
            Found in lib/assets/javascripts/clear-form.js - 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 o_embed_html has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def o_embed_html(cache)
                data = cache.data
                data = {} if data.blank?
                title = data.fetch('title', cache.url)
                html = link_to(title, cache.url, :target => '_blank') 
            Severity: Minor
            Found in app/helpers/o_embed_helper.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 perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def perform
                  return User.none unless valid?
            
                  users = User.arel_table
                  people = Person.arel_table
            Severity: Minor
            Found in app/controllers/admins_controller.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 index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def index
                @aspect = :search
                limit = params[:limit] ? params[:limit].to_i : 15
            
                @people = Person.search(search_query, current_user)
            Severity: Minor
            Found in app/controllers/people_controller.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 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

            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

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

              collectionOptions :function(){
                var order = this.sortOrder();
                return {
                  comparator: function(item1, item2) {
                    if (item1[order]() < item2[order]()) { return 1; }
            Severity: Minor
            Found in app/assets/javascripts/app/models/stream.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 change_email has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def change_email(user_data)
                if AppConfig.mail.enable?
                  @user.unconfirmed_email = user_data[:email]
                  if @user.save
                    @user.send_confirm_email
            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

            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

            Severity
            Category
            Status
            Source
            Language