thanos/tailchaser

View on GitHub

Showing 16 of 16 total issues

Function run has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self, source_pattern, receiver=None):
        self.startup()
        self.config.checkpoint_filename = self.make_checkpoint_filename(source_pattern)
        file_tailed = None
        if self.config.clear_checkpoint and os.path.exists(self.config.checkpoint_filename):
Severity: Minor
Found in src/tailchaser/tailer.py - About 6 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

Function next_to_process has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def next_to_process(self, source_pattern, checkpoint):
        log.debug("next_to_process: %s %s", source_pattern, checkpoint)
        with_stats = [(file_name, os.stat(file_name)) for file_name in glob.glob(source_pattern)]
        # log.debug("with_stats: %s", glob.glob(source_pattern))
        for pos, (file_name, stat) in enumerate(sorted(with_stats, key=lambda x: x[1].st_mtime)):
Severity: Minor
Found in src/tailchaser/tailer.py - About 3 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

File tailer.py has 326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Module that contains the the chaser (producer) classes.

.. moduleauthor:: Thanos Vassilakis <thanosv@gmail.com>

"""
Severity: Minor
Found in src/tailchaser/tailer.py - About 3 hrs to fix

    Tailer has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Tailer(object):
        VERBOSE = False
        DONT_FOLLOW = False
        DRYRUN = False
        DONT_BACKFILL = False
    Severity: Minor
    Found in src/tailchaser/tailer.py - About 2 hrs to fix

      Function run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, receiver):
              buff = ''
              first_record = True
              e = 0
              s = 0
      Severity: Minor
      Found in src/tailchaser/pipes.py - 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

      Function read_record_with_regex has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def read_record_with_regex(self, file_to_grep):
              buff = ''
              first_record = True
              e = 0
              s = 0
      Severity: Minor
      Found in src/tailchaser/tailer.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Major
      Found in src/tailchaser/tailer.py - About 1 hr to fix

        Function install_python has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def install_python(version, arch, home):
            print("Installing Python", version, "for", arch, "bit architecture to", home)
            if exists(home):
                return
        
        
        Severity: Minor
        Found in ci/appveyor-bootstrap.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 configure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def configure(self, *nodes, **kwargs):
                self.nodes = nodes
                doc = self.__doc__ if self.__doc__ else '%s'
                parser = argparse.ArgumentParser(description=doc % __version__,
                                                 formatter_class=argparse.RawDescriptionHelpFormatter, )
        Severity: Minor
        Found in src/tailchaser/pipes.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 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self, receiver):
                while True:
                    buff = (yield)
                    if buff:
                        while True:
        Severity: Minor
        Found in src/tailchaser/pipes.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

        Avoid deeply nested control flow statements.
        Open

                                        if self.filter(record):
                                            self.handoff(file_info[0], checkpoint, record, receiver)
                                        self.save_checkpoint(checkpoint)
        Severity: Major
        Found in src/tailchaser/tailer.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if not (self.config.only_backfill or is_backfill) and self.config.read_period:
                                              time_spent = time.time() - ticks
                                              if time_spent > self.config.read_period:
                                                  time.sleep(self.config.read_pause)
                                                  break
          Severity: Major
          Found in src/tailchaser/tailer.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if self.state == self.RUNNING:
                                        self.state = self.WAITING
                                        return
                            checkpoint = (checkpoint[0], stat.st_mtime, checkpoint[2])
            Severity: Major
            Found in src/tailchaser/tailer.py - About 45 mins to fix

              Function download_latest_artifacts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def download_latest_artifacts(account_project, build_id):
                  """Download all the artifacts from the latest build."""
                  if build_id is None:
                      url = "https://ci.appveyor.com/api/projects/{}".format(account_project)
                  else:
              Severity: Minor
              Found in ci/appveyor-download.py - 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

              Function at_eof has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def at_eof(self, tmp_file, is_backfill_file_info):
                      try:
                          if is_backfill_file_info:
                              is_backfill, (file_tailed, (fid, mtime, offset)) = is_backfill_file_info
                              if is_backfill and tmp_file != file_tailed:
              Severity: Minor
              Found in src/tailchaser/tailer.py - 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

              Function file_opener has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def file_opener(cls, file_name, mode='rb'):
                      if file_name.endswith('.gz'):
                          log.debug("gzip file: %s", file_name)
                          return gzip.open(file_name, mode)
                      elif file_name.endswith('.bz2'):
              Severity: Minor
              Found in src/tailchaser/tailer.py - 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