Package hudson.plugins.dry.parser

Examples of hudson.plugins.dry.parser.DuplicateCode


        int number = random.nextInt();
        for (Duplication duplication : duplications) {
            List<DuplicateCode> codeBlocks = new ArrayList<DuplicateCode>();
            for (SourceFile file : duplication.getFiles()) {
                // TODO: check why PMD reports a length + 1
                DuplicateCode annotation = new DuplicateCode(getPriority(duplication.getLines()), file.getLine(), duplication.getLines(), file.getPath());
                annotation.setSourceCode(duplication.getCodeFragment());
                annotation.setModuleName(moduleName);
                codeBlocks.add(annotation);
            }
            for (DuplicateCode block : codeBlocks) {
                block.linkTo(codeBlocks);
                block.setNumber(number);
View Full Code Here


        Collection<DuplicateCode> annotations = parseFile(fileName);

        assertEquals(ERROR_MESSAGE, 2, annotations.size());

        Iterator<DuplicateCode> iterator = annotations.iterator();
        DuplicateCode first = iterator.next();
        DuplicateCode second = iterator.next();

        assertEquals(WRONG_WARNING_PROPERTY, SOURCECODE, first.getSourceCode());
        assertEquals(WRONG_WARNING_PROPERTY, SOURCECODE, second.getSourceCode());

        if (first.getPrimaryLineNumber() == REPORTER_LINE) {
            assertDuplication(REPORTER_LINE, REPORTER, first);
            assertDuplication(PUBLISHER_LINE, PUBLISHER, second);
        }
View Full Code Here

        Collection<DuplicateCode> annotations = parseFile(fileName);

        assertEquals(ERROR_MESSAGE, 2, annotations.size());

        Iterator<DuplicateCode> iterator = annotations.iterator();
        DuplicateCode first = iterator.next();
        DuplicateCode second = iterator.next();

        assertEquals(WRONG_WARNING_PROPERTY, null, first.getSourceCode());
        assertEquals(WRONG_WARNING_PROPERTY, null, second.getSourceCode());

        if (first.getPrimaryLineNumber() == REPORTER_LINE) {
            assertDuplication(REPORTER_LINE, REPORTER, first);
            assertDuplication(PUBLISHER_LINE, PUBLISHER, second);
        }
View Full Code Here

        Random random = new Random();
        int number = random.nextInt();
        for (Set duplication : duplications) {
            List<DuplicateCode> codeBlocks = new ArrayList<DuplicateCode>();
            for (Block file : duplication.getBlocks()) {
                DuplicateCode annotation = new DuplicateCode(getPriority(duplication.getLineCount()), file.getStartLineNumber(), duplication.getLineCount(), file.getSourceFile());
                annotation.setModuleName(moduleName);
                codeBlocks.add(annotation);
            }
            for (DuplicateCode block : codeBlocks) {
                block.linkTo(codeBlocks);
                block.setNumber(number);
View Full Code Here

        Collection<DuplicateCode> annotations = parseFile(fileName);

        assertEquals(ERROR_MESSAGE, 2, annotations.size());

        Iterator<DuplicateCode> iterator = annotations.iterator();
        DuplicateCode first = iterator.next();
        DuplicateCode second = iterator.next();

        if (first.getPrimaryLineNumber() == REPORTER_LINE) {
            assertDuplication(REPORTER_LINE, REPORTER, first);
            assertDuplication(PUBLISHER_LINE, PUBLISHER, second);
        }
View Full Code Here

        Collection<DuplicateCode> annotations = parseFile(fileName);
        assertEquals(ERROR_MESSAGE, 4, annotations.size());

        Iterator<DuplicateCode> iterator = annotations.iterator();
        DuplicateCode warning;

        warning = iterator.next();
        assertDuplication(92, 107, MAVEN_BUILD, warning);
        assertEquals("Wrong other file", MATRIX_RUN, getFileName(warning));
View Full Code Here

            List<DuplicateCode> codeBlocks = new ArrayList<DuplicateCode>();
            Collection<Fragment> fragments = duplication.getFragments();
            for (Fragment fragment : fragments) {
                Range lineRange = fragment.getLineRange();
                int count = lineRange.getEnd() - lineRange.getStart() + 1;
                DuplicateCode annotation = new DuplicateCode(getPriority(count), lineRange.getStart(), count,
                        fragment.getFileName());
                String text = fragment.getText();
                if (text != null) {
                    annotation.setSourceCode(text);
                }
                annotation.setModuleName(moduleName);
                codeBlocks.add(annotation);
            }
            for (DuplicateCode block : codeBlocks) {
                block.linkTo(codeBlocks);
                block.setNumber(number);
View Full Code Here

TOP

Related Classes of hudson.plugins.dry.parser.DuplicateCode

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.