time/datasource/sceau/naming_conventions_files.py

Summary

Maintainability
F
6 days
Test Coverage

Function process has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
Open

def process(do_rename_dir, do_rename_files, do_dates=0):
    print("A sound will be produced at the end of the processing.")
    print("What follows is also logged into the file logRename.txt\r\n")
    print('Press <ctrl>+C to abort')
    printandlog("########################################")
Severity: Minor
Found in time/datasource/sceau/naming_conventions_files.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 naming_conventions_files.py has 422 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf-8

# toutes les chaines sont en unicode (même les docstrings)
from __future__ import unicode_literals

Severity: Minor
Found in time/datasource/sceau/naming_conventions_files.py - About 6 hrs to fix

    Function correctYMD has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def correctYMD(s, regexen, regexus):
        matched = regexen.search(s)
        if matched:  # push it to the front, order reversed
            splits = regexen.split(s)
            if splits[2] != splits[4]:
    Severity: Minor
    Found in time/datasource/sceau/naming_conventions_files.py - About 5 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 correctYM has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def correctYM(s, regexen, regexus):
        matched = regexen.search(s)
        if matched:  # push it to the front, order reversed
            splits = regexen.split(s)
            if int(splits[3]) > maxYear:
    Severity: Minor
    Found in time/datasource/sceau/naming_conventions_files.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 main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv):
        if (len(sys.argv) == 1):
            process(0, 0, 0)
            os.system("pause")
        else:
    Severity: Minor
    Found in time/datasource/sceau/naming_conventions_files.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 correctYY has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def correctYY(s, regex):
        matched = regex.search(s)
        if matched:  # push it to the front, separated by -
            splits = regex.split(s)
            if int(splits[1]) > maxYear:
    Severity: Minor
    Found in time/datasource/sceau/naming_conventions_files.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 correctPureYMD has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def correctPureYMD(s, regexen):
        matched = regexen.search(s)
        if matched:  # push it to the front, order reversed
            splits = regexen.split(s)
            if int(splits[1]) > maxYear:
    Severity: Minor
    Found in time/datasource/sceau/naming_conventions_files.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 subs_dates has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def subs_dates(s):
        (s, matched) = correctYY(s, regExDatesYYYYtoYYYY)
        if not matched:
            (s, matched) = correctYMD(s, regExDatesDDMMYYYY, regExDatesYYYYMMDD)
            if not matched:
    Severity: Minor
    Found in time/datasource/sceau/naming_conventions_files.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 subdir == '__pycache__':
                            continue
                        if subdir == '.':
    Severity: Major
    Found in time/datasource/sceau/naming_conventions_files.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if (do_dates):
                              stripped = subs_dates(stripped)
                          nbDir = nbDir + 1
      Severity: Major
      Found in time/datasource/sceau/naming_conventions_files.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if subdir == '.':
                                continue
                            if subdir == '..':
        Severity: Major
        Found in time/datasource/sceau/naming_conventions_files.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if (same_string(stripped, subdir)):
                                  printandlogNoRC('.');
                                  sys.stdout.flush()
                              else:
                                  if (not found):
          Severity: Major
          Found in time/datasource/sceau/naming_conventions_files.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if (same_string(stripped, file)):
                                    printandlogNoRC('*');
                                    sys.stdout.flush()
                                else:
                                    nbFileChanges = nbFileChanges + 1
            Severity: Major
            Found in time/datasource/sceau/naming_conventions_files.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if subdir == '..':
                                      continue
                                  stripped = accentsTidy(subdir)
              Severity: Major
              Found in time/datasource/sceau/naming_conventions_files.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if (do_dates):
                                        stripped = subs_dates(stripped)
                                    nbFiles = nbFiles + 1
                Severity: Major
                Found in time/datasource/sceau/naming_conventions_files.py - About 45 mins to fix

                  Function correctY has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def correctY(s, regex):
                      matched = regex.search(s)
                      if matched:  # push it to the front, order reversed
                          splits = regex.split(s)
                          if int(splits[1]) > maxYear:
                  Severity: Minor
                  Found in time/datasource/sceau/naming_conventions_files.py - 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

                  Avoid too many return statements within this function.
                  Open

                          return (sout, True)
                  Severity: Major
                  Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return (s, False)
                    Severity: Major
                    Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return (s, False)
                      Severity: Major
                      Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return (s, False)
                        Severity: Major
                        Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return (s, False)
                          Severity: Major
                          Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return (s, False)
                            Severity: Major
                            Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return (s, False)
                              Severity: Major
                              Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return (sout, True)
                                Severity: Major
                                Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return (sout, True)
                                  Severity: Major
                                  Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return (sout, True)
                                    Severity: Major
                                    Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                      return (s, False)
                                      Severity: Major
                                      Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                            return (s, False)
                                        Severity: Major
                                        Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return (s, False)
                                          Severity: Major
                                          Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return (s, False)
                                            Severity: Major
                                            Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                      return (sout, True)
                                              Severity: Major
                                              Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                            return (s, False)
                                                Severity: Major
                                                Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                      return (s, False)
                                                  Severity: Major
                                                  Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                        return (s, False)
                                                    Severity: Major
                                                    Found in time/datasource/sceau/naming_conventions_files.py - About 30 mins to fix

                                                      There are no issues that match your filters.

                                                      Category
                                                      Status