yast/yast-yast2

View on GitHub
library/system/src/lib/yast2/fs_snapshot.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

      def create(snapshot_type, description, previous: nil, cleanup: nil, important: false)
        raise SnapperNotConfigured unless configured?

        cmd = format(CREATE_SNAPSHOT_CMD,
          root:          target_root.shellescape,
Severity: Minor
Found in library/system/src/lib/yast2/fs_snapshot.rb - About 55 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 all has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def all
        raise SnapperNotConfigured unless configured?

        out = Yast::SCR.Execute(
          Yast::Path.new(".target.bash_output"),
Severity: Minor
Found in library/system/src/lib/yast2/fs_snapshot.rb - About 55 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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def initialize(number, snapshot_type, previous_number, timestamp, user, cleanup_algo, description)
Severity: Major
Found in library/system/src/lib/yast2/fs_snapshot.rb - About 50 mins to fix

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

          def create_snapshot?(snapshot_type)
            disable_snapshots = Yast::Linuxrc.value_for(Yast::LinuxrcClass::DISABLE_SNAPSHOTS)
    
            # Feature is not defined on Linuxrc commandline
            return true if disable_snapshots.nil? || disable_snapshots.empty?
    Severity: Minor
    Found in library/system/src/lib/yast2/fs_snapshot.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

    There are no issues that match your filters.

    Category
    Status