<commit_before>package de.codescape.bitvunit.rule.page;

import de.codescape.bitvunit.model.Page;
import de.codescape.bitvunit.rule.AbstractRule;
import de.codescape.bitvunit.rule.Violations;
import org.w3c.dom.DocumentType;

/**
 * DoctypeForPageRule ensures that every page includes a <code>&lt;!DOCTYPE /&gt;</code> element to support rendering
 * and validation of this page by browsers and other viewers or interpreters.
 *
 * @author <NAME>
 * @since 0.10
 */
public class DoctypeForPageRule extends AbstractRule {

    private static final String RULE_NAME = "DoctypeForPage";
    private static final String RULE_MESSAGE = "Every page must include a DOCTYPE declaration to support rendering and validation.";

    @Override
    public String getName() {
        return RULE_NAME;
    }

    @Override
    protected void applyTo(Page page, Violations violations) {
        DocumentType doctype = page.getDoctype();
        if (doctype == null) {
            violations.add(createViolation(null, page, RULE_MESSAGE));
        }
    }

}<commit_msg>add known issue and refactor code<commit_after>package de.codescape.bitvunit.rule.page;

import de.codescape.bitvunit.model.Page;
import de.codescape.bitvunit.rule.AbstractRule;
import de.codescape.bitvunit.rule.Violations;

/**
 * DoctypeForPageRule ensures that every page includes a <code>&lt;!DOCTYPE /&gt;</code> element to support rendering
 * and validation of this page by browsers and other viewers or interpreters.
 * <p/>
 * Known issue: Instances of WebDriver do not know about the DOCTYPE of the original document. So this rule cannot be
 * applied successfully.
 *
 * @author <NAME>
 * @since 0.10
 */
public class DoctypeForPageRule extends AbstractRule {

    private static final String RULE_NAME = "DoctypeForPage";
    private static final String RULE_MESSAGE = "Every page must include a DOCTYPE declaration to support rendering and validation.";

    @Override
    public String getName() {
        return RULE_NAME;
    }

    @Override
    protected void applyTo(Page page, Violations violations) {
        if (page.getDoctype() == null) {
            violations.add(createViolation(null, page, RULE_MESSAGE));
        }
    }

}
{'fraction_non_alphanumeric': 0.0883952855847688, 'fraction_numerical': 0.003173164097914778, 'mean_word_length': 3.725910064239829, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '537492', 'n_tokens_mistral': 666, 'n_tokens_neox': 630, 'n_words': 202}