Skip to content

Make license checks more relaxedΒ #11

@radarsh

Description

@radarsh

Is there anyway to make the license checks a bit more relaxed? For instance, ignore parts of the template based on some condition / expression. We have a large number of source files which were created in 2018 with a header containing the copyright year as follows:

Copyright (c) Example, 2018. All rights reserved.

This is generated using the template

Copyright (c) Example, ${year}. All rights reserved.

Now starting 1/1/2019, all our builds are failing because the year in the file header does not match the current year. So we're left with two unattractive options now:

  1. Disable failing the build by setting ignoreFailures = true but this is a bit brute force and it doesn't fail the build when there are new files without license headers.
  2. Update the year in every single source file which is not ideal and means every file in every project needs to have a new year at the beginning of every year.

My proposal is have a separate DSL for configuring the checks where we can specifically exclude certain variables from it. To start with, maybe something like:

license {
    ext.year = LocalDate.now().year
    sourceSets = [project.sourceSets.main]
    
+    checks {
+        ignoreVariables = ['year']
+    }
}

Appreciate the time and effort you have put into this plugin.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions