abe33/awesome_form

View on GitHub

Showing 5 of 5 total issues

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

      def association_columns(*by_associations)
        if object.present? && object.class.respond_to?(:reflections)
          object.class.reflections.collect do |name, association_reflection|
            if by_associations.present?
              if by_associations.include?(association_reflection.macro) && association_reflection.options[:polymorphic] != true
Severity: Minor
Found in lib/awesome_form/methods/attributes.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

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

var parseRawCommit = function(raw) {
  if (!raw) return null;

  var lines = raw.split('\n');
  var msg = {}, match;
Severity: Minor
Found in changelog.js - About 1 hr to fix

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

    var printSection = function(stream, title, section, printCommitLinks) {
      printCommitLinks = printCommitLinks === undefined ? true : printCommitLinks;
      var components = Object.getOwnPropertyNames(section).sort();
    
      if (!components.length) return;
    Severity: Minor
    Found in changelog.js - About 1 hr to fix

      Function writeChangelog has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var writeChangelog = function(stream, commits, version) {
        var sections = {
          fix: {},
          feat: {},
          breaks: {}
      Severity: Minor
      Found in changelog.js - About 1 hr to fix

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

              def association_options_for(association)
                association_options = {
                  type: :association,
                  association_type: association.macro,
                  multiple: association.instance_variable_get(:@collection),
        Severity: Minor
        Found in lib/awesome_form/methods/attributes.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