Commit 9d40d73d0af8cb18037d44cd9e1c35c4a332140a
1 parent
1f4e6812
Exists in
master
and in
1 other branch
1) Alteração dos "N° critérios" dos métodos de acordo com o arquivo
"criteriosDescriptions.properties" do ases. 2) criação do método na classe (ContentEvaluation.java) para verificar se um link possui 'img' e se os mesmos posuem 'alt' e se dem descrição.
Showing
4 changed files
with
128 additions
and
65 deletions
Show diff stats
src/main/java/br/com/checker/emag/core/BehaviorEvaluation.java
@@ -66,9 +66,9 @@ public class BehaviorEvaluation extends Evaluation{ | @@ -66,9 +66,9 @@ public class BehaviorEvaluation extends Evaluation{ | ||
66 | getOccurrences().addAll(checkRecommendation11()); | 66 | getOccurrences().addAll(checkRecommendation11()); |
67 | getOccurrences().addAll(checkRecommendation12()); | 67 | getOccurrences().addAll(checkRecommendation12()); |
68 | getOccurrences().addAll(checkRecommendation13()); | 68 | getOccurrences().addAll(checkRecommendation13()); |
69 | - getOccurrences().addAll(checkRecommendation14()); | 69 | + //getOccurrences().addAll(checkRecommendation14()); comentado por Gibran |
70 | getOccurrences().addAll(checkRecommendation15()); | 70 | getOccurrences().addAll(checkRecommendation15()); |
71 | - getOccurrences().addAll(checkRecommendation16()); | 71 | + //getOccurrences().addAll(checkRecommendation16()); comentado por Gibran |
72 | 72 | ||
73 | return getOccurrences(); | 73 | return getOccurrences(); |
74 | } | 74 | } |
@@ -107,28 +107,28 @@ List<Occurrence> occurrences = new ArrayList<Occurrence>(); | @@ -107,28 +107,28 @@ List<Occurrence> occurrences = new ArrayList<Occurrence>(); | ||
107 | } | 107 | } |
108 | 108 | ||
109 | if(dbclick!=null){ | 109 | if(dbclick!=null){ |
110 | - occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "2")); | 110 | + occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "6"));//"2")); |
111 | } | 111 | } |
112 | 112 | ||
113 | if(ondblclick!=null){ | 113 | if(ondblclick!=null){ |
114 | - occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "2")); | 114 | + occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "6"));//"2")); |
115 | } | 115 | } |
116 | 116 | ||
117 | if (onmousedown != null && onkeydown == null) { | 117 | if (onmousedown != null && onkeydown == null) { |
118 | - occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "1")); | 118 | + occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "2"));//"1")); |
119 | } | 119 | } |
120 | 120 | ||
121 | if (onmouseup != null && onkeyup == null) { | 121 | if (onmouseup != null && onkeyup == null) { |
122 | - occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "1")); | 122 | + occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "1"));//"1")); |
123 | } | 123 | } |
124 | /*if (onclick != null && onkeypress == null) { | 124 | /*if (onclick != null && onkeypress == null) { |
125 | occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "1")); | 125 | occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "1")); |
126 | }*/ | 126 | }*/ |
127 | if (onmouseover != null && onfocus == null) { | 127 | if (onmouseover != null && onfocus == null) { |
128 | - occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "1")); | 128 | + occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "2"));//"1")); |
129 | } | 129 | } |
130 | if (onmouseout != null && onblur == null) { | 130 | if (onmouseout != null && onblur == null) { |
131 | - occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "1")); | 131 | + occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "2"));//"1")); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
@@ -145,7 +145,7 @@ List<Occurrence> occurrences = new ArrayList<Occurrence>(); | @@ -145,7 +145,7 @@ List<Occurrence> occurrences = new ArrayList<Occurrence>(); | ||
145 | if(element != null){ | 145 | if(element != null){ |
146 | for(String attribute : attributes){ | 146 | for(String attribute : attributes){ |
147 | if (element.getAttributeValue(attribute) != null) { | 147 | if (element.getAttributeValue(attribute) != null) { |
148 | - occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "3")); | 148 | + occurrences.add(this.buildOccurrence("2.1", true, element.toString(), element, "8"));//"3")); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | } | 151 | } |
src/main/java/br/com/checker/emag/core/ContentEvaluation.java
@@ -185,11 +185,11 @@ public class ContentEvaluation extends Evaluation { | @@ -185,11 +185,11 @@ public class ContentEvaluation extends Evaluation { | ||
185 | getOccurrences().addAll(checkRecommendation17()); | 185 | getOccurrences().addAll(checkRecommendation17()); |
186 | getOccurrences().addAll(checkRecommendation18()); | 186 | getOccurrences().addAll(checkRecommendation18()); |
187 | getOccurrences().addAll(checkRecommendation19()); | 187 | getOccurrences().addAll(checkRecommendation19()); |
188 | - getOccurrences().addAll(checkRecommendation20()); | 188 | + //getOccurrences().addAll(checkRecommendation20()); comentado por Gibran |
189 | getOccurrences().addAll(checkRecommendation21()); | 189 | getOccurrences().addAll(checkRecommendation21()); |
190 | getOccurrences().addAll(checkRecommendation22()); | 190 | getOccurrences().addAll(checkRecommendation22()); |
191 | getOccurrences().addAll(checkRecommendation23()); | 191 | getOccurrences().addAll(checkRecommendation23()); |
192 | - getOccurrences().addAll(checkRecommendation24()); | 192 | + //getOccurrences().addAll(checkRecommendation24()); |
193 | getOccurrences().addAll(checkRecommendation25()); | 193 | getOccurrences().addAll(checkRecommendation25()); |
194 | getOccurrences().addAll(checkRecommendation26()); | 194 | getOccurrences().addAll(checkRecommendation26()); |
195 | getOccurrences().addAll(checkRecommendation27()); | 195 | getOccurrences().addAll(checkRecommendation27()); |
@@ -245,16 +245,16 @@ public class ContentEvaluation extends Evaluation { | @@ -245,16 +245,16 @@ public class ContentEvaluation extends Evaluation { | ||
245 | 245 | ||
246 | if (lang == null && (xmlLang != null || xmlns != null)) { | 246 | if (lang == null && (xmlLang != null || xmlns != null)) { |
247 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, | 247 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, |
248 | - html, "2")); | 248 | + html, "3"));//"2")); |
249 | } else if (lang != null && lang.getValue().isEmpty()) { | 249 | } else if (lang != null && lang.getValue().isEmpty()) { |
250 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, | 250 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, |
251 | - html, "2")); | 251 | + html, "3"));//"2")); |
252 | } else if (xmlLang != null && xmlLang.getValue().isEmpty()) { | 252 | } else if (xmlLang != null && xmlLang.getValue().isEmpty()) { |
253 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, | 253 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, |
254 | - html, "2")); | 254 | + html, "3"));//"2")); |
255 | } else if (xmlns != null && xmlns.getValue().isEmpty()) { | 255 | } else if (xmlns != null && xmlns.getValue().isEmpty()) { |
256 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, | 256 | occurrences.add(this.buildOccurrence("3.1", false, tagHtml, |
257 | - html, "2")); | 257 | + html, "3"));//"2")); |
258 | } | 258 | } |
259 | 259 | ||
260 | /* | 260 | /* |
@@ -349,7 +349,9 @@ public class ContentEvaluation extends Evaluation { | @@ -349,7 +349,9 @@ public class ContentEvaluation extends Evaluation { | ||
349 | 349 | ||
350 | private List<Occurrence> checkRecommendation21() { | 350 | private List<Occurrence> checkRecommendation21() { |
351 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); | 351 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); |
352 | - | 352 | + |
353 | + Element LinkComImg; | ||
354 | + | ||
353 | for (Element link : getDocument().getAllElements("a")) { | 355 | for (Element link : getDocument().getAllElements("a")) { |
354 | String href = link.getAttributeValue("href"); | 356 | String href = link.getAttributeValue("href"); |
355 | String title = link.getAttributeValue("title"); | 357 | String title = link.getAttributeValue("title"); |
@@ -358,18 +360,34 @@ public class ContentEvaluation extends Evaluation { | @@ -358,18 +360,34 @@ public class ContentEvaluation extends Evaluation { | ||
358 | if (hasEqualsContentHref(link) && isRegistroBr(content)) | 360 | if (hasEqualsContentHref(link) && isRegistroBr(content)) |
359 | occurrences.add(this.buildOccurrence("3.5", false, | 361 | occurrences.add(this.buildOccurrence("3.5", false, |
360 | link.toString(), link, "1")); | 362 | link.toString(), link, "1")); |
361 | - | ||
362 | - if (!hasContent(link)) | ||
363 | - occurrences.add(this.buildOccurrence("3.5", true, | ||
364 | - link.toString(), link, "2")); | ||
365 | - else if (hasImgWithoutAlt(link)) | ||
366 | - occurrences.add(this.buildOccurrence("3.5", true, | ||
367 | - link.toString(), link, "2")); | 363 | + |
364 | + | ||
365 | + LinkComImg = link.getFirstElement("img"); | ||
366 | + | ||
367 | + if(LinkComImg == null) | ||
368 | + { | ||
369 | + if (!hasContent(link)) | ||
370 | + { | ||
371 | + occurrences.add(this.buildOccurrence("3.5", true, | ||
372 | + link.toString(), link, "3"));//"2")); | ||
373 | + } | ||
374 | + } | ||
375 | + else | ||
376 | + { | ||
377 | + if (hasLinkComImgWithoutAlt(link)) | ||
378 | + { | ||
379 | + occurrences.add(this.buildOccurrence("3.5", true, | ||
380 | + link.toString(), link, "3"));//"2")); | ||
381 | + } | ||
382 | + } | ||
383 | + | ||
384 | + | ||
385 | + | ||
368 | 386 | ||
369 | // if(hasTitle(link) && isNotAlt(link)) | 387 | // if(hasTitle(link) && isNotAlt(link)) |
370 | if (hasTitle(link) && !hasContent(link)) | 388 | if (hasTitle(link) && !hasContent(link)) |
371 | occurrences.add(this.buildOccurrence("3.5", true, | 389 | occurrences.add(this.buildOccurrence("3.5", true, |
372 | - link.toString(), link, "3")); | 390 | + link.toString(), link, "4"));//"3")); |
373 | 391 | ||
374 | /* | 392 | /* |
375 | * if(!hasTitle(link) && !hasContent(link) && | 393 | * if(!hasTitle(link) && !hasContent(link) && |
@@ -380,31 +398,31 @@ public class ContentEvaluation extends Evaluation { | @@ -380,31 +398,31 @@ public class ContentEvaluation extends Evaluation { | ||
380 | 398 | ||
381 | if (hasImgWithoutAlt(link)) | 399 | if (hasImgWithoutAlt(link)) |
382 | occurrences.add(this.buildOccurrence("3.5", true, | 400 | occurrences.add(this.buildOccurrence("3.5", true, |
383 | - link.toString(), link, "4")); | 401 | + link.toString(), link, "5"));//"4")); |
384 | 402 | ||
385 | if (hasLeiaMaisDescription(link)) | 403 | if (hasLeiaMaisDescription(link)) |
386 | occurrences.add(this.buildOccurrence("3.5", true, | 404 | occurrences.add(this.buildOccurrence("3.5", true, |
387 | - link.toString(), link, "5")); | 405 | + link.toString(), link, "6"));//"5")); |
388 | 406 | ||
389 | if (hasDiferenteContentSameLink(link)) | 407 | if (hasDiferenteContentSameLink(link)) |
390 | occurrences.add(this.buildOccurrence("3.5", true, | 408 | occurrences.add(this.buildOccurrence("3.5", true, |
391 | - link.toString(), link, "6")); | 409 | + link.toString(), link, "10"));//"6")); |
392 | 410 | ||
393 | if (isTitleEqualsContent(link)) | 411 | if (isTitleEqualsContent(link)) |
394 | occurrences.add(this.buildOccurrence("3.5", true, | 412 | occurrences.add(this.buildOccurrence("3.5", true, |
395 | - link.toString(), link, "8")); | 413 | + link.toString(), link, "12"));//"8")); |
396 | 414 | ||
397 | if (hasSameContentDiferentLink(link)) | 415 | if (hasSameContentDiferentLink(link)) |
398 | occurrences.add(this.buildOccurrence("3.5", true, | 416 | occurrences.add(this.buildOccurrence("3.5", true, |
399 | - link.toString(), link, "7")); | 417 | + link.toString(), link, "11"));//"7")); |
400 | 418 | ||
401 | if (link != null && hasLongContent(link)) | 419 | if (link != null && hasLongContent(link)) |
402 | occurrences.add(this.buildOccurrence("3.5", false, | 420 | occurrences.add(this.buildOccurrence("3.5", false, |
403 | - link.toString(), link, "9")); | 421 | + link.toString(), link, "13"));//"9")); |
404 | 422 | ||
405 | if (link != null && isLinkUnavailable(link, getUrl())) | 423 | if (link != null && isLinkUnavailable(link, getUrl())) |
406 | occurrences.add(this.buildOccurrence("3.5", true, | 424 | occurrences.add(this.buildOccurrence("3.5", true, |
407 | - link.toString(), link, "10")); | 425 | + link.toString(), link, "14"));//"10")); |
408 | 426 | ||
409 | } | 427 | } |
410 | return occurrences; | 428 | return occurrences; |
@@ -494,13 +512,29 @@ public class ContentEvaluation extends Evaluation { | @@ -494,13 +512,29 @@ public class ContentEvaluation extends Evaluation { | ||
494 | return link.getContent().getTextExtractor().toString().length() > 500 ? true | 512 | return link.getContent().getTextExtractor().toString().length() > 500 ? true |
495 | : false; | 513 | : false; |
496 | } | 514 | } |
497 | - | 515 | + |
516 | + | ||
498 | private boolean hasContent(Element link) { | 517 | private boolean hasContent(Element link) { |
499 | - | ||
500 | - int quantidadeElementosDentroLink = 0; | 518 | + |
501 | boolean temConteudo; | 519 | boolean temConteudo; |
502 | 520 | ||
503 | - quantidadeElementosDentroLink = link.getAllElements().size(); | 521 | + |
522 | + temConteudo = StringUtils.isNotBlank(link.getContent().getTextExtractor().toString()); | ||
523 | + | ||
524 | + if(!temConteudo) | ||
525 | + { | ||
526 | + for (Element elemento : link.getAllElements()) { | ||
527 | + temConteudo = StringUtils.isNotBlank(elemento.getContent().getTextExtractor().toString()); | ||
528 | + | ||
529 | + if(temConteudo) | ||
530 | + { | ||
531 | + break; | ||
532 | + } | ||
533 | + } | ||
534 | + } | ||
535 | + return temConteudo; | ||
536 | + | ||
537 | +/* quantidadeElementosDentroLink = link.getAllElements().size(); | ||
504 | //Verifica se há elementos como img, span e outros dentro do link. o valor 1 já está atribuído a tag <a> (link avaliado) | 538 | //Verifica se há elementos como img, span e outros dentro do link. o valor 1 já está atribuído a tag <a> (link avaliado) |
505 | if(quantidadeElementosDentroLink > 1) | 539 | if(quantidadeElementosDentroLink > 1) |
506 | { | 540 | { |
@@ -511,7 +545,7 @@ public class ContentEvaluation extends Evaluation { | @@ -511,7 +545,7 @@ public class ContentEvaluation extends Evaluation { | ||
511 | { | 545 | { |
512 | temConteudo = StringUtils.isNotBlank(link.getContent().getTextExtractor().toString()); | 546 | temConteudo = StringUtils.isNotBlank(link.getContent().getTextExtractor().toString()); |
513 | } | 547 | } |
514 | - return temConteudo; | 548 | + return temConteudo;*/ |
515 | } | 549 | } |
516 | 550 | ||
517 | private boolean hasTitle(Element link) { | 551 | private boolean hasTitle(Element link) { |
@@ -519,6 +553,28 @@ public class ContentEvaluation extends Evaluation { | @@ -519,6 +553,28 @@ public class ContentEvaluation extends Evaluation { | ||
519 | return title != null && StringUtils.isNotBlank(title); | 553 | return title != null && StringUtils.isNotBlank(title); |
520 | } | 554 | } |
521 | 555 | ||
556 | + | ||
557 | + | ||
558 | + private boolean hasLinkComImgWithoutAlt(Element link) { | ||
559 | + | ||
560 | + boolean temImgSemAlt = false; | ||
561 | + | ||
562 | + String alt; | ||
563 | + | ||
564 | + for (Element elementoImagem : link.getAllElements("img")) { | ||
565 | + | ||
566 | + alt = elementoImagem.getAttributeValue("alt"); | ||
567 | + temImgSemAlt = (alt == null || StringUtils.isBlank(alt)); | ||
568 | + if(!temImgSemAlt) | ||
569 | + { | ||
570 | + break; | ||
571 | + } | ||
572 | + } | ||
573 | + | ||
574 | + | ||
575 | + return temImgSemAlt; | ||
576 | + } | ||
577 | + | ||
522 | private boolean hasImgWithoutAlt(Element link) { | 578 | private boolean hasImgWithoutAlt(Element link) { |
523 | Element img = link.getFirstElement("img"); | 579 | Element img = link.getFirstElement("img"); |
524 | if (img == null) | 580 | if (img == null) |
@@ -526,7 +582,7 @@ public class ContentEvaluation extends Evaluation { | @@ -526,7 +582,7 @@ public class ContentEvaluation extends Evaluation { | ||
526 | String alt = img.getAttributeValue("alt"); | 582 | String alt = img.getAttributeValue("alt"); |
527 | return alt == null || StringUtils.isBlank(alt); | 583 | return alt == null || StringUtils.isBlank(alt); |
528 | } | 584 | } |
529 | - | 585 | + |
530 | private boolean hasLeiaMaisDescription(Element link) { | 586 | private boolean hasLeiaMaisDescription(Element link) { |
531 | String title = link.getAttributeValue("title"); | 587 | String title = link.getAttributeValue("title"); |
532 | String content = link.getContent().getTextExtractor().toString(); | 588 | String content = link.getContent().getTextExtractor().toString(); |
@@ -746,7 +802,7 @@ public class ContentEvaluation extends Evaluation { | @@ -746,7 +802,7 @@ public class ContentEvaluation extends Evaluation { | ||
746 | "3.6", | 802 | "3.6", |
747 | false, | 803 | false, |
748 | imgA.toString(), | 804 | imgA.toString(), |
749 | - imgA, "5")); | 805 | + imgA, "7"));//"5")); |
750 | aMap.put(srcAtt.getValue(), img); | 806 | aMap.put(srcAtt.getValue(), img); |
751 | isVerificado = true; | 807 | isVerificado = true; |
752 | } | 808 | } |
@@ -762,7 +818,7 @@ public class ContentEvaluation extends Evaluation { | @@ -762,7 +818,7 @@ public class ContentEvaluation extends Evaluation { | ||
762 | 818 | ||
763 | if (isVerificado) | 819 | if (isVerificado) |
764 | occurrences.add(buildOccurrence("3.6", false, | 820 | occurrences.add(buildOccurrence("3.6", false, |
765 | - img.toString(), img, "5")); | 821 | + img.toString(), img, "7"));//"5")); |
766 | } | 822 | } |
767 | } | 823 | } |
768 | 824 | ||
@@ -788,7 +844,7 @@ public class ContentEvaluation extends Evaluation { | @@ -788,7 +844,7 @@ public class ContentEvaluation extends Evaluation { | ||
788 | if (alt != null && title != null) { | 844 | if (alt != null && title != null) { |
789 | if (title.getValue().equals(alt.getValue())) | 845 | if (title.getValue().equals(alt.getValue())) |
790 | occurrences.add(buildOccurrence("3.6", true, | 846 | occurrences.add(buildOccurrence("3.6", true, |
791 | - img.toString(), img, "6")); | 847 | + img.toString(), img, "8"));//"6")); |
792 | } | 848 | } |
793 | } | 849 | } |
794 | 850 | ||
@@ -974,9 +1030,9 @@ public class ContentEvaluation extends Evaluation { | @@ -974,9 +1030,9 @@ public class ContentEvaluation extends Evaluation { | ||
974 | * paragrafo.toString(), paragrafo, "1")); } | 1030 | * paragrafo.toString(), paragrafo, "1")); } |
975 | */ | 1031 | */ |
976 | 1032 | ||
977 | - if (paragrafo.getContent().length() > 1000) | 1033 | + /*if (paragrafo.getContent().length() > 1000) |
978 | occurrences.add(this.buildOccurrence("3.11", false, | 1034 | occurrences.add(this.buildOccurrence("3.11", false, |
979 | - paragrafo.toString(), paragrafo, "1")); | 1035 | + paragrafo.toString(), paragrafo, "1"));*/ //comentado por Gibran |
980 | 1036 | ||
981 | String align = paragrafo.getAttributeValue("align"); | 1037 | String align = paragrafo.getAttributeValue("align"); |
982 | if ("justify".equals(align)) | 1038 | if ("justify".equals(align)) |
src/main/java/br/com/checker/emag/core/MarkEvaluation.java
@@ -13,6 +13,8 @@ import net.htmlparser.jericho.Element; | @@ -13,6 +13,8 @@ import net.htmlparser.jericho.Element; | ||
13 | import net.htmlparser.jericho.Source; | 13 | import net.htmlparser.jericho.Source; |
14 | 14 | ||
15 | import org.apache.commons.lang3.StringUtils; | 15 | import org.apache.commons.lang3.StringUtils; |
16 | +import org.w3c.dom.Document; | ||
17 | + | ||
16 | 18 | ||
17 | import br.com.checker.emag.Occurrence; | 19 | import br.com.checker.emag.Occurrence; |
18 | import br.com.checker.emag.OccurrenceClassification; | 20 | import br.com.checker.emag.OccurrenceClassification; |
@@ -236,6 +238,8 @@ public class MarkEvaluation extends Evaluation { | @@ -236,6 +238,8 @@ public class MarkEvaluation extends Evaluation { | ||
236 | return occurrences; | 238 | return occurrences; |
237 | } | 239 | } |
238 | 240 | ||
241 | + | ||
242 | + | ||
239 | private List<Occurrence> checkRecommendation2() { | 243 | private List<Occurrence> checkRecommendation2() { |
240 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); | 244 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); |
241 | 245 | ||
@@ -306,7 +310,7 @@ public class MarkEvaluation extends Evaluation { | @@ -306,7 +310,7 @@ public class MarkEvaluation extends Evaluation { | ||
306 | 310 | ||
307 | if (!linhasImg.contains(this.getRow(img))) { | 311 | if (!linhasImg.contains(this.getRow(img))) { |
308 | occurrences.add(this.buildOccurrence("1.2", | 312 | occurrences.add(this.buildOccurrence("1.2", |
309 | - false, img.toString(), img, "1")); | 313 | + false, img.toString(), img, "3")); //"1")); |
310 | } | 314 | } |
311 | 315 | ||
312 | linhasImg.add(this.getRow(img)); | 316 | linhasImg.add(this.getRow(img)); |
@@ -320,7 +324,7 @@ public class MarkEvaluation extends Evaluation { | @@ -320,7 +324,7 @@ public class MarkEvaluation extends Evaluation { | ||
320 | .equals("")) { | 324 | .equals("")) { |
321 | occurrences.add(this.buildOccurrence("1.2", | 325 | occurrences.add(this.buildOccurrence("1.2", |
322 | false, element.getStartTag().toString() | 326 | false, element.getStartTag().toString() |
323 | - + endTag, element, "1")); | 327 | + + endTag, element, "3"));//"1")); |
324 | } | 328 | } |
325 | } | 329 | } |
326 | } | 330 | } |
@@ -359,7 +363,7 @@ public class MarkEvaluation extends Evaluation { | @@ -359,7 +363,7 @@ public class MarkEvaluation extends Evaluation { | ||
359 | for (Element element : getDocument().getAllElements("h1")) { | 363 | for (Element element : getDocument().getAllElements("h1")) { |
360 | 364 | ||
361 | occurrences.add(this.buildOccurrence("1.3", true, | 365 | occurrences.add(this.buildOccurrence("1.3", true, |
362 | - element.toString(), element, "4")); | 366 | + element.toString(), element, "6"));//"4")); |
363 | } | 367 | } |
364 | } | 368 | } |
365 | 369 | ||
@@ -381,7 +385,7 @@ public class MarkEvaluation extends Evaluation { | @@ -381,7 +385,7 @@ public class MarkEvaluation extends Evaluation { | ||
381 | if (count > 0 && !hasOtherH) | 385 | if (count > 0 && !hasOtherH) |
382 | occurrences.add(this.buildOccurrence("1.3", false, getDocument() | 386 | occurrences.add(this.buildOccurrence("1.3", false, getDocument() |
383 | .getFirstElement("h1").toString(), getDocument() | 387 | .getFirstElement("h1").toString(), getDocument() |
384 | - .getFirstElement("h1"), "3")); | 388 | + .getFirstElement("h1"), "4"));//"3")); |
385 | 389 | ||
386 | // CRITERIO 2 | 390 | // CRITERIO 2 |
387 | 391 | ||
@@ -471,11 +475,11 @@ public class MarkEvaluation extends Evaluation { | @@ -471,11 +475,11 @@ public class MarkEvaluation extends Evaluation { | ||
471 | Attribute tabIndex = link.getAttributes().get("tabindex"); | 475 | Attribute tabIndex = link.getAttributes().get("tabindex"); |
472 | if (tabIndex != null) { | 476 | if (tabIndex != null) { |
473 | occurrences.add(this.buildOccurrence("1.4", false, | 477 | occurrences.add(this.buildOccurrence("1.4", false, |
474 | - link.toString(), link, "2")); | 478 | + link.toString(), link, "3"));//"2")); |
475 | 479 | ||
476 | if (rangeIncorretoTabeIndex(tabIndex)) | 480 | if (rangeIncorretoTabeIndex(tabIndex)) |
477 | occurrences.add(this.buildOccurrence("1.4", false, | 481 | occurrences.add(this.buildOccurrence("1.4", false, |
478 | - link.toString(), link, "3")); | 482 | + link.toString(), link, "6"));//"3")); |
479 | } | 483 | } |
480 | } | 484 | } |
481 | 485 | ||
@@ -484,11 +488,11 @@ public class MarkEvaluation extends Evaluation { | @@ -484,11 +488,11 @@ public class MarkEvaluation extends Evaluation { | ||
484 | Attribute tabIndex = input.getAttributes().get("tabindex"); | 488 | Attribute tabIndex = input.getAttributes().get("tabindex"); |
485 | if (tabIndex != null) | 489 | if (tabIndex != null) |
486 | occurrences.add(this.buildOccurrence("1.4", false, | 490 | occurrences.add(this.buildOccurrence("1.4", false, |
487 | - input.toString(), input, "2")); | 491 | + input.toString(), input, "3"));//"2")); |
488 | 492 | ||
489 | if (rangeIncorretoTabeIndex(tabIndex)) | 493 | if (rangeIncorretoTabeIndex(tabIndex)) |
490 | occurrences.add(this.buildOccurrence("1.4", false, | 494 | occurrences.add(this.buildOccurrence("1.4", false, |
491 | - input.toString(), input, "3")); | 495 | + input.toString(), input, "6"));//"3")); |
492 | } | 496 | } |
493 | 497 | ||
494 | for (Element select : this.getDocument().getAllElements("select")) { | 498 | for (Element select : this.getDocument().getAllElements("select")) { |
@@ -496,11 +500,11 @@ public class MarkEvaluation extends Evaluation { | @@ -496,11 +500,11 @@ public class MarkEvaluation extends Evaluation { | ||
496 | Attribute tabIndex = select.getAttributes().get("tabindex"); | 500 | Attribute tabIndex = select.getAttributes().get("tabindex"); |
497 | if (tabIndex != null) | 501 | if (tabIndex != null) |
498 | occurrences.add(this.buildOccurrence("1.4", false, | 502 | occurrences.add(this.buildOccurrence("1.4", false, |
499 | - select.toString(), select, "2")); | 503 | + select.toString(), select, "3"));//"2")); |
500 | 504 | ||
501 | if (rangeIncorretoTabeIndex(tabIndex)) | 505 | if (rangeIncorretoTabeIndex(tabIndex)) |
502 | occurrences.add(this.buildOccurrence("1.4", false, | 506 | occurrences.add(this.buildOccurrence("1.4", false, |
503 | - select.toString(), select, "3")); | 507 | + select.toString(), select, "6"));//"3")); |
504 | } | 508 | } |
505 | 509 | ||
506 | for (Element textarea : this.getDocument().getAllElements("textarea")) { | 510 | for (Element textarea : this.getDocument().getAllElements("textarea")) { |
@@ -508,11 +512,11 @@ public class MarkEvaluation extends Evaluation { | @@ -508,11 +512,11 @@ public class MarkEvaluation extends Evaluation { | ||
508 | Attribute tabIndex = textarea.getAttributes().get("tabindex"); | 512 | Attribute tabIndex = textarea.getAttributes().get("tabindex"); |
509 | if (tabIndex != null) | 513 | if (tabIndex != null) |
510 | occurrences.add(this.buildOccurrence("1.4", false, | 514 | occurrences.add(this.buildOccurrence("1.4", false, |
511 | - textarea.toString(), textarea, "2")); | 515 | + textarea.toString(), textarea, "3"));//"2")); |
512 | 516 | ||
513 | if (rangeIncorretoTabeIndex(tabIndex)) | 517 | if (rangeIncorretoTabeIndex(tabIndex)) |
514 | occurrences.add(this.buildOccurrence("1.4", false, | 518 | occurrences.add(this.buildOccurrence("1.4", false, |
515 | - textarea.toString(), textarea, "3")); | 519 | + textarea.toString(), textarea, "6"));//"3")); |
516 | } | 520 | } |
517 | 521 | ||
518 | /* | 522 | /* |
@@ -577,7 +581,7 @@ public class MarkEvaluation extends Evaluation { | @@ -577,7 +581,7 @@ public class MarkEvaluation extends Evaluation { | ||
577 | if (contLink != null && contLink.length() > 1 | 581 | if (contLink != null && contLink.length() > 1 |
578 | && contLink.substring(0, 1).equals("#")) { | 582 | && contLink.substring(0, 1).equals("#")) { |
579 | occurrences.add(this.buildOccurrence("1.5", false, | 583 | occurrences.add(this.buildOccurrence("1.5", false, |
580 | - link.toString(), link, "4")); | 584 | + link.toString(), link, "10"));//"4")); |
581 | break; | 585 | break; |
582 | } | 586 | } |
583 | 587 | ||
@@ -731,13 +735,13 @@ public class MarkEvaluation extends Evaluation { | @@ -731,13 +735,13 @@ public class MarkEvaluation extends Evaluation { | ||
731 | "1.5", | 735 | "1.5", |
732 | true, | 736 | true, |
733 | "Observação - Sem fonte ( não existe(m) accesskey(s) na página)", | 737 | "Observação - Sem fonte ( não existe(m) accesskey(s) na página)", |
734 | - getDocument().getFirstElement(), "3")); | 738 | + getDocument().getFirstElement(), "4"));//"3")); |
735 | 739 | ||
736 | for (Element elemento : getDocument().getAllElements("accesskey", | 740 | for (Element elemento : getDocument().getAllElements("accesskey", |
737 | Pattern.compile(".*"))) { | 741 | Pattern.compile(".*"))) { |
738 | if (duplicatedAcessKey(elemento)) | 742 | if (duplicatedAcessKey(elemento)) |
739 | occurrences.add(this.buildOccurrence("1.5", false, | 743 | occurrences.add(this.buildOccurrence("1.5", false, |
740 | - elemento.toString(), elemento, "5")); | 744 | + elemento.toString(), elemento, "11"));//"5")); |
741 | } | 745 | } |
742 | 746 | ||
743 | this.oder(occurrences); | 747 | this.oder(occurrences); |
@@ -858,6 +862,7 @@ public class MarkEvaluation extends Evaluation { | @@ -858,6 +862,7 @@ public class MarkEvaluation extends Evaluation { | ||
858 | return occurrences; | 862 | return occurrences; |
859 | } | 863 | } |
860 | 864 | ||
865 | + | ||
861 | public List<Occurrence> checkRecommendation8() { | 866 | public List<Occurrence> checkRecommendation8() { |
862 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); | 867 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); |
863 | Element firstElement = this.getDocument().getFirstElement(); | 868 | Element firstElement = this.getDocument().getFirstElement(); |
@@ -867,7 +872,7 @@ public class MarkEvaluation extends Evaluation { | @@ -867,7 +872,7 @@ public class MarkEvaluation extends Evaluation { | ||
867 | Element header = getDocument().getFirstElement("header"); | 872 | Element header = getDocument().getFirstElement("header"); |
868 | Element nav = getDocument().getFirstElement("nav"); | 873 | Element nav = getDocument().getFirstElement("nav"); |
869 | Element section = getDocument().getFirstElement("section"); | 874 | Element section = getDocument().getFirstElement("section"); |
870 | - Element footer = getDocument().getFirstElement("footer"); | 875 | + Element footer = getDocument().getFirstElement("footer"); |
871 | 876 | ||
872 | if (header == null) | 877 | if (header == null) |
873 | occurrences | 878 | occurrences |
@@ -876,7 +881,7 @@ public class MarkEvaluation extends Evaluation { | @@ -876,7 +881,7 @@ public class MarkEvaluation extends Evaluation { | ||
876 | "1.8", | 881 | "1.8", |
877 | false, | 882 | false, |
878 | "Observação - Sem fonte (Não existe tag <HEADER>)", | 883 | "Observação - Sem fonte (Não existe tag <HEADER>)", |
879 | - getDocument().getFirstElement(), "1")); | 884 | + getDocument().getFirstElement(), "3"));//"1")); |
880 | 885 | ||
881 | if (nav == null) | 886 | if (nav == null) |
882 | occurrences | 887 | occurrences |
@@ -885,7 +890,7 @@ public class MarkEvaluation extends Evaluation { | @@ -885,7 +890,7 @@ public class MarkEvaluation extends Evaluation { | ||
885 | "1.8", | 890 | "1.8", |
886 | false, | 891 | false, |
887 | "Observação - Sem fonte (Não existe tag <NAV>)", | 892 | "Observação - Sem fonte (Não existe tag <NAV>)", |
888 | - getDocument().getFirstElement(), "1")); | 893 | + getDocument().getFirstElement(), "3"));//"1")); |
889 | 894 | ||
890 | if (section == null) | 895 | if (section == null) |
891 | occurrences | 896 | occurrences |
@@ -894,7 +899,7 @@ public class MarkEvaluation extends Evaluation { | @@ -894,7 +899,7 @@ public class MarkEvaluation extends Evaluation { | ||
894 | "1.8", | 899 | "1.8", |
895 | false, | 900 | false, |
896 | "Observação - Sem fonte (Não existe tag <SECTION>)", | 901 | "Observação - Sem fonte (Não existe tag <SECTION>)", |
897 | - getDocument().getFirstElement(), "1")); | 902 | + getDocument().getFirstElement(), "3"));//"1")); |
898 | 903 | ||
899 | if (footer == null) | 904 | if (footer == null) |
900 | occurrences | 905 | occurrences |
@@ -903,7 +908,7 @@ public class MarkEvaluation extends Evaluation { | @@ -903,7 +908,7 @@ public class MarkEvaluation extends Evaluation { | ||
903 | "1.8", | 908 | "1.8", |
904 | false, | 909 | false, |
905 | "Observação - Sem fonte (Não existe tag <FOOTER>)", | 910 | "Observação - Sem fonte (Não existe tag <FOOTER>)", |
906 | - getDocument().getFirstElement(), "1")); | 911 | + getDocument().getFirstElement(), "3"));//"1")); |
907 | 912 | ||
908 | } else { | 913 | } else { |
909 | 914 | ||
@@ -925,7 +930,8 @@ public class MarkEvaluation extends Evaluation { | @@ -925,7 +930,8 @@ public class MarkEvaluation extends Evaluation { | ||
925 | if (hasBanner && hasNavigation && hasMain) | 930 | if (hasBanner && hasNavigation && hasMain) |
926 | break; | 931 | break; |
927 | } | 932 | } |
928 | - | 933 | +/*//comentado por Gibran |
934 | + * | ||
929 | if (!hasBanner) | 935 | if (!hasBanner) |
930 | occurrences | 936 | occurrences |
931 | .add(this | 937 | .add(this |
@@ -951,7 +957,7 @@ public class MarkEvaluation extends Evaluation { | @@ -951,7 +957,7 @@ public class MarkEvaluation extends Evaluation { | ||
951 | "1.8", | 957 | "1.8", |
952 | false, | 958 | false, |
953 | "Observação - Sem fonte (Não existe tag com atributo ROLE e conteúdo MAIN)", | 959 | "Observação - Sem fonte (Não existe tag com atributo ROLE e conteúdo MAIN)", |
954 | - getDocument().getFirstElement(), "2")); | 960 | + getDocument().getFirstElement(), "2"));*/ //comentado por Gibran |
955 | 961 | ||
956 | } | 962 | } |
957 | 963 | ||
@@ -1034,6 +1040,7 @@ public class MarkEvaluation extends Evaluation { | @@ -1034,6 +1040,7 @@ public class MarkEvaluation extends Evaluation { | ||
1034 | 1040 | ||
1035 | } | 1041 | } |
1036 | } catch (Exception e) { | 1042 | } catch (Exception e) { |
1043 | + | ||
1037 | e.printStackTrace(); | 1044 | e.printStackTrace(); |
1038 | } | 1045 | } |
1039 | 1046 |
src/main/java/br/com/checker/emag/core/PresentationEvaluation.java
@@ -55,7 +55,7 @@ public class PresentationEvaluation extends Evaluation{ | @@ -55,7 +55,7 @@ public class PresentationEvaluation extends Evaluation{ | ||
55 | 55 | ||
56 | public List<Occurrence> check() { | 56 | public List<Occurrence> check() { |
57 | getOccurrences().clear(); | 57 | getOccurrences().clear(); |
58 | - getOccurrences().addAll(checkRecommendation29()); | 58 | + //getOccurrences().addAll(checkRecommendation29()); |
59 | getOccurrences().addAll(checkRecommendation30()); | 59 | getOccurrences().addAll(checkRecommendation30()); |
60 | getOccurrences().addAll(checkRecommendation31()); | 60 | getOccurrences().addAll(checkRecommendation31()); |
61 | getOccurrences().addAll(checkRecommendation32()); | 61 | getOccurrences().addAll(checkRecommendation32()); |