Skip to content

Commit

Permalink
feat(objectionary#216): clean the code
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jan 21, 2025
1 parent 927e4f5 commit cd4a981
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions src/main/java/org/eolang/lints/LtByXsl.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,36 +171,19 @@ private int lineno(final XML defect) {
* Find the name of the program.
* @param program XML program
* @return Name of the program.
* @todo #199:30min Use {@link XML#xpath(String)} Method Instead.
* This method is using a custom implementation to find the name of the program.
* We should replace it with the {@link XML#xpath(String)} method to make the code cleaner.
* You can use `program.xpath("/program/@name").stream().findFirst().orElse("unknown")`
* to find the name.
* This issue is blocked by
* <a href="https://github.com/jcabi/jcabi-xml/issues/289">jcabi/jcabi-xml#289</a>.
*/
private static String findName(final XML program) {
return new Navigator(program.inner())
.element("program")
.attribute("name")
.text()
.orElse("unknown");
// return Optional.of(program.inner().getFirstChild())
// .map(Node::getAttributes).map(attrs -> attrs.getNamedItem("name"))
// .map(Node::getTextContent).orElse("unknown");
}

/**
* Find defects in the report.
* @param report XML report.
* @return Collection of defects.
* @todo #199:30min Use {@link XML#nodes(String)} Method Instead.
* This method is using a custom implementation to find defects in the
* report. We should replace it with the {@link XML#nodes(String)} method
* to make the code cleaner.
* You can use `report.nodes("/defects/defect")` to find the defects.
* This issue is blocked by
* <a href="https://github.com/jcabi/jcabi-xml/issues/288">jcabi/jcabi-xml#288</a>.
*/
private static Collection<XML> findDefects(final XML report) {
return new Navigator(report.inner())
Expand All @@ -210,23 +193,5 @@ private static Collection<XML> findDefects(final XML report) {
.map(Navigator::node)
.map(XMLDocument::new)
.collect(Collectors.toList());
// final NodeList nodes = report.inner().getChildNodes();
// final int length = nodes.getLength();
// final List<XML> defects = new ArrayList<>(0);
// for (int index = 0; index < length; ++index) {
// final Node element = nodes.item(index);
// if ("defects".equals(element.getNodeName())) {
// final NodeList dnodes;
// dnodes = element.getChildNodes();
// final int all = dnodes.getLength();
// for (int idx = 0; idx < all; ++idx) {
// final Node defect = dnodes.item(idx);
// if ("defect".equals(defect.getNodeName())) {
// defects.add(new XMLDocument(defect.cloneNode(true)));
// }
// }
// }
// }
// return defects;
}
}

0 comments on commit cd4a981

Please sign in to comment.