manshar/manshar

View on GitHub

Showing 32 of 82 total issues

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

      link: function (scope, element) {
        scope.$watch('article', function (newValue) {
          if (!newValue) {
            return;
          }
Severity: Minor
Found in web-client/app/scripts/directives/recommendButton.js - About 1 hr to fix

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

          link: function (scope, element, attrs, ngModel) {
            ngModel.$render = function() {
              if (ngModel.$viewValue) {
                if (!carbon.Loader.load('embedProviders')) {
                  carbon.Loader.register('embedProviders', {
    Severity: Minor
    Found in web-client/app/scripts/directives/articleRenderer.js - About 1 hr to fix

      Method create has a Cognitive Complexity of 10 (exceeds 5 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

      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 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def update
          # make sure user is authorized
          unless @resource
            return render json: {
              success: false,
      Severity: Minor
      Found in backend/app/controllers/api/v1/passwords_controller.rb - About 1 hr to fix

        Function scrollToHelper_ has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            element, x1, x2, prop, t, v, step, timeFunc) {
        Severity: Major
        Found in web-client/app/scripts/helpers/animation.js - About 1 hr to fix

          Function smoothScrollTo has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              container, from, to, prop, duration, timeFunc) {
          Severity: Minor
          Found in web-client/app/scripts/helpers/animation.js - About 45 mins to fix

            Function createNewComment has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                var createNewComment = function(srcElement, scope, container, offsetTop, guidAttribute) {
            Severity: Minor
            Found in web-client/app/scripts/directives/anchoredComments.js - About 35 mins to fix

              Function update has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      update: function (params, data, optSuccess, optError, optConfig) {
              Severity: Minor
              Found in web-client/app/scripts/services/articleService.js - About 35 mins to fix

                Method update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def update
                    # make sure user is authorized
                    unless @resource
                      return render json: {
                        success: false,
                Severity: Minor
                Found in backend/app/controllers/api/v1/passwords_controller.rb - About 35 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 abs_url_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def abs_url_for *attributes
                      attributes.each do |attr_name|
                        define_method "#{attr_name}_abs_url" do |size = nil|
                
                          image = self.send(attr_name)
                Severity: Minor
                Found in backend/app/models/concerns/utils.rb - About 35 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

                Avoid too many return statements within this function.
                Open

                        return time + ' دقيقة للقراءة';
                Severity: Major
                Found in web-client/app/scripts/filters/timeToRead.js - About 30 mins to fix

                  Method change has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def change
                      add_column :articles, :user_name, :string
                      add_column :articles, :topic_title, :string
                      add_column :articles, :category_color, :string
                  
                  

                  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