manshar/manshar

View on GitHub

Showing 32 of 82 total issues

File app.js has 578 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

// TODO(mkhatib): Seperate these into config/routes.js and
// config/interceptors/httpInterceptors.js and add tests for them.
// TODO(mkhatib): Move the autogenerated appConfig.js to config/constants.js.
Severity: Major
Found in web-client/app/scripts/app.js - About 1 day to fix

    Function link has 113 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          link: function (scope, element, attrs, ngModel) {
            ngModel.$render = function() {
              if (ngModel.$viewValue) {
                editor.loadJSON(JSON.parse(ngModel.$viewValue));
                editor.render();
    Severity: Major
    Found in web-client/app/scripts/directives/carbonEditor.js - About 4 hrs to fix

      File config.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var src               = 'app';
      var development       = 'build/development';
      var production        = 'build/production';
      var dist              = 'dist';
      
      
      Severity: Minor
      Found in web-client/gulp/config.js - About 4 hrs to fix

        Function link has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              link: function (scope, element) {
                var mainCommentBox = element.find('div')[0];
                var textarea = element.find('textarea')[0];
        
                $rootScope.$watch('user', function() {
        Severity: Major
        Found in web-client/app/scripts/directives/anchoredComments.js - About 3 hrs to fix

          Function link has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                link: function(scope, element) {
                  var page = 1;
                  scope.hasNext = true;
                  scope.inProgress = false;
          
          
          Severity: Major
          Found in web-client/app/scripts/directives/loadMoreData.js - About 3 hrs to fix

            Function link has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  link: function(scope, element) {
                    $rootScope.pushAside = false;
                    scope.menuStatus = 'closed';
                    scope.logout = function () {
                      $analytics.eventTrack('Logout', {
            Severity: Major
            Found in web-client/app/scripts/directives/sideMenu.js - About 3 hrs to fix

              Method perform has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def perform(start_index=1)
              
                  if @@client.nil? or @@analytics.nil?
                    puts 'Not calculating total articles stats due to client authorization or service discovery issue.'
                    return
              Severity: Major
              Found in backend/app/workers/article_total_stats_worker.rb - About 2 hrs to fix

                TimingFunctions has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                Animation.TimingFunctions = {
                  linearTween: function(t){
                    return t;
                  },
                  easeInQuad: function(t){
                Severity: Minor
                Found in web-client/app/scripts/helpers/animation.js - About 2 hrs to fix

                  Method perform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def perform(start_index=1)
                  
                      if @@client.nil? or @@analytics.nil?
                        puts 'Not calculating total articles stats due to client authorization or service discovery issue.'
                        return
                  Severity: Minor
                  Found in backend/app/workers/article_total_stats_worker.rb - 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

                  Function link has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        link: function (scope, element) {
                          scope.selectedCategory = null;
                          scope.categories = Category.query();
                          scope.topics = [];
                          // scope.allowCreateTopics = false;
                  Severity: Major
                  Found in web-client/app/scripts/directives/categoryTopicPicker.js - About 2 hrs to fix

                    Function link has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          link: function (scope, element) {
                            scope.commentsCount = 0;
                            scope.commentsCountToShow = 4;
                    
                            // Shows the anchor icon for the user to click.
                    Severity: Major
                    Found in web-client/app/scripts/directives/anchoredComment.js - About 2 hrs to fix

                      Function loadMoreData has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              scope.loadMoreData = function() {
                                scope.inProgress = true;
                      
                                if(scope.state === 'publishers') {
                                  User.query({
                      Severity: Minor
                      Found in web-client/app/scripts/directives/loadMoreData.js - About 2 hrs to fix

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

                          def index
                        
                            # Retreive users around a specific user id.
                            # TODO(mkhatib): This is really ugly and hacky.
                            # Move this to the user model and come up with a better way to paginate.
                        Severity: Minor
                        Found in backend/app/controllers/api/v1/users_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 create has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def create
                            unless resource_params[:email]
                              return render json: {
                                success: false,
                                errors: ['You must provide an email address.']
                        Severity: Minor
                        Found in backend/app/controllers/api/v1/confirmations_controller.rb - About 1 hr to fix

                          Method create has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def create
                              # Check
                              field = (resource_params.keys.map(&:to_sym) & resource_class.authentication_keys).first
                          
                              @resource = nil
                          Severity: Minor
                          Found in backend/app/controllers/api/v1/sessions_controller.rb - About 1 hr to fix

                            Method index has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def index
                            
                                # Retreive users around a specific user id.
                                # TODO(mkhatib): This is really ugly and hacky.
                                # Move this to the user model and come up with a better way to paginate.
                            Severity: Minor
                            Found in backend/app/controllers/api/v1/users_controller.rb - About 1 hr to fix

                              Function exports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              module.exports = function(config) {
                                config.set({
                                  // base path, that will be used to resolve files and exclude
                                  basePath: '',
                              
                              
                              Severity: Minor
                              Found in web-client/karma.conf.js - About 1 hr to fix

                                Function save has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        save: function (data, optSuccess, optError, optProgress) {
                                
                                          var delayedObj = {};
                                
                                          // TODO(mkhatib): Until we figure out a way to rename files either
                                Severity: Minor
                                Found in web-client/app/scripts/services/imageService.js - About 1 hr to fix

                                  Method up has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def self.up    
                                    #Tables
                                        #Conversations
                                      create_table :mailboxer_conversations do |t|
                                        t.column :subject, :string, :default => ""

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

                                      def create
                                        unless resource_params[:email]
                                          return render json: {
                                            success: false,
                                            errors: ['You must provide an email address.']
                                    Severity: Minor
                                    Found in backend/app/controllers/api/v1/confirmations_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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language