Giter Site home page Giter Site logo

Comments (3)

jsotuyod avatar jsotuyod commented on June 3, 2024

Back in PMD 6.55.0 if, the container class had any of the ignored annotations, all methods were ignored (and therefore the @Nested implied plurals() was not flagged).

This behavior was removed in PMD 7.0.0. Based on the documentation for the rule and existing tests, this behavior was not intended, and actually a false-negative. Moreover, @MethodSource doesn't impose any requirements on method visibility that I am aware of, unlike @Test which under JUnit 5 expects package-private to be used prominently.

from pmd.

inkarkat avatar inkarkat commented on June 3, 2024

Test methods default to package-private because visibility isn't much of a concern with tests (there's little inheritance and as non-production code this isn't critical, anyway), so readability (i.e. no clutter, no /* default */ comment) trumps minimal visibility.
IMO that reasoning not just applies to test methods, but also nested test classes, methods that supply arguments to parameterized tests, and any other goodie that has been added (in JUnit 5).

If PMD is forcing users to tweak its default rules for test classes, I think that's unfortunate, especially because complex XPath expressions have to be used (targeting the (outer) test class name, but also including any nested test classes). Many projects adhere to Maven's file system structure (i.e. separation of test classes in src/test vs. src/main); it would be really great if PMD allowed exclusions based on that distinction.

from pmd.

adangel avatar adangel commented on June 3, 2024

@Wolf2323 you can make the method plurals() private. See also #4975, which has exactly this example. PMD 7.2.0 won't warn about such private methods anymore.

from pmd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.