Giter Site home page Giter Site logo

Comments (6)

aostrowski avatar aostrowski commented on June 16, 2024 1

I put this in place because I assumed if multiple people are present in the header, only the one who made changes should have the year updated.

I tried to find real-world examples of files with multiple numbers in license headers. In most cases, I guess the correct behavior would be to update just the last spotted year, for instance like in those cases: https://github.com/torvalds/linux/blob/master/include/misc/altera.h, https://github.com/torvalds/linux/blob/master/include/video/sa1100fb.h.

In the first case, other companies were developing the header earlier on, so their copyrights shouldn't be extended when other developers build on their work. In the second case, an LCD controller have 4 digits in the name, which would be treated as a year instead of the actual copyright year.

I can modify the code to treat all numbers as years, or I can treat just the last one. A third option would be to just update the year on lines containing the word "Copyright". Perhaps this would be the best option.

Which approach do you think would work in most cases?

from pre-commit-hooks.

Lucas-C avatar Lucas-C commented on June 16, 2024

Ping @aostrowski who implemented this 😊

As for myself, I'd be open to perform the changes on all matching lines in the header

from pre-commit-hooks.

pezcode avatar pezcode commented on June 16, 2024

Thanks for the fast reply ☺️

I think finding an approach that works for everything is hard. In our case we do need support for updating multiple ranges. There are two options I can think of:

  • add another argument to select whether to update the first/last/all years (or ranges)
  • find a way to annotate years in the input license file that need updating, would also fix the LCD controller issue. Either some placeholder for "insert current year" or a way to mark "this is a year" - if neither is found revert to current behavior.

I understand if these are too intrusive for your taste, and adding the changes in our own fork wouldn't be terribly hard.

from pre-commit-hooks.

Lucas-C avatar Lucas-C commented on June 16, 2024

Thank you both for your thoughts on the subject.

I think --use-current-year --update-all-year-ranges could be a simple solution that should please everyone.

Are you OK with that solution?
Is one of you interested in contributing a PR for this?

from pre-commit-hooks.

pezcode avatar pezcode commented on June 16, 2024

--update-all-year-ranges would work well 😌 The behavior should then match for both existing and updated licenses. Currently newly inserted licenses have all years/ranges updated, but should only update the first unless --update-all-year-ranges is given.

I can take a stab at a PR for this, might just take a few days before I can find the time.

from pre-commit-hooks.

Lucas-C avatar Lucas-C commented on June 16, 2024

I can take a stab at a PR for this, might just take a few days before I can find the time.

Great! Sure, take your time 😊

from pre-commit-hooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.