shortdudey123/yamllint

View on GitHub

Showing 6 of 6 total issues

Method parse_recurse has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_recurse(psych_parse_data, is_sequence = false) # rubocop:disable Style/OptionalBooleanParameter
        return if psych_parse_data.nil?

        is_key = false
        psych_parse_data.children.each do |n|
Severity: Minor
Found in lib/yamllint/linter.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

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

    def define_task
      desc 'Run yamllint' unless ::Rake.application.last_description

      task(name) do
        puts 'Running YamlLint...'
Severity: Minor
Found in lib/yamllint/rake_task.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 parse_recurse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_recurse(psych_parse_data, is_sequence = false) # rubocop:disable Style/OptionalBooleanParameter
        return if psych_parse_data.nil?

        is_key = false
        psych_parse_data.children.each do |n|
Severity: Minor
Found in lib/yamllint/linter.rb - About 1 hr to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr,
                       kernel = Kernel)
    Severity: Minor
    Found in lib/yamllint/cli.rb - About 35 mins to fix

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

          def check(path)
            raise FileNotFoundError, "#{path}: no such file" unless File.exist?(path)
      
            valid = false
            if !disable_extension_check && !check_filename(path)
      Severity: Minor
      Found in lib/yamllint/linter.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 lint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def lint(files_to_check)
            linter = if files_to_check == ['-']
                       lint_stream
                     else
                       lint_files(files_to_check)
      Severity: Minor
      Found in lib/yamllint/cli.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