Menu

#144 CodeNarc can't evaluate class with GContracts

None
closed
None
5
2014-10-01
2013-10-09
Ei Kageyama
No
class CodenarcViolationService {
    def violate(arg) {
        println 'foo bar'
    }
}

-> Println Violation

import org.gcontracts.annotations.Requires
class CodenarcViolationService {
    @Requires({arg})
    def violate(arg) {
        println 'foo bar'
    }
}

-> No Violation

Discussion

  • Chris Mair

    Chris Mair - 2014-03-30

    I am so far unable to reproduce this problem. I added the test below to PrintlnRuleTest, and it produces the violation as expected.

    @Test
    void testApplyTo_Println_AnnotatedMethod() {
        final SOURCE = '''
            import org.gcontracts.annotations.Requires
            class CodenarcViolationService {
                @Requires({arg})
                def violate(arg) {
                    println 'foo bar'
                }
            }
            '''
        assertSingleViolation(SOURCE, 6, "println 'foo bar'")
    }
    
     
  • Chris Mair

    Chris Mair - 2014-10-01

    Please reopen if this problem can be reproduced.

     
  • Chris Mair

    Chris Mair - 2014-10-01
    • status: open --> closed
    • assigned_to: Chris Mair
    • Group: -->
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.