Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many changes, primarily dealing with options and tests #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rich-pixley
Copy link

Here's my day and a half on it.

Many changes today.

First, the caveats. I've done nothing about vim support. Nothing at
all.

Also, there are a few new library requirements, but they're all in the
standard python library, although argparse now forces us to drop support
for python-2.6 and python-3.1, both of which lacked argparse.

Primarily, I was interested in better testing. To make that happen, I
had to rationalize the parameters that came from config file and
command line. I did that by inventing class ParamBlock.

Linelimit is now a configfile option.

I revamped the "unicode" option. It's now "symbol-style" and allows
you to either force the copyright symbol to be an arbitrary string,
(presumably "(C)", "(c)", or "©"), remove it entirely using "", or
leave it unchanged, (if unset).

I dropped the email field. It's trivial to add as part of the name
and I couldn't see any value to carrying it separately from the name.

The year to use in the copyright rewrite is now also a possible
option.

I've added an option for warning about files for which no suitable
copyright line can be found.

I've completely revamped the configfile. Options are now all in the
same 'copyrightupdate' section and look like this:

[copyrightupdate]
linelimit = 6
name = Joe Blow [email protected]
symbol_style = "(C)"
year = 1999
warn = yes

And there are a slew of new tests covering most of these cases.

Among the bugs squashed:

  • Unicode wasn't rewriting "(C)"
  • If nothing is changed, source file is not rewritten. This is a
    performance optimization from several angles. First, no time is
    spent writing an unchanged file. And second, things like indexers,
    source code control, editors, etc, which key off the last modification
    time of the file are only alerted when a file actually changes.
  • parameterized the year to use when updating - makes tests easier and
    adds a feature to the suite.
  • recompile regex only when necessary, (was too many times)
  • read configfile only once, (was too many times)
  • a couple of bugs in regex's

@martin-ueding
Copy link
Owner

Looks very good, I will review and merge it in a couple days when I have
more time.

Thanks for your work!

http://martin-ueding.de/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants