oglimmer/lunchy

View on GitHub
src/main/java/de/oglimmer/lunchy/email/NotificationEmailText.java

Summary

Maintainability
B
4 hrs
Test Coverage

Method getHtml has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static String getHtml(UsersRecord rec, List<UpdatesQuery> updates, List<MailImage> images) {
        StringBuilder body = new StringBuilder("<html><head><meta charset='utf-8'><style>" + HEAD_STYLE + "</style></head><body style='" + BODY_STYLE
                + "'>");
        body.append("<div id='main' style='" + CONTENT_DIV_STYLE + "'>");
        body.append("<h2>" + MessageFormat.format(greeting, rec.getDisplayname()) + "</h2>").append(BR);
Severity: Major
Found in src/main/java/de/oglimmer/lunchy/email/NotificationEmailText.java - About 2 hrs to fix

    Method getHtml has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static String getHtml(UsersRecord rec, List<UpdatesQuery> updates, List<MailImage> images) {
            StringBuilder body = new StringBuilder("<html><head><meta charset='utf-8'><style>" + HEAD_STYLE + "</style></head><body style='" + BODY_STYLE
                    + "'>");
            body.append("<div id='main' style='" + CONTENT_DIV_STYLE + "'>");
            body.append("<h2>" + MessageFormat.format(greeting, rec.getDisplayname()) + "</h2>").append(BR);
    Severity: Minor
    Found in src/main/java/de/oglimmer/lunchy/email/NotificationEmailText.java - 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

    Method getText has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static String getText(UsersRecord rec, List<UpdatesQuery> updates, List<MailImage> images) {
            StringBuilder body = new StringBuilder();
            body.append(MessageFormat.format(greeting, rec.getDisplayname())).append(CR);
            body.append(CR);
            if (updates.isEmpty()) {
    Severity: Minor
    Found in src/main/java/de/oglimmer/lunchy/email/NotificationEmailText.java - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status