openpprn/opn

View on GitHub

Showing 24 of 24 total issues

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

class User < ActiveRecord::Base
  has_merit

  rolify role_join_table_name: 'roles_users'

Severity: Minor
Found in app/models/user.rb - About 3 hrs to fix

    Method process_answer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def process_answer(question, params)
        # adding should always be at tail!
    
        # Create answer object
        # Create answer edge from tail to new answer
    Severity: Major
    Found in app/models/surveys/answer_session.rb - About 2 hrs to fix

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

        def oodt_status #6
          response = oodt.post "users/@@status", user_hash
          body = parse_body(response)
      
          if response.success?
      Severity: Minor
      Found in app/models/oodt_user.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 value= has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def value=(val)
          answer_values.clear
      
          question.answer_templates.each do |template|
            target_field = template.data_type
      Severity: Minor
      Found in app/models/surveys/answer.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

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

                   {element: 1, title: "My Sleep Disturbances", value: 500, zones: [{startValue: 1, endValue: 888, title: "Low"}, {startValue: 300, endValue: 999, title: "High"}], markers: [{value: 1, title: "User Max"}, {value: 2, title: "User Average"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 256..256
      app/models/oodt_user.rb on lines 257..257

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

      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

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

        def pair_with_legacy_ccfa_partners_account(email) #3
          response = oodt.post "users/@@link", user_hash.merge!({email: email})
          body = parse_body(response)
      
          if response.success?
      Severity: Minor
      Found in app/models/oodt_user.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 minimum_set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def minimum_set(question_flow, start_point = nil)
          current_q = start_point
      
          # go to start of group
          if start_point.present?
      Severity: Minor
      Found in app/models/surveys/group.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

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

                   {element: 3, title: "My Anxiety Symptoms", value: 100, zones: [{startValue: 1, endValue: 100, title: "Low"}, {startValue: 700, endValue: 999, title: "High"}], markers: [{value: 1, title: "Perfect"}, {value: 2, title: "See a Doctor"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 256..256
      app/models/oodt_user.rb on lines 257..257

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

      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 9 locations. Consider refactoring.
      Open

                   {element: 2, title: "My Fatigue Symptoms", value: 300, zones: [{startValue: 1, endValue: 200, title: "Low"}, {startValue: 900, endValue: 999, title: "High"}], markers: [{value: 1, title: "Yesterday"}, {value: 2, title: "Last Week"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 256..256
      app/models/oodt_user.rb on lines 257..257

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

      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 9 locations. Consider refactoring.
      Open

                   {element: 3, title: "My Anxiety Symptoms", value: 100, zones: [{startValue: 1, endValue: 100, title: "Low"}, {startValue: 700, endValue: 999, title: "High"}], markers: [{value: 1, title: "Perfect"}, {value: 2, title: "See a Doctor"}] }
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 256..256

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

      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

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

        def update
          authorize_action_for @research_topic
      
          if current_user.can_moderate?(@research_topic)
            @research_topic.update(research_topic_moderator_params)
      Severity: Minor
      Found in app/controllers/research_topics_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

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

                   {element: 1, title: "My Depression Symptoms", value: 500, zones: [{startValue: 1, endValue: 888, title: "Low"}, {startValue: 300, endValue: 999, title: "High"}], markers: [{value: 1, title: "User Max"}, {value: 2, title: "User Average"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 256..256
      app/models/oodt_user.rb on lines 257..257

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

      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

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

        def find_longest_path(source, destination, by = :time)
          topological_order = tsorted_edges[tsorted_edges.find_index(source.id)..tsorted_edges.find_index(destination.id)]
      
      
          distances = Hash[topological_order.map {|q| [q,-1*Float::INFINITY]}]
      Severity: Minor
      Found in app/models/surveys/question_flow.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

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

                   {element: 2, title: "My Quality of Life", value: 300, zones: [{startValue: 1, endValue: 200, title: "Low"}, {startValue: 900, endValue: 999, title: "High"}], markers: [{value: 1, title: "Yesterday"}, {value: 2, title: "Last Week"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 256..256
      app/models/oodt_user.rb on lines 257..257

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

      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

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

        def process_answer(question, params)
          # adding should always be at tail!
      
          # Create answer object
          # Create answer edge from tail to new answer
      Severity: Minor
      Found in app/models/surveys/answer_session.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

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

                   {element: 2, title: "My Social Relations", value: 300, zones: [{startValue: 1, endValue: 200, title: "Low"}, {startValue: 900, endValue: 999, title: "High"}], markers: [{value: 1, title: "Yesterday"}, {value: 2, title: "Last Week"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 257..257

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

      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 9 locations. Consider refactoring.
      Open

                   {element: 1, title: "My Disease Activity", value: 500, zones: [{startValue: 1, endValue: 888, title: "Low"}, {startValue: 300, endValue: 999, title: "High"}], markers: [{value: 1, title: "User Max"}, {value: 2, title: "User Average"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 254..254
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 256..256
      app/models/oodt_user.rb on lines 257..257

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

      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 9 locations. Consider refactoring.
      Open

                   {element: 3, title: "My Pain Symptoms", value: 100, zones: [{startValue: 1, endValue: 100, title: "Low"}, {startValue: 700, endValue: 999, title: "High"}], markers: [{value: 1, title: "Perfect"}, {value: 2, title: "See a Doctor"}] },
      Severity: Major
      Found in app/models/oodt_user.rb and 8 other locations - About 35 mins to fix
      app/models/oodt_user.rb on lines 249..249
      app/models/oodt_user.rb on lines 250..250
      app/models/oodt_user.rb on lines 251..251
      app/models/oodt_user.rb on lines 252..252
      app/models/oodt_user.rb on lines 253..253
      app/models/oodt_user.rb on lines 255..255
      app/models/oodt_user.rb on lines 256..256
      app/models/oodt_user.rb on lines 257..257

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

      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

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

        def leaf
          if first_question.descendants.length > 0
            leaves = first_question.descendants.select {|q| q.leaf?}
      
            raise StandardError, "Multiple leaves found!" if leaves.length > 1
      Severity: Minor
      Found in app/models/surveys/question_flow.rb - About 25 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_question has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def next_question
          candidate_edges = QuestionEdge.where(parent_question_id: question.id, direct: true, question_flow_id: answer_session.question_flow.id)
      
          if candidate_edges.empty?
            nil
      Severity: Minor
      Found in app/models/surveys/answer.rb - About 25 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
      Source
      Language