Cimpress-MCP/JustReleaseNotes

View on GitHub

Showing 17 of 25 total issues

Function printVersionBlock has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    def printVersionBlock(self, deps, version, date, tickets):
        baseoutput = BaseWriter.BaseWriter.printVersionBlock(self, deps, version, date, tickets)
        if baseoutput is not None:
            return baseoutput

Severity: Minor
Found in JustReleaseNotes/writers/HtmlWriter.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 printVersionBlock has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def printVersionBlock(self, deps, version, date, tickets):
        baseoutput = BaseWriter.BaseWriter.printVersionBlock(self, deps, version, date, tickets)
        if baseoutput is not None:
            return baseoutput + "\n"

Severity: Minor
Found in JustReleaseNotes/writers/MarkdownWriter.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

Function generateReleaseNotesByPromotedVersions has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def generateReleaseNotesByPromotedVersions(self, writer):
        
        ticketsSoFar = []
        hashesInVersion = self.__repo.gitHistoryByVersion

Severity: Minor
Found in JustReleaseNotes/releaseNotes.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 generate_release_notes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def generate_release_notes(configFile):
        requests.packages.urllib3.disable_warnings()
        file = open(configFile, 'r')
        fileContents = file.read()
        releaseNotesConfig = EnvReplacer.replace(json.loads(fileContents))
Severity: Minor
Found in JustReleaseNotes/command_line.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 retrieveDependeciesVersions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def retrieveDependeciesVersions(self, version):
        if "DirectDependencies" not in self.__conf:
            return {}
    
        if len(self.__conf["DirectDependencies"].keys()) == 0:
Severity: Minor
Found in JustReleaseNotes/artifacters/Artifactory.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 retrieveVersionsByGitHash has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def retrieveVersionsByGitHash(self, promotedVersionsList):
        self.__log("Retrieving versions (git tags)...")

        if len(promotedVersionsList) == 0:
            print("Make sure you first retrieve the promoted version: Promoted versions are empty, thus every tag "
Severity: Minor
Found in JustReleaseNotes/sourcers/GitRepo.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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, conf):
        self.gitCommitsList = []
        self.gitCommitMessagesByHash = {}
        self.gitDatesByHash = {}
        self.versionsByGitHash = {}
Severity: Minor
Found in JustReleaseNotes/sourcers/GitRepo.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

Avoid deeply nested control flow statements.
Open

                        for ticket, link in list(ticketInfo["embedded_link"].items()):
                            title = re.sub(ticket, "<a href=\"{0}\">{1}</a>".format(link, ticket), title)
                    imgFormat = '<img src="{1}" alt="{0}" width="16" height="16" style="padding-right: 5px"></img>'
Severity: Major
Found in JustReleaseNotes/writers/HtmlWriter.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        for ticket, link in list(ticketInfo["embedded_link"].items()):
                            title = re.sub(ticket, "[{1}]({0})".format(link, ticket), title)
                    iconPart = ""
Severity: Major
Found in JustReleaseNotes/writers/MarkdownWriter.py - About 45 mins to fix

Function generateForOneWriter has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def generateForOneWriter(generator, ticketProvider, writerType, directory, fileName):
Severity: Minor
Found in JustReleaseNotes/command_line.py - About 35 mins to fix

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

    def __optimizeHistoryByVersion(self):        
        sortedVersionsInAscendingOrder = [] + list(self.gitHistoryByVersion.keys())
        sortedVersionsInAscendingOrder.sort(key=lambda s: list(map(int, s.split('.'))), reverse=False)
        
        # remove commits part of newer versions if they exists in older one        
Severity: Minor
Found in JustReleaseNotes/sourcers/GitRepo.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

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

    def __printVersionBlock(self, version, tickets, writer, date):
        deps = {}
        if version != self.__PendingPromotionCaption:
            if version in self.__promotedVersionsInfo:
                date = self.__promotedVersionsInfo[version]["date"]
Severity: Minor
Found in JustReleaseNotes/releaseNotes.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 __replaceStr(str(config))
Severity: Major
Found in JustReleaseNotes/utils/EnvReplacer.py - About 30 mins to fix

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

    def getTicketInfo(self, ticket):
        data = self.__readJsonInfo(ticket)

        if "title" in data:
            title = data["title"]
Severity: Minor
Found in JustReleaseNotes/issuers/GitHubIssues.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

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

    def printVersionBlock(self, deps, version, date, tickets):

        # get the content of a specific version if already present
        if version in self.versionsAlreadyPresent.keys():
            return json.dumps(self.versionsAlreadyPresent[version], indent=2, sort_keys=True)
Severity: Minor
Found in JustReleaseNotes/writers/JsonWriter.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

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

    def setInitialContent(self, content):
        currentVersion = None
        for line in content.split("\n"):
            v = self.deconvertVersion(self.parseVersionHeader(line))
            if v is not False and v != str(sys.maxsize):
Severity: Minor
Found in JustReleaseNotes/writers/BaseWriter.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

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

    def retrievePromotedVersions(self):
        self.__log("Retrieving promoted ({0}) versions {1} ...".format(
            self.__conf["Repository"],
            self.__conf["ArtifactUri"]))

Severity: Minor
Found in JustReleaseNotes/artifacters/Artifactory.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