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

tools: add cmd/tools/show_ancient_deprecations.v, to cleanup ancient functionality, deprecated over an year ago #18946

Merged

Conversation

spytheman
Copy link
Member

@spytheman spytheman commented Jul 22, 2023

This tool is most useful, when run inside emacs or another IDE, that can jump to lines, but it can be used also on the command line directly, although less conveniently:

#0 16:54:46 ᛋ tools_add_show_ancient_deprecations_script /v/vnew❱v run cmd/tools/show_ancient_deprecations.v 180
> Deprecations that happened before 2023-01-23 16:54:48
>>> SKIPPING since t: 2023-07-22 13:49:31 > 2023-01-23 16:54:48, line:                  if line.contains('[deprecated]') {
>>> SKIPPING since t: 2023-07-22 13:49:31 > 2023-01-23 16:54:48, line:                  if line.contains('[deprecated:') {
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use a.bit_len() instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use integer.bin_str() instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use a.Integer.right_shift(amount) instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use a.Integer.left_shift(amount) instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use factorial_int instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use a.right_shift(amount) instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use a.left_shift(amount) instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use bitwise_xor(a, b) instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use bitwise_or(a, b) instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use bitwise_and(a, b) instead']
>>> SKIPPING since t: 2023-07-19 23:33:07 > 2023-01-23 16:54:48, line: [deprecated: 'use div_mod(a, b) instead']
./vlib/builtin/array.v:955: deprecation: 1, timestamp: 1665300590 - 2022-10-09 07:29:50
    95f57e9206 (ChAoS_UnItY           2022-10-09 15:29:50 +0800 955) [deprecated: 'use arrays.fold instead, this function has less flexibility than arrays.fold']
    95f57e9206 (ChAoS_UnItY           2022-10-09 15:29:50 +0800 956) [deprecated_after: '2022-10-11']
    7da1afa140 (Alexander Medvednikov 2020-10-15 12:32:28 +0200 957) pub fn (a []int) reduce(iter fn (int, int) int, accum_start int) int {
    f748390172 (Alexander Medvednikov 2020-04-04 14:55:40 +0200 958)    mut accum_ := accum_start
    ef8c1203b4 (spaceface777          2020-02-24 17:55:16 +0100 959)    for i in a {
./vlib/datatypes/set.v:118: deprecation: 2, timestamp: 1669965768 - 2022-12-02 07:22:48
    f16722596c (yuyi             2022-12-02 15:22:48 +0800 118) [deprecated: 'use set1[T] - set2[T] instead']
    ef5be22f81 (yuyi             2022-11-27 00:23:26 +0800 119) pub fn (l Set[T]) difference(r Set[T]) Set[T] {
    44137e07b0 (Swastik Baranwal 2022-08-26 09:33:23 +0530 120)         return l - r
    44137e07b0 (Swastik Baranwal 2022-08-26 09:33:23 +0530 121) }
    44137e07b0 (Swastik Baranwal 2022-08-26 09:33:23 +0530 122)
./vlib/datatypes/set.v:50: deprecation: 3, timestamp: 1669965768 - 2022-12-02 07:22:48
    f16722596c (yuyi             2022-12-02 15:22:48 +0800 50) [deprecated: 'use set1[T] == set2[T] instead']
    ef5be22f81 (yuyi             2022-11-27 00:23:26 +0800 51) pub fn (l Set[T]) equal(r Set[T]) bool {
    44137e07b0 (Swastik Baranwal 2022-08-26 09:33:23 +0530 52)  return l == r
    44137e07b0 (Swastik Baranwal 2022-08-26 09:33:23 +0530 53) }
    44137e07b0 (Swastik Baranwal 2022-08-26 09:33:23 +0530 54)
>>> SKIPPING since t: 2023-07-18 05:02:30 > 2023-01-23 16:54:48, line: [deprecated: 'use Block.new instead']
./vlib/os/os.v:899: deprecation: 4, timestamp: 1666263366 - 2022-10-20 10:56:06
    2083e6b04c (Delyan Angelov 2022-10-20 13:56:06 +0300 899) [deprecated: 'use os.ensure_folder_is_writable instead']
    2083e6b04c (Delyan Angelov 2022-10-20 13:56:06 +0300 900) pub fn is_writable_folder(folder string) !bool {
    2083e6b04c (Delyan Angelov 2022-10-20 13:56:06 +0300 901)   ensure_folder_is_writable(folder)!
    2083e6b04c (Delyan Angelov 2022-10-20 13:56:06 +0300 902)   return true
    2083e6b04c (Delyan Angelov 2022-10-20 13:56:06 +0300 903) }
./vlib/gg/gg.c.v:168: deprecation: 5, timestamp: 1668238758 - 2022-11-12 07:39:18
    5bb058e35b (Junko          2022-11-12 15:39:18 +0800 168)   timage_pip  sgl.Pipeline       [deprecated: 'Use `Context.pipeline.alpha` instead!']
    5bb058e35b (Junko          2022-11-12 15:39:18 +0800 169)   pipeline    &PipelineContainer = unsafe { nil }
    576664e31f (Delyan Angelov 2021-08-12 22:31:04 +0300 170)   config      Config
    32b74dd348 (Delyan Angelov 2021-11-06 18:24:19 +0200 171)   user_data   voidptr
    8b962f8446 (shove          2022-09-15 12:59:31 +0800 172)   ft          &FT = unsafe { nil }
./vlib/gg/text_rendering.c.v:151: deprecation: 6, timestamp: 1664454256 - 2022-09-29 12:24:16
    711bb6def7 (Tim Marston 2022-09-29 13:24:16 +0100 151) [deprecated: 'use set_text_cfg() instead']
    711bb6def7 (Tim Marston 2022-09-29 13:24:16 +0100 152) pub fn (ctx &Context) set_cfg(cfg gx.TextCfg) {
    711bb6def7 (Tim Marston 2022-09-29 13:24:16 +0100 153)      ctx.set_text_cfg(cfg)
    711bb6def7 (Tim Marston 2022-09-29 13:24:16 +0100 154) }
    711bb6def7 (Tim Marston 2022-09-29 13:24:16 +0100 155)
>>> SKIPPING since t: 2023-06-26 22:23:30 > 2023-01-23 16:54:48, line:  is_deprecated         bool // `[deprecated] fn abc(){}`
>>> SKIPPING deprecations test file ./vlib/v/checker/tests/module_with_structs_with_deprecated_fields/fields.v
>>> SKIPPING deprecations test file ./vlib/v/checker/tests/modules/deprecated_module/xxx/yyy/yyy.v
>>> SKIPPING deprecations test file ./vlib/v/checker/tests/modules/deprecated_module/bbb/ccc/ccc.v
>>> SKIPPING deprecations test file ./vlib/v/checker/tests/modules/deprecated_module/main.v
>>> SKIPPING deprecations test file ./vlib/v/checker/tests/modules/deprecated_module/www/ttt/ttt.v
./vlib/time/chrono.v:20: deprecation: 7, timestamp: 1668342614 - 2022-11-13 12:30:14
    38555a92e1 (Hitalo Souza 2022-11-13 09:30:14 -0300 20) [deprecated: 'use time.days_from_unix_epoch instead']
    38555a92e1 (Hitalo Souza 2022-11-13 09:30:14 -0300 21) [deprecated_after: '2022-11-23']
    38555a92e1 (Hitalo Souza 2022-11-13 09:30:14 -0300 22) pub fn days_from_civil(year int, month int, day int) int {
    38555a92e1 (Hitalo Souza 2022-11-13 09:30:14 -0300 23)      return days_from_unix_epoch(year, month, day)
    38555a92e1 (Hitalo Souza 2022-11-13 09:30:14 -0300 24) }
>>> SKIPPING since t: 2023-07-16 12:42:30 > 2023-01-23 16:54:48, line:  port               int             [deprecated: 'use addr'] = 8080
>>> SKIPPING since t: 2023-06-27 17:10:31 > 2023-01-23 16:54:48, line: [deprecated: 'use get_tags_by_attribute_value instead']
>>> SKIPPING since t: 2023-06-27 17:10:31 > 2023-01-23 16:54:48, line: [deprecated: 'use get_tags_by_attribute instead']
>>> SKIPPING since t: 2023-06-27 17:10:31 > 2023-01-23 16:54:48, line: [deprecated: 'use get_tags instead']
>>> SKIPPING since t: 2023-07-22 06:11:01 > 2023-01-23 16:54:48, line: [deprecated: 'use ntoh16() instead']
>>> SKIPPING since t: 2023-07-22 06:11:01 > 2023-01-23 16:54:48, line: [deprecated: 'use ntoh32() instead']
>>> SKIPPING since t: 2023-07-22 06:11:01 > 2023-01-23 16:54:48, line: [deprecated: 'use ntoh64() instead']
>>> SKIPPING since t: 2023-07-22 06:11:01 > 2023-01-23 16:54:48, line: [deprecated: 'use hton16() instead']
>>> SKIPPING since t: 2023-07-22 06:11:01 > 2023-01-23 16:54:48, line: [deprecated: 'use hton32() instead']
>>> SKIPPING since t: 2023-07-22 06:11:01 > 2023-01-23 16:54:48, line: [deprecated: 'use hton64() instead']
> Summary: there were 7 deprecations found, done before 2023-01-23 16:54:48.
#0 16:54:51 ᛋ tools_add_show_ancient_deprecations_script /v/vnew❱

…ome ancient deprecated functionality (deprecated over an year ago)
@spytheman
Copy link
Member Author

The intended use is to run it say once a month, to see what deprecated functionality could be cleaned up, without having to search manually for the context of all of the existing depreciations.

@JalonSolov
Copy link
Contributor

Nice. Since we check the examples in the docs (at least the complete ones), those will get cleaned up at the same time.

Would've been better if they had been cleaned up immediately when the stuff got deprecated, but that sounds like something that should always be done (and in a different PR).

@spytheman spytheman changed the title tools: add cmd/tools/show_ancient_deprecations.v, use it to cleanup some ancient deprecated functionality (deprecated over an year ago) tools: add cmd/tools/show_ancient_deprecations.v, to cleanup anciend functionality, deprecated over an year ago Jul 22, 2023
@spytheman spytheman changed the title tools: add cmd/tools/show_ancient_deprecations.v, to cleanup anciend functionality, deprecated over an year ago tools: add cmd/tools/show_ancient_deprecations.v, to cleanup ancient functionality, deprecated over an year ago Jul 22, 2023
@spytheman spytheman merged commit 41f99c1 into vlang:master Jul 22, 2023
48 checks passed
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.

None yet

2 participants