diaspora/diaspora

View on GitHub

Showing 123 of 4,489 total issues

File posix-bracket-expressions.js has 883 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later

var PosixBracketExpressions = {
  // source: https://github.com/ruby/ruby/blob/ruby_2_4/enc/unicode/9.0.0/name2ctype.h#L3544
  word: "\\u0030-\\u0039" +
Severity: Major
Found in lib/assets/javascripts/posix-bracket-expressions.js - About 2 days to fix

    Class User has 63 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class User < ApplicationRecord
      include AuthenticationToken
      include Connecting
      include Querying
      include SocialActions
    Severity: Major
    Found in app/models/user.rb - About 1 day to fix

      File user.rb has 451 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class User < ApplicationRecord
        include AuthenticationToken
        include Connecting
        include Querying
        include SocialActions
      Severity: Minor
      Found in app/models/user.rb - About 6 hrs to fix

        File publisher_view.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
        
        /*   Copyright (c) 2010-2012, Diaspora Inc.  This file is
         *   licensed under the Affero General Public License version 3 or later.  See
         *   the COPYRIGHT file.
        Severity: Minor
        Found in app/assets/javascripts/app/views/publisher_view.js - About 5 hrs to fix

          Class Person has 32 methods (exceeds 20 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 4 hrs to fix

            Class AccountMigration has 32 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class AccountMigration < ApplicationRecord
              include Diaspora::Federated::Base
            
              belongs_to :old_person, class_name: "Person"
              belongs_to :new_person, class_name: "Person"
            Severity: Minor
            Found in app/models/account_migration.rb - About 4 hrs to fix

              Function textFormatter has 88 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                app.helpers.textFormatter = function(text, mentions) {
                  mentions = mentions ? mentions : [];
              
                  var md = window.markdownit({
                    breaks:      true,
              Severity: Major
              Found in app/assets/javascripts/app/helpers/text_formatter.js - About 3 hrs to fix

                File receive.rb has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Diaspora
                  module Federation
                    module Receive
                      extend Diaspora::Logging
                
                
                Severity: Minor
                Found in lib/diaspora/federation/receive.rb - About 3 hrs to fix

                  Class AuthorizationsController has 28 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class AuthorizationsController < ApplicationController
                        rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e|
                          logger.info e.backtrace[0, 10].join("\n")
                          error, _description = e.message.split(" :: ")
                          handle_params_error(error, "The request was malformed: please double check the client id and redirect uri.")
                  Severity: Minor
                  Found in app/controllers/api/openid_connect/authorizations_controller.rb - About 3 hrs to fix

                    Class PostPresenter has 28 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class PostPresenter < BasePresenter
                      include PostsHelper
                      include MetaDataHelper
                    
                      attr_accessor :post
                    Severity: Minor
                    Found in app/presenters/post_presenter.rb - About 3 hrs to fix

                      Function createUploader has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function createUploader(){
                         var aspectIds = gon.preloads.aspect_ids;
                      
                        new qq.FineUploaderBasic({
                          element: document.getElementById("file-upload-publisher"),
                      Severity: Major
                      Found in app/assets/javascripts/mobile/mobile_file_uploader.js - About 3 hrs to fix

                        Function bookmarklet has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                        var bookmarklet = function(url, width, height, opts) {
                          var maxLen = 1900; // max GET request length, see #3076
                          var maxTitleLen = 128; // cut title after this length, if too long
                        
                          // calculate popup dimensions & placement
                        Severity: Minor
                        Found in app/assets/javascripts/bookmarklet.js - About 2 hrs 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

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

                        app.views.Publisher = Backbone.View.extend({
                        
                          el : "#publisher",
                        
                          events : {
                        Severity: Minor
                        Found in app/assets/javascripts/app/views/publisher_view.js - About 2 hrs to fix

                          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

                            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

                              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

                                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

                                    Function initSubviews has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      initSubviews: function() {
                                        this.mention = new app.views.PublisherMention({ el: this.$("#publisher-textarea-wrapper") });
                                        if(this.prefillMention) {
                                          this.mention.prefillMention([this.prefillMention]);
                                        }
                                    Severity: Major
                                    Found in app/assets/javascripts/app/views/publisher_view.js - About 2 hrs to fix

                                      Class PersonPresenter has 21 methods (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      class PersonPresenter < BasePresenter
                                        def base_hash
                                          {
                                            id:          id,
                                            guid:        guid,
                                      Severity: Minor
                                      Found in app/presenters/person_presenter.rb - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language