Merge lp://qastaging/~allenap/bzr-update-copyright/force-ranges into lp://qastaging/bzr-update-copyright

Proposed by Gavin Panella
Status: Merged
Approved by: Richard Wilbur
Approved revision: 19
Merged at revision: 14
Proposed branch: lp://qastaging/~allenap/bzr-update-copyright/force-ranges
Merge into: lp://qastaging/bzr-update-copyright
Diff against target: 427 lines (+145/-61)
3 files modified
__init__.py (+14/-12)
test_update_copyright.py (+94/-30)
update_copyright.py (+37/-19)
To merge this branch: bzr merge lp://qastaging/~allenap/bzr-update-copyright/force-ranges
Reviewer Review Type Date Requested Status
Richard Wilbur Approve
Review via email: mp+257236@code.qastaging.launchpad.net

Description of the change

This branch adds a --force-ranges option (which I'm happy to rename) which always formats years as $min-$max or $year; it ignores gaps. This is how we do it on MAAS because it means we don't have to re-wrap copyright stanzas to appease the linter. It may not be "proper" but it's good enough.

I've also cleaned up all PEP8 warnings. I can revert these changes if they're unwanted.

To post a comment you must log in.
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Since I don't see a bug number that this is solving, a little background would be useful to help me understand. You mention "MAAS" as formatting years in the copyright statement either as a range or a single year. What is "MAAS"?

My second question regarding copyright dates is, "What is 'proper' and how hard would that be to implement?"

Revision history for this message
Gavin Panella (allenap) wrote :

> Since I don't see a bug number that this is solving, a little
> background would be useful to help me understand. You mention "MAAS"
> as formatting years in the copyright statement either as a range or a
> single year. What is "MAAS"?

MAAS is https://launchpad.net/maas. We have a standard copyright header
at the top of each file. Naturally it begins life with a single year,
but that can later be substituted with a date range, "2012-2015" or
"2012, 2013" for example, without causing the line to extend to more
than 80 characters.

When there are three years and they're not all contiguous with one
another, bzr-update-copyright will render it longer, as "2012, 2013,
2015" for example. For us it means that the line grows long enough that
our linter complains, meaning we would have to reflow the header.

It sounds really lazy to have an issue with that, and I kind of agree,
but then I also don't want to replace one manual job (changing the
header dates) with another (reflowing the paragraph), especially when
forgetting to do the latter would cause our landing bot to reject
submissions.

In any case, we've always used ${year-created}-${year-last-modified} in
MAAS, albeit manually. We would be happy to condense the non-contiguous
example from earlier into "2012-2015", even though no changes were made
in 2014.

So, this isn't in response to a bug, it's an itch that I scratched.

> My second question regarding copyright dates is, "What is 'proper' and
> how hard would that be to implement?"

"Proper" may have been an overstatement. I think of the current
behaviour of this plugin as "proper", and --force-range as somewhat
"improper", but I don't actually know which is more proper than the
other. I was motivated only to automate our current practice without
disrupting existing users of bzr-update-copyright.

Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Thanks for the background.

I have a question regarding line 32 of __init__.py: Why is this the only line of option description text delimited by double quotes(")? All the others seems to use single quotes(').

Other than that, it looks good to me.

19. By Gavin Panella

Make quoting consistent.

Revision history for this message
Gavin Panella (allenap) wrote :

Thanks Richard. I've fixed the quotes to be consistent.

Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Thank you for the PEP8 clean up and the new option and documentation.
+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches