Maven Checkstyle Plugin
  1. Maven Checkstyle Plugin
  2. MCHECKSTYLE-153

Checkstyle doesn't run on projects containing only test classes

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.7
    • Component/s: None
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Description

      We discovered that if a project only contains test classes and no "normal" classes, the canGenerateReport() function returns false, as it only checks for the existence of the sourceDirectory path. If includeTestSourceDirectory is set to true, the function should also check for the existence of the testSourceDirectory path.

      Here's an example patch to the method:

      public boolean canGenerateReport()

      { // TODO: would be good to scan the files here return sourceDirectory.exists() || (includeTestSourceDirectory && testSourceDirectory.exists()); }

        Issue Links

          Activity

          Hide
          Bruce Mackenzie Nielsen added a comment -

          Apologies for the poor formatting, here's the function again.

          public boolean canGenerateReport()
              {
                  // TODO: would be good to scan the files here
                  return sourceDirectory.exists() || (includeTestSourceDirectory && testSourceDirectory.exists());
              }
          
          Show
          Bruce Mackenzie Nielsen added a comment - Apologies for the poor formatting, here's the function again. public boolean canGenerateReport() { // TODO: would be good to scan the files here return sourceDirectory.exists() || (includeTestSourceDirectory && testSourceDirectory.exists()); }
          Hide
          Dennis Lundberg added a comment -

          Patch applied in r1092498.

          Thanks!

          New 2.7-SNAPSHOT deployed. Please test it.

          Show
          Dennis Lundberg added a comment - Patch applied in r1092498 . Thanks! New 2.7-SNAPSHOT deployed. Please test it.

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              Bruce Mackenzie Nielsen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: