diaspora/diaspora

View on GitHub

Showing 4,486 of 4,486 total issues

Router has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

app.Router = Backbone.Router.extend({
  routes: {
    "activity(/)": "stream",
    "admin/pods(/)": "adminPods",
    "admins/dashboard(/)": "adminDashboard",
Severity: Minor
Found in app/assets/javascripts/app/router.js - About 2 hrs to fix

    Assignment Branch Condition size for show is too high. [30.38/20]
    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 by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for stats is too high. [30.61/20]
    Open

      def stats
        @popular_tags = ActsAsTaggableOn::Tagging.joins(:tag).limit(50).order('count(taggings.id) DESC').group(:tag).count
    
        case params[:range]
        when "week"

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    File person.rb has 282 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Person < ApplicationRecord
      include Diaspora::Fields::Guid
    
      # NOTE API V1 to be extracted
      acts_as_api
    Severity: Minor
    Found in app/models/person.rb - About 2 hrs to fix

      Method has too many lines. [29/20]
      Open

        def legacy_create
          photo_params = params.require(:photo).permit(:pending, :set_profile_photo, aspect_ids: [])
          if photo_params[:aspect_ids] == "all"
            photo_params[:aspect_ids] = current_user.aspects.map(&:id)
          elsif photo_params[:aspect_ids].is_a?(Hash)

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Assignment Branch Condition size for update is too high. [29.98/20]
      Open

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

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Function initialize has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        initialize: function() {
          new qq.FineUploaderBasic({
            element: document.getElementById("file-upload"),
            validation: {
              allowedExtensions: ["jpg", "jpeg", "png"],
      Severity: Major
      Found in app/assets/javascripts/helpers/profile_photo_uploader.js - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          toggled: function(e) {
            var el = $(e.target);
            var parent = el.parents('.question');
        
            parent.children('.answer').toggle();
        Severity: Major
        Found in app/assets/javascripts/app/views/faq_question_view.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/app/views/help_section_view.js on lines 28..36

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 88.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          toggled: function(e) {
            var el = $(e.target);
            var parent = el.parents('.question');
        
            parent.children('.answer.hideable').toggle();
        Severity: Major
        Found in app/assets/javascripts/app/views/help_section_view.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/app/views/faq_question_view.js on lines 30..38

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 88.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Assignment Branch Condition size for send_welcome_message is too high. [28.44/20]
        Open

          def send_welcome_message
            return unless AppConfig.settings.welcome_message.enabled? && AppConfig.admins.account?
            sender_username = AppConfig.admins.account.get
            sender = User.find_by(username: sender_username)
            return if sender.nil?
        Severity: Minor
        Found in app/models/user.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Assignment Branch Condition size for next_stream_path is too high. [28.16/20]
        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 by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Assignment Branch Condition size for create is too high. [28.23/20]
        Open

          def create
            @user = User.build(user_params)
        
            if @user.sign_up
              flash[:notice] = t("registrations.create.success")

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [28/20]
        Open

          def index
            conditions = {:recipient_id => current_user.id}
            if params[:type] && types.has_key?(params[:type])
              conditions[:type] = types[params[:type]]
            end

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Class UsersController has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class UsersController < ApplicationController
          before_action :authenticate_user!, except: %i(new create public)
          respond_to :html
        
          def edit
        Severity: Minor
        Found in app/controllers/users_controller.rb - About 2 hrs to fix

          Class ApplicationController has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApplicationController < ActionController::Base
            before_action :force_tablet_html
            has_mobile_fu
            protect_from_forgery except: :receive, with: :exception, prepend: true
          
          
          Severity: Minor
          Found in app/controllers/application_controller.rb - About 2 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                if( this.dropdown.find("li.selected").length === 0 ) {
                  var msg = Diaspora.I18n.t("aspect_dropdown.started_sharing_with", { "name": this._name() });
                  startSharing = true;
                  app.flashMessages.success(msg);
                }
            Severity: Major
            Found in app/assets/javascripts/app/views/aspect_membership_view.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/app/views/aspect_membership_view.js on lines 148..152

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 85.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                if (this.$el.find("li.selected").length === 0) {
                  var msg = Diaspora.I18n.t("aspect_dropdown.stopped_sharing_with", { "name": this._name() });
                  stopSharing = true;
                  app.flashMessages.success(msg);
                }
            Severity: Major
            Found in app/assets/javascripts/app/views/aspect_membership_view.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/app/views/aspect_membership_view.js on lines 110..114

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 85.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Assignment Branch Condition size for post is too high. [27.59/20]
            Open

              def post(post, url='')
                body = build_tumblr_post(post, url)
                user_info = JSON.parse(client.get("/v2/user/info").body)
                blogs = user_info["response"]["user"]["blogs"]
                primaryblog = blogs.find {|blog| blog["primary"] } || blogs[0]
            Severity: Minor
            Found in app/models/services/tumblr.rb by rubocop

            This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

            Assignment Branch Condition size for destroy is too high. [27.15/20]
            Open

              def destroy
                photo = current_user.photos.where(:id => params[:id]).first
            
                if photo
                  current_user.retract(photo)

            This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

            Assignment Branch Condition size for fetch_and_save_opengraph_data! is too high. [26.27/20]
            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 by rubocop

            This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

            Severity
            Category
            Status
            Source
            Language