Package com.android.tools.lint.detector.api

Examples of com.android.tools.lint.detector.api.Issue


        mWriter.write("<br/>\n");                                        //$NON-NLS-1$
        mWriter.write(String.format("%1$d errors and %2$d warnings found:",
                errorCount, warningCount));
        mWriter.write("<br/><br/>\n");                                   //$NON-NLS-1$

        Issue previousIssue = null;
        if (!issues.isEmpty()) {
            List<List<Warning>> related = new ArrayList<List<Warning>>();
            List<Warning> currentList = null;
            for (Warning warning : issues) {
                if (warning.issue != previousIssue) {
                    previousIssue = warning.issue;
                    currentList = new ArrayList<Warning>();
                    related.add(currentList);
                }
                assert currentList != null;
                currentList.add(warning);
            }

            writeOverview(related, missing.size());

            Category previousCategory = null;
            for (List<Warning> warnings : related) {
                Warning first = warnings.get(0);
                Issue issue = first.issue;

                if (issue.getCategory() != previousCategory) {
                    previousCategory = issue.getCategory();
                    mWriter.write("\n<a name=\"");                       //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("\"></a>\n");                          //$NON-NLS-1$
                    mWriter.write("<div class=\"category\"><a href=\"#\" title=\"Return to top\">");           //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("</a><div class=\"categorySeparator\"></div>\n");//$NON-NLS-1$
                    mWriter.write("</div>\n");                           //$NON-NLS-1$
                }

                mWriter.write("<a name=\"" + issue.getId() + "\"></a>\n"); //$NON-NLS-1$ //$NON-NLS-2$
                mWriter.write("<div class=\"issue\">\n");                //$NON-NLS-1$

                // Explain this issue
                mWriter.write("<div class=\"id\"><a href=\"#\" title=\"Return to top\">");                     //$NON-NLS-1$
                mWriter.write(issue.getId());
                mWriter.write(": ");                                     //$NON-NLS-1$
                mWriter.write(issue.getBriefDescription(HTML));
                mWriter.write("</a><div class=\"issueSeparator\"></div>\n"); //$NON-NLS-1$
                mWriter.write("</div>\n");                               //$NON-NLS-1$

                mWriter.write("<div class=\"warningslist\">\n");         //$NON-NLS-1$
                boolean partialHide = !mSimpleFormat && warnings.size() > SPLIT_LIMIT;
View Full Code Here


            mFixUrl = addLocalResources(HtmlReporter.class.getResource("lint-run.png")); //$NON-NLS-1$)
        }

        Category previousCategory = null;
        for (List<Warning> warnings : related) {
            Issue issue = warnings.get(0).issue;

            boolean isError = false;
            for (Warning warning : warnings) {
                if (warning.severity == Severity.ERROR || warning.severity == Severity.FATAL) {
                    isError = true;
                    break;
                }
            }

            if (issue.getCategory() != previousCategory) {
                mWriter.write("<tr><td></td><td class=\"categoryColumn\">");
                previousCategory = issue.getCategory();
                String categoryName = issue.getCategory().getFullName();
                mWriter.write("<a href=\"#");                        //$NON-NLS-1$
                mWriter.write(categoryName);
                mWriter.write("\">");                                //$NON-NLS-1$
                mWriter.write(categoryName);
                mWriter.write("</a>\n");                             //$NON-NLS-1$
                mWriter.write("</td></tr>");                         //$NON-NLS-1$
                mWriter.write("\n");                                 //$NON-NLS-1$
            }
            mWriter.write("<tr>\n");                                 //$NON-NLS-1$

            // Count column
            mWriter.write("<td class=\"countColumn\">");             //$NON-NLS-1$
            mWriter.write(Integer.toString(warnings.size()));
            mWriter.write("</td>");                                  //$NON-NLS-1$

            mWriter.write("<td class=\"issueColumn\">");             //$NON-NLS-1$

            String imageUrl = isError ? errorUrl : warningUrl;
            if (imageUrl != null) {
                mWriter.write("<img border=\"0\" align=\"top\" src=\""); //$NON-NLS-1$
                mWriter.write(imageUrl);
                mWriter.write("\" alt=\"");
                mWriter.write(isError ? "Error" : "Warning");
                mWriter.write("\" />\n");                            //$NON-NLS-1$
            }

            mWriter.write("<a href=\"#");                            //$NON-NLS-1$
            mWriter.write(issue.getId());
            mWriter.write("\">");                                    //$NON-NLS-1$
            mWriter.write(issue.getId());
            mWriter.write(": ");                                     //$NON-NLS-1$
            mWriter.write(issue.getBriefDescription(HTML));
            mWriter.write("</a>\n");                                 //$NON-NLS-1$

            mWriter.write("</td></tr>\n");
        }
View Full Code Here

        mWriter.write("<br/>");                                       //$NON-NLS-1$
        mWriter.write(String.format("%1$d errors and %2$d warnings found:",
                errorCount, warningCount));
        mWriter.write("<br/><br/>");                                  //$NON-NLS-1$

        Issue previousIssue = null;
        if (!issues.isEmpty()) {
            List<List<Warning>> related = new ArrayList<List<Warning>>();
            List<Warning> currentList = null;
            for (Warning warning : issues) {
                if (warning.issue != previousIssue) {
                    previousIssue = warning.issue;
                    currentList = new ArrayList<Warning>();
                    related.add(currentList);
                }
                assert currentList != null;
                currentList.add(warning);
            }

            writeOverview(related, missing.size());

            Category previousCategory = null;
            for (List<Warning> warnings : related) {
                Warning first = warnings.get(0);
                Issue issue = first.issue;

                if (issue.getCategory() != previousCategory) {
                    previousCategory = issue.getCategory();
                    mWriter.write("\n<a name=\"");                       //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("\"></a>\n");                          //$NON-NLS-1$
                    mWriter.write("<div class=\"category\"><a href=\"#\" title=\"Return to top\">");           //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("</a><div class=\"categorySeparator\"></div>\n");//$NON-NLS-1$
                    mWriter.write("</div>\n");                           //$NON-NLS-1$
                }

                mWriter.write("<a name=\"" + issue.getId() + "\"></a>\n"); //$NON-NLS-1$ //$NON-NLS-2$
                mWriter.write("<div class=\"issue\">\n");                //$NON-NLS-1$

                // Explain this issue
                mWriter.write("<div class=\"id\"><a href=\"#\" title=\"Return to top\">");                     //$NON-NLS-1$
                mWriter.write(issue.getId());
                mWriter.write(": ");                                     //$NON-NLS-1$
                mWriter.write(issue.getBriefDescription(HTML));
                mWriter.write("</a><div class=\"issueSeparator\"></div>\n"); //$NON-NLS-1$
                mWriter.write("</div>\n");                               //$NON-NLS-1$

                mWriter.write("<div class=\"warningslist\">\n");         //$NON-NLS-1$
                boolean partialHide = !mSimpleFormat && warnings.size() > SPLIT_LIMIT;
View Full Code Here

            mFixUrl = addLocalResources(HtmlReporter.class.getResource("lint-run.png")); //$NON-NLS-1$)
        }

        Category previousCategory = null;
        for (List<Warning> warnings : related) {
            Issue issue = warnings.get(0).issue;

            boolean isError = false;
            for (Warning warning : warnings) {
                if (warning.severity == Severity.ERROR || warning.severity == Severity.FATAL) {
                    isError = true;
                    break;
                }
            }

            if (issue.getCategory() != previousCategory) {
                mWriter.write("<tr><td></td><td class=\"categoryColumn\">");
                previousCategory = issue.getCategory();
                String categoryName = issue.getCategory().getFullName();
                mWriter.write("<a href=\"#");                        //$NON-NLS-1$
                mWriter.write(categoryName);
                mWriter.write("\">");                                //$NON-NLS-1$
                mWriter.write(categoryName);
                mWriter.write("</a>\n");                             //$NON-NLS-1$
                mWriter.write("</td></tr>");                         //$NON-NLS-1$
                mWriter.write("\n");                                 //$NON-NLS-1$
            }
            mWriter.write("<tr>\n");                                 //$NON-NLS-1$

            // Count column
            mWriter.write("<td class=\"countColumn\">");             //$NON-NLS-1$
            mWriter.write(Integer.toString(warnings.size()));
            mWriter.write("</td>");                                  //$NON-NLS-1$

            mWriter.write("<td class=\"issueColumn\">");             //$NON-NLS-1$

            String imageUrl = isError ? errorUrl : warningUrl;
            if (imageUrl != null) {
                mWriter.write("<img border=\"0\" align=\"top\" src=\""); //$NON-NLS-1$
                mWriter.write(imageUrl);
                mWriter.write("\" />\n");                            //$NON-NLS-1$
            }

            mWriter.write("<a href=\"#");                            //$NON-NLS-1$
            mWriter.write(issue.getId());
            mWriter.write("\">");                                    //$NON-NLS-1$
            mWriter.write(issue.getId());
            mWriter.write(": ");                                     //$NON-NLS-1$
            mWriter.write(issue.getBriefDescription(HTML));
            mWriter.write("</a>\n");                                 //$NON-NLS-1$

            mWriter.write("</td></tr>\n");
        }
View Full Code Here

        if (!issues.isEmpty()) {
            for (Warning warning : issues) {
                mWriter.write('\n');
                indent(mWriter, 1);
                mWriter.write("<issue"); //$NON-NLS-1$
                Issue issue = warning.issue;
                writeAttribute(mWriter, 2, "id", issue.getId());                      //$NON-NLS-1$
                writeAttribute(mWriter, 2, "severity",
                        warning.severity.getDescription());
                writeAttribute(mWriter, 2, "message", warning.message);               //$NON-NLS-1$

                writeAttribute(mWriter, 2, "category",                                //$NON-NLS-1$
                        issue.getCategory().getFullName());
                writeAttribute(mWriter, 2, "priority",                                //$NON-NLS-1$
                        Integer.toString(issue.getPriority()));
                writeAttribute(mWriter, 2, "summary", issue.getDescription(RAW));     //$NON-NLS-1$
                writeAttribute(mWriter, 2, "explanation", issue.getExplanation(RAW)); //$NON-NLS-1$
                List<String> moreInfo = issue.getMoreInfo();
                if (!moreInfo.isEmpty()) {
                    // Compatibility with old format: list first URL
                    writeAttribute(mWriter, 2, "url", moreInfo.get(0));           //$NON-NLS-1$
                    if (issue.getMoreInfo() != null) {
                        writeAttribute(mWriter, 2, "urls",                            //$NON-NLS-1$
                                Joiner.on(',').join(issue.getMoreInfo()));

                    }
                }
                if (warning.errorLine != null && !warning.errorLine.isEmpty()) {
                    String line = warning.errorLine;
View Full Code Here

                "<body>\n" +                                             //$NON-NLS-1$
                "<h1>" +                                                 //$NON-NLS-1$
                "Lint Report" +
                "</h1>");                                                //$NON-NLS-1$

        Issue previousIssue = null;
        if (issues.size() > 0) {
            List<List<Warning>> related = new ArrayList<List<Warning>>();
            List<Warning> currentList = null;
            for (Warning warning : issues) {
                if (warning.issue != previousIssue) {
                    previousIssue = warning.issue;
                    currentList = new ArrayList<Warning>();
                    related.add(currentList);
                }
                assert currentList != null;
                currentList.add(warning);
            }

            mWriter.write(String.format("Check performed at %1$s.",
                    new Date().toString()));
            mWriter.write("<br/><br/>");                                  //$NON-NLS-1$
            mWriter.write(String.format("%1$d errors and %2$d warnings found:",
                    errorCount, warningCount));
            mWriter.write("<br/>");                                       //$NON-NLS-1$

            // Write issue id summary
            mWriter.write("<ul>\n");                                     //$NON-NLS-1$
            Category previousCategory = null;
            for (List<Warning> warnings : related) {
                Issue issue = warnings.get(0).issue;

                if (issue.getCategory() != previousCategory) {
                    if (previousCategory != null) {
                        mWriter.write("</ul>\n");                         //$NON-NLS-1$
                    }
                    previousCategory = issue.getCategory();
                    String categoryName = issue.getCategory().getFullName();
                    mWriter.write("<li> <a href=\"#");                   //$NON-NLS-1$
                    mWriter.write(categoryName);
                    mWriter.write("\">");                                //$NON-NLS-1$
                    mWriter.write(categoryName);
                    mWriter.write("</a>\n");                             //$NON-NLS-1$
                    mWriter.write("\n<ul>\n");                           //$NON-NLS-1$
                }

                mWriter.write("<li> <a href=\"#");                       //$NON-NLS-1$
                mWriter.write(issue.getId());
                mWriter.write("\">");                                    //$NON-NLS-1$
                mWriter.write(String.format("%1$3d %2$s",                //$NON-NLS-1$
                        warnings.size(), issue.getId()));
                mWriter.write("</a>\n");                                 //$NON-NLS-1$
            }
            if (previousCategory != null) {
                mWriter.write("</ul>\n");                                //$NON-NLS-1$
            }
            mWriter.write("</ul>\n");                                    //$NON-NLS-1$
            mWriter.write("<br/>");                                      //$NON-NLS-1$

            previousCategory = null;
            for (List<Warning> warnings : related) {
                Warning first = warnings.get(0);
                Issue issue = first.issue;

                if (issue.getCategory() != previousCategory) {
                    previousCategory = issue.getCategory();
                    mWriter.write("\n<a name=\"");                       //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("\">\n");                              //$NON-NLS-1$
                    mWriter.write("<div class=\"category\">");           //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("</div>\n");                           //$NON-NLS-1$
                }

                mWriter.write("<a name=\"" + issue.getId() + "\">\n")//$NON-NLS-1$ //$NON-NLS-2$
                mWriter.write("<div class=\"issue\">\n");                //$NON-NLS-1$

                // Explain this issue
                mWriter.write("<div class=\"id\">");                     //$NON-NLS-1$
                mWriter.write(issue.getId());
                mWriter.write("</div>\n"); //$NON-NLS-1$

                mWriter.write("<div class=\"warningslist\">\n");         //$NON-NLS-1$
                boolean partialHide = !mSimpleFormat && warnings.size() > SPLIT_LIMIT;

                int count = 0;
                for (Warning warning : warnings) {
                    if (partialHide && count == SHOWN_COUNT) {
                        String id = warning.issue.getId() + "Div";       //$NON-NLS-1$
                        mWriter.write("<input id=\"");                   //$NON-NLS-1$
                        mWriter.write(id);
                        mWriter.write("Link\" onclick=\"reveal('");      //$NON-NLS-1$
                        mWriter.write(id);
                        mWriter.write("');\" type=\"button\" value=\""); //$NON-NLS-1$
                        mWriter.write(String.format("+ %1$d More...",
                                warnings.size() - SHOWN_COUNT));
                        mWriter.write("\" />\n");                        //$NON-NLS-1$
                        mWriter.write("<div id=\"");                     //$NON-NLS-1$
                        mWriter.write(id);
                        mWriter.write("\" style=\"display: none\">\n")//$NON-NLS-1$
                    }
                    count++;
                    String url = null;
                    if (warning.path != null) {
                        mWriter.write("<span class=\"location\">");      //$NON-NLS-1$

                        url = getUrl(warning.file);
                        if (url != null) {
                            mWriter.write("<a href=\"");                 //$NON-NLS-1$
                            mWriter.write(url);
                            mWriter.write("\">");                        //$NON-NLS-1$
                        }
                        mWriter.write(warning.path);
                        if (url != null) {
                            mWriter.write("</a>");                       //$NON-NLS-1$
                        }
                        mWriter.write(':');
                        if (warning.line >= 0) {
                            // 0-based line numbers, but display 1-based
                            mWriter.write(Integer.toString(warning.line + 1) + ':');
                        }
                        mWriter.write("</span>"); //$NON-NLS-1$
                        mWriter.write(' ');
                    }

                    // Is the URL for a single image? If so, place it here near the top
                    // of the error floating on the right. If there are multiple images,
                    // they will instead be placed in a horizontal box below the error
                    boolean addedImage = false;
                    if (url != null && warning.location != null
                            && warning.location.getSecondary() == null) {
                        addedImage = addImage(url, warning.location);
                    }
                    mWriter.write("<span class=\"message\">");           //$NON-NLS-1$
                    appendEscapedText(warning.message);
                    mWriter.write("</span>");                            //$NON-NLS-1$
                    if (addedImage) {
                        mWriter.write("<br clear=\"right\"/>");          //$NON-NLS-1$
                    } else {
                        mWriter.write("<br />");                         //$NON-NLS-1$
                    }

                    // Insert surrounding code block window
                    if (warning.line >= 0 && warning.fileContents != null) {
                        mWriter.write("<pre class=\"errorlines\">\n");   //$NON-NLS-1$
                        appendCodeBlock(warning.fileContents, warning.line, warning.offset);
                        mWriter.write("\n</pre>");                       //$NON-NLS-1$
                    }
                    mWriter.write('\n');

                    // Place a block of images?
                    if (!addedImage && url != null && warning.location != null
                            && warning.location.getSecondary() != null) {
                        addImage(url, warning.location);
                    }
                }
                if (partialHide) { // Close up the extra div
                    mWriter.write("</div>\n");                           //$NON-NLS-1$
                }

                mWriter.write("</div>\n");                               //$NON-NLS-1$

                mWriter.write("<div class=\"metadata\">");               //$NON-NLS-1$
                mWriter.write("Priority: ");
                mWriter.write(String.format("%1$d / 10", issue.getPriority()));
                mWriter.write("<br/>\n");                                //$NON-NLS-1$
                mWriter.write("Category: ");
                mWriter.write(issue.getCategory().getFullName());
                mWriter.write("</div>\n");                               //$NON-NLS-1$

                mWriter.write("Severity: ");
                if (first.severity == Severity.ERROR) {
                    mWriter.write("<span class=\"error\">");             //$NON-NLS-1$
                } else if (first.severity == Severity.WARNING) {
                    mWriter.write("<span class=\"warning\">");           //$NON-NLS-1$
                } else {
                    mWriter.write("<span>");                             //$NON-NLS-1$
                }
                appendEscapedText(first.severity.getDescription());
                mWriter.write("</span>");                                //$NON-NLS-1$

                mWriter.write("<div class=\"summary\">\n");              //$NON-NLS-1$
                mWriter.write("Explanation: ");
                String description = issue.getDescription();
                mWriter.write(description);
                if (description.length() > 0
                        && Character.isLetter(description.charAt(description.length() - 1))) {
                    mWriter.write('.');
                }
                mWriter.write("</div>\n");                               //$NON-NLS-1$
                mWriter.write("<div class=\"explanation\">\n");          //$NON-NLS-1$
                String explanation = issue.getExplanation();
                explanation = explanation.replace("\n", "<br/>");       //$NON-NLS-1$ //$NON-NLS-2$
                explanation = Main.wrap(explanation);
                appendEscapedText(explanation);
                mWriter.write("\n</div>\n");                             //$NON-NLS-1$;
                if (issue.getMoreInfo() != null) {
                    mWriter.write("<div class=\"moreinfo\">");           //$NON-NLS-1$
                    mWriter.write("More info: ");
                    mWriter.write("<a href=\"");                         //$NON-NLS-1$
                    mWriter.write(issue.getMoreInfo());
                    mWriter.write("\">");                                //$NON-NLS-1$
                    mWriter.write(issue.getMoreInfo());
                    mWriter.write("</a></div>\n");                       //$NON-NLS-1$
                }

                mWriter.write("<br/>");                                  //$NON-NLS-1$
                mWriter.write("To suppress this error, run lint with <code>--ignore ");
                mWriter.write(issue.getId());
                mWriter.write("</code><br/>");                           //$NON-NLS-1$

                mWriter.write("</div>");                                 //$NON-NLS-1$
            }
        }
View Full Code Here

        mWriter.write("<br/>");                                       //$NON-NLS-1$
        mWriter.write(String.format("%1$d errors and %2$d warnings found:",
                errorCount, warningCount));
        mWriter.write("<br/><br/>");                                  //$NON-NLS-1$

        Issue previousIssue = null;
        if (!issues.isEmpty()) {
            List<List<Warning>> related = new ArrayList<List<Warning>>();
            List<Warning> currentList = null;
            for (Warning warning : issues) {
                if (warning.issue != previousIssue) {
                    previousIssue = warning.issue;
                    currentList = new ArrayList<Warning>();
                    related.add(currentList);
                }
                assert currentList != null;
                currentList.add(warning);
            }

            writeOverview(related, missing.size());

            Category previousCategory = null;
            for (List<Warning> warnings : related) {
                Warning first = warnings.get(0);
                Issue issue = first.issue;

                if (issue.getCategory() != previousCategory) {
                    previousCategory = issue.getCategory();
                    mWriter.write("\n<a name=\"");                       //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("\"></a>\n");                          //$NON-NLS-1$
                    mWriter.write("<div class=\"category\"><a href=\"#\" title=\"Return to top\">");           //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("</a><div class=\"categorySeparator\"></div>\n");//$NON-NLS-1$
                    mWriter.write("</div>\n");                           //$NON-NLS-1$
                }

                mWriter.write("<a name=\"" + issue.getId() + "\"></a>\n"); //$NON-NLS-1$ //$NON-NLS-2$
                mWriter.write("<div class=\"issue\">\n");                //$NON-NLS-1$

                // Explain this issue
                mWriter.write("<div class=\"id\"><a href=\"#\" title=\"Return to top\">");                     //$NON-NLS-1$
                mWriter.write(issue.getId());
                mWriter.write(": ");                                     //$NON-NLS-1$
                mWriter.write(issue.getBriefDescription(HTML));
                mWriter.write("</a><div class=\"issueSeparator\"></div>\n"); //$NON-NLS-1$
                mWriter.write("</div>\n");                               //$NON-NLS-1$

                mWriter.write("<div class=\"warningslist\">\n");         //$NON-NLS-1$
                boolean partialHide = !mSimpleFormat && warnings.size() > SPLIT_LIMIT;
View Full Code Here

            mFixUrl = addLocalResources(HtmlReporter.class.getResource("lint-run.png")); //$NON-NLS-1$)
        }

        Category previousCategory = null;
        for (List<Warning> warnings : related) {
            Issue issue = warnings.get(0).issue;

            boolean isError = false;
            for (Warning warning : warnings) {
                if (warning.severity == Severity.ERROR || warning.severity == Severity.FATAL) {
                    isError = true;
                    break;
                }
            }

            if (issue.getCategory() != previousCategory) {
                mWriter.write("<tr><td></td><td class=\"categoryColumn\">");
                previousCategory = issue.getCategory();
                String categoryName = issue.getCategory().getFullName();
                mWriter.write("<a href=\"#");                        //$NON-NLS-1$
                mWriter.write(categoryName);
                mWriter.write("\">");                                //$NON-NLS-1$
                mWriter.write(categoryName);
                mWriter.write("</a>\n");                             //$NON-NLS-1$
                mWriter.write("</td></tr>");                         //$NON-NLS-1$
                mWriter.write("\n");                                 //$NON-NLS-1$
            }
            mWriter.write("<tr>\n");                                 //$NON-NLS-1$

            // Count column
            mWriter.write("<td class=\"countColumn\">");             //$NON-NLS-1$
            mWriter.write(Integer.toString(warnings.size()));
            mWriter.write("</td>");                                  //$NON-NLS-1$

            mWriter.write("<td class=\"issueColumn\">");             //$NON-NLS-1$

            String imageUrl = isError ? errorUrl : warningUrl;
            if (imageUrl != null) {
                mWriter.write("<img border=\"0\" align=\"top\" src=\""); //$NON-NLS-1$
                mWriter.write(imageUrl);
                mWriter.write("\" />\n");                            //$NON-NLS-1$
            }

            mWriter.write("<a href=\"#");                            //$NON-NLS-1$
            mWriter.write(issue.getId());
            mWriter.write("\">");                                    //$NON-NLS-1$
            mWriter.write(issue.getId());
            mWriter.write(": ");                                     //$NON-NLS-1$
            mWriter.write(issue.getBriefDescription(HTML));
            mWriter.write("</a>\n");                                 //$NON-NLS-1$

            mWriter.write("</td></tr>\n");
        }
View Full Code Here

        if (!issues.isEmpty()) {
            for (Warning warning : issues) {
                mWriter.write('\n');
                indent(mWriter, 1);
                mWriter.write("<issue"); //$NON-NLS-1$
                Issue issue = warning.issue;
                writeAttribute(mWriter, 2, "id", issue.getId());                      //$NON-NLS-1$
                writeAttribute(mWriter, 2, "severity",
                        warning.severity.getDescription());
                writeAttribute(mWriter, 2, "message", warning.message);               //$NON-NLS-1$

                writeAttribute(mWriter, 2, "category",                                //$NON-NLS-1$
                        issue.getCategory().getFullName());
                writeAttribute(mWriter, 2, "priority",                                //$NON-NLS-1$
                        Integer.toString(issue.getPriority()));
                writeAttribute(mWriter, 2, "summary", issue.getDescription(RAW));     //$NON-NLS-1$
                writeAttribute(mWriter, 2, "explanation", issue.getExplanation(RAW)); //$NON-NLS-1$
                List<String> moreInfo = issue.getMoreInfo();
                if (!moreInfo.isEmpty()) {
                    // Compatibility with old format: list first URL
                    writeAttribute(mWriter, 2, "url", moreInfo.get(0));               //$NON-NLS-1$
                    writeAttribute(mWriter, 2, "urls",                                //$NON-NLS-1$
                            Joiner.on(',').join(issue.getMoreInfo()));
                }
                if (warning.errorLine != null && !warning.errorLine.isEmpty()) {
                    String line = warning.errorLine;
                    int index1 = line.indexOf('\n');
                    if (index1 != -1) {
View Full Code Here

        mWriter.write("<br/>\n");                                        //$NON-NLS-1$
        mWriter.write(String.format("%1$d errors and %2$d warnings found:",
                errorCount, warningCount));
        mWriter.write("<br/><br/>\n");                                   //$NON-NLS-1$

        Issue previousIssue = null;
        if (!issues.isEmpty()) {
            List<List<Warning>> related = new ArrayList<List<Warning>>();
            List<Warning> currentList = null;
            for (Warning warning : issues) {
                if (warning.issue != previousIssue) {
                    previousIssue = warning.issue;
                    currentList = new ArrayList<Warning>();
                    related.add(currentList);
                }
                assert currentList != null;
                currentList.add(warning);
            }

            writeOverview(related, missing.size());

            Category previousCategory = null;
            for (List<Warning> warnings : related) {
                Warning first = warnings.get(0);
                Issue issue = first.issue;

                if (issue.getCategory() != previousCategory) {
                    previousCategory = issue.getCategory();
                    mWriter.write("\n<a name=\"");                       //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("\"></a>\n");                          //$NON-NLS-1$
                    mWriter.write("<div class=\"category\"><a href=\"#\" title=\"Return to top\">");           //$NON-NLS-1$
                    mWriter.write(issue.getCategory().getFullName());
                    mWriter.write("</a><div class=\"categorySeparator\"></div>\n");//$NON-NLS-1$
                    mWriter.write("</div>\n");                           //$NON-NLS-1$
                }

                mWriter.write("<a name=\"" + issue.getId() + "\"></a>\n"); //$NON-NLS-1$ //$NON-NLS-2$
                mWriter.write("<div class=\"issue\">\n");                //$NON-NLS-1$

                // Explain this issue
                mWriter.write("<div class=\"id\"><a href=\"#\" title=\"Return to top\">");                     //$NON-NLS-1$
                mWriter.write(issue.getId());
                mWriter.write(": ");                                     //$NON-NLS-1$
                mWriter.write(issue.getBriefDescription(HTML));
                mWriter.write("</a><div class=\"issueSeparator\"></div>\n"); //$NON-NLS-1$
                mWriter.write("</div>\n");                               //$NON-NLS-1$

                mWriter.write("<div class=\"warningslist\">\n");         //$NON-NLS-1$
                boolean partialHide = !mSimpleFormat && warnings.size() > SPLIT_LIMIT;
View Full Code Here

TOP

Related Classes of com.android.tools.lint.detector.api.Issue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.