diaspora/diaspora

View on GitHub

Showing 124 issues of 4,306 total

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 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 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

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

  def image_url(size=:thumb_large)
    result = if size == :thumb_medium && self[:image_url_medium]
               self[:image_url_medium]
             elsif size == :thumb_small && self[:image_url_small]
               self[:image_url_small]
Severity: Minor
Found in app/models/profile.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 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 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 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 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 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

            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 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 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

            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 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 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

            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

            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

            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 _render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              _render: function(locale, items, views) {
                var originalItems = items.slice();
            
                if(views && typeof views.count !== "undefined") {
                  items.push(locale.pluralizationKey(views.count));
            Severity: Minor
            Found in app/assets/javascripts/helpers/i18n.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 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

            Severity
            Category
            Status