gamunu/cassandra_snap

View on GitHub
cassandra_snap/main.py

Summary

Maintainability
B
6 hrs
Test Coverage

File main.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import (absolute_import, print_function)

# From system
from collections import defaultdict
from fabric.api import env
Severity: Minor
Found in cassandra_snap/main.py - About 3 hrs to fix

    Function main has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def main():
        base_parser = add_s3_arguments(_base_parser)
        subparsers = base_parser.add_subparsers(
            title='subcommands', dest='subcommand'
        )
    Severity: Minor
    Found in cassandra_snap/main.py - About 1 hr to fix

      Function restore_backup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def restore_backup(args):
          snapshots = SnapshotCollection(
              args.aws_access_key_id,
              args.aws_secret_access_key,
              args.s3_base_path,
      Severity: Minor
      Found in cassandra_snap/main.py - 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 run_backup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def run_backup(args):
          if args.user:
              env.user = args.user
      
          if args.password:
      Severity: Minor
      Found in cassandra_snap/main.py - 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

      Line too long (84 > 79 characters)
      Open

              help="The file containing the private ssh key to use to connect with hosts")
      Severity: Minor
      Found in cassandra_snap/main.py by pep8

      Limit all lines to a maximum of 79 characters.

      There are still many devices around that are limited to 80 character
      lines; plus, limiting windows to 80 characters makes it possible to
      have several windows side-by-side.  The default wrapping on such
      devices looks ugly.  Therefore, please limit all lines to a maximum
      of 79 characters. For flowing long blocks of text (docstrings or
      comments), limiting the length to 72 characters is recommended.
      
      Reports error E501.

      Line too long (98 > 79 characters)
      Open

              help="Limit the upload speed to S3 (by using 'pv'). Value expressed in kilobytes (*1024)")
      Severity: Minor
      Found in cassandra_snap/main.py by pep8

      Limit all lines to a maximum of 79 characters.

      There are still many devices around that are limited to 80 character
      lines; plus, limiting windows to 80 characters makes it possible to
      have several windows side-by-side.  The default wrapping on such
      devices looks ugly.  Therefore, please limit all lines to a maximum
      of 79 characters. For flowing long blocks of text (docstrings or
      comments), limiting the length to 72 characters is recommended.
      
      Reports error E501.

      Line too long (80 > 79 characters)
      Open

              help="Comma separated list of keyspaces to backup (omit to backup all)")
      Severity: Minor
      Found in cassandra_snap/main.py by pep8

      Limit all lines to a maximum of 79 characters.

      There are still many devices around that are limited to 80 character
      lines; plus, limiting windows to 80 characters makes it possible to
      have several windows side-by-side.  The default wrapping on such
      devices looks ugly.  Therefore, please limit all lines to a maximum
      of 79 characters. For flowing long blocks of text (docstrings or
      comments), limiting the length to 72 characters is recommended.
      
      Reports error E501.

      There are no issues that match your filters.

      Category
      Status