Furtif/POGOProtos

View on GitHub

Showing 7 of 15 total issues

Function open_proto_file has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
Open

def open_proto_file(main_file, head_for_files):
    new_proto_single_file = main_file.replace(raw_name, input_file)
    if os.path.exists(new_proto_single_file):
        os.unlink(new_proto_single_file)
    open_for_new = open(new_proto_single_file, 'a')
Severity: Minor
Found in compile_base.py - About 2 days 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 compile_base.py has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import argparse
import operator
Severity: Minor
Found in compile_base.py - About 3 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                        if os.path.exists(gen_last_files + "/" + v2):
                            if v2 not in includes:
                                includes.append(v2)
                    elif message.startswith('\trepeated') or message.startswith('\t\trepeated') or message.startswith(
    Severity: Major
    Found in compile_base.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if os.path.exists(gen_last_files + "/" + file_for_includes) and file_for_includes not in includes:
                              includes.append(file_for_includes)
                      else:
      Severity: Major
      Found in compile_base.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if os.path.exists(gen_last_files + "/" + v1):
                                if v1 not in includes:
                                    includes.append(v1)
                            if os.path.exists(gen_last_files + "/" + v2):
        Severity: Major
        Found in compile_base.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if os.path.exists(gen_last_files + "/" + file_for_includes) and file_for_includes not in includes:
                                  includes.append(file_for_includes)
                      if len(includes) > 0:
          Severity: Major
          Found in compile_base.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if file == 'ITEM.proto':
                                    continue
                                files_inc += 'import "' + file + '";\n'
            Severity: Major
            Found in compile_base.py - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language