Skip to content

Commit

Permalink
Remove redundant year flag (-y)
Browse files Browse the repository at this point in the history
With the new copyright year logic, the year override is almost never
used. When it is (for files which haven't yet been committed), the current
year should be fine.
calcmogul committed Jun 18, 2019
1 parent 6c9ae3b commit 2c69996
Showing 3 changed files with 4 additions and 21 deletions.
2 changes: 1 addition & 1 deletion wpiformat/test/test_licenseupdate.py
Original file line number Diff line number Diff line change
@@ -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 = \
10 changes: 1 addition & 9 deletions wpiformat/wpiformat/__init__.py
Original file line number Diff line number Diff line change
@@ -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(),
13 changes: 2 additions & 11 deletions wpiformat/wpiformat/licenseupdate.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 2c69996

Please sign in to comment.