Cimpress-MCP/JustReleaseNotes

View on GitHub

Showing 25 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def parseVersionHeader(self, line):
        if (line.startswith("<div style=\"width:100%; border: 0px\"><a name=\"") and line.endswith("\" class=\"version\"></a>")):
            return line[46:len(line)-22]
        else:
            return False
Severity: Major
Found in JustReleaseNotes/writers/HtmlWriter.py and 1 other location - About 2 hrs to fix
JustReleaseNotes/writers/MarkdownWriter.py on lines 20..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    if "embedded_link" in ticketInfo:
                        for ticket, link in list(ticketInfo["embedded_link"].items()):
                            title = re.sub(ticket, "<a href=\"{0}\">{1}</a>".format(link, ticket), title)
Severity: Major
Found in JustReleaseNotes/writers/HtmlWriter.py and 1 other location - About 2 hrs to fix
JustReleaseNotes/writers/MarkdownWriter.py on lines 52..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    if "embedded_link" in ticketInfo:
                        for ticket, link in list(ticketInfo["embedded_link"].items()):
                            title = re.sub(ticket, "[{1}]({0})".format(link, ticket), title)
Severity: Major
Found in JustReleaseNotes/writers/MarkdownWriter.py and 1 other location - About 2 hrs to fix
JustReleaseNotes/writers/HtmlWriter.py on lines 58..60

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def parseVersionHeader(self, line):
        if (line.startswith("## ") and line.endswith(" ##")):
            return line[3:len(line)-3]
        else:
            return False
Severity: Major
Found in JustReleaseNotes/writers/MarkdownWriter.py and 1 other location - About 2 hrs to fix
JustReleaseNotes/writers/HtmlWriter.py on lines 16..20

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Severity: Minor
Found in JustReleaseNotes/sourcers/factory.py and 1 other location - About 30 mins to fix
JustReleaseNotes/artifacters/factory.py on lines 0..5

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 32.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        self.__log("Retrieving promoted ({0}) versions {1} ...".format(
            self.__conf["Repository"],
            self.__conf["ArtifactUri"]))
Severity: Minor
Found in JustReleaseNotes/artifacters/Artifactory.py and 1 other location - About 30 mins to fix
JustReleaseNotes/artifacters/GitHubReleases.py on lines 21..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 32.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        self.__log("Retrieving promoted from {0} at {1} ...".format(
            self.__conf["Provider"],
            self.__conf["Url"]))
Severity: Minor
Found in JustReleaseNotes/artifacters/GitHubReleases.py and 1 other location - About 30 mins to fix
JustReleaseNotes/artifacters/Artifactory.py on lines 124..126

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 32.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language