diff --git a/wpiformat/test/test_licenseupdate.py b/wpiformat/test/test_licenseupdate.py index 7f046575..339a1419 100644 --- a/wpiformat/test/test_licenseupdate.py +++ b/wpiformat/test/test_licenseupdate.py @@ -27,7 +27,7 @@ def __exit__(self, type, value, traceback): def test_licenseupdate(): year = str(date.today().year) - task = LicenseUpdate(year) + task = LicenseUpdate() test = TaskTest(task) file_appendix = \ diff --git a/wpiformat/wpiformat/__init__.py b/wpiformat/wpiformat/__init__.py index 4334cef4..74811a8f 100644 --- a/wpiformat/wpiformat/__init__.py +++ b/wpiformat/wpiformat/__init__.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import argparse -from datetime import date import math import multiprocessing as mp import os @@ -235,13 +234,6 @@ def main(): type=int, default=mp.cpu_count(), help="number of jobs to run (default is number of cores)") - parser.add_argument( - "-y", - dest="year", - type=int, - default=date.today().year, - help= - "year to use when updating license headers (default is current year)") parser.add_argument( "-clang", dest="clang_version", @@ -352,7 +344,7 @@ def main(): BraceComment(), CIdentList(), IncludeGuard(), - LicenseUpdate(str(args.year)), + LicenseUpdate(), JavaClass(), Newline(), Stdlib(), diff --git a/wpiformat/wpiformat/licenseupdate.py b/wpiformat/wpiformat/licenseupdate.py index be61856e..2eedebfb 100644 --- a/wpiformat/wpiformat/licenseupdate.py +++ b/wpiformat/wpiformat/licenseupdate.py @@ -1,5 +1,6 @@ """This task updates the license header at the top of the file.""" +from datetime import date import os import regex import subprocess @@ -11,16 +12,6 @@ class LicenseUpdate(Task): - def __init__(self, current_year): - """Constructor for LicenseUpdate task. - - Keyword arguments: - current_year -- year string - """ - Task.__init__(self) - - self.__current_year = current_year - def should_process_file(self, config_file, name): license_regex = config_file.regex("licenseUpdateExclude") @@ -150,7 +141,7 @@ def run_pipeline(self, config_file, name, lines): # If file hasn't been committed yet, use current calendar year as end of # copyright year range if last_year == "": - last_year = self.__current_year + last_year = str(date.today().year) success, first_year, appendix = self.__try_regex( lines, last_year, license_template)