Zulip Chat Archive

Stream: mathlib4

Topic: Linter for `deprecated (since := _)`


Yury G. Kudryashov (Jun 09 2024 at 19:44):

In #13678, I started to write a linter (not tested yet) that should fail on @[deprecated] without since := . I have 3 questions:

  • do you think that we should enforce this (by a linter like this one)?
  • what's a better way to deal with "discard the case an Option is none"? I do match but I would prefer to write a line that discard the none case, then continue with the some case.
  • how do I enforce the YYYY-MM-DD format?

Thomas Murrills (Jun 09 2024 at 19:52):

Re: second bullet, are you looking for something like let some info := (…) | return none?

Adam Topaz (Jun 09 2024 at 20:37):

For the date format, you could try to parse such a date (e.g. with parsec) and throw an error on failure

Yury G. Kudryashov (Jun 09 2024 at 20:55):

Where do I read about parsec?

Adam Topaz (Jun 09 2024 at 20:59):

docs#Lean.Parsec

Adam Topaz (Jun 09 2024 at 21:00):

I’m not sure how much documentation we have. But most of the docs about the Haskell implementation should translate

Yury G. Kudryashov (Jun 09 2024 at 21:06):

Thank you!

Damiano Testa (Jun 09 2024 at 21:10):

I had written a (partial) check for something that looks like a date here, in case it is useful.

Yury G. Kudryashov (Jun 09 2024 at 21:12):

I don't think I have access to TSyntax at this stage.

Damiano Testa (Jun 09 2024 at 21:33):

Maybe docs#String.toNat? can be useful?

Yury G. Kudryashov (Jun 15 2024 at 14:41):

#13723 and #13839 add since := dates to all @[deprecated], then #13678 adds a linter.


Last updated: May 02 2025 at 03:31 UTC