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

OSS Gate Workshop: online: 2024-01-27: ochi_work: ${OSS_NAME}: Work log #1776

Closed
sho-work opened this issue Jan 27, 2024 · 24 comments
Closed
Labels
work log ワークショップ作業メモ

Comments

@sho-work
Copy link
Contributor

This is a work log of a "OSS Gate workshop".
"OSS Gate workshop" is an activity to increase OSS developers.
Here's been discussed in Japanese. Thanks.

作業ログ作成時の説明

以下のテンプレートを埋めてタイトルに設定します。埋め方例はスクロールすると見えてきます。

OSS Gate Workshop: ${LOCATION}: ${YEAR}-${MONTH}-${DAY}: ${ACCOUNT_NAME}: ${OSS_NAME}: Work log

タイトル例↓:

OSS Gate Workshop: Tokyo: 2017-01-16: kou: Rabbit: Work log

OSS Gateワークショップ関連情報

  • スライド:ワークショップの進行に使っているスライドがあります。
  • チャット:OSS開発に関することならなんでも相談できます。ワークショップが終わった後もオンラインで相談しながら継続的にOSSの開発に参加しましょう!
  • シナリオ:ワークショップの目的・内容・進め方の詳細が書いています。
  • 過去のビギナーの作業ログ:他の人の作業ログから学べることがいろいろあるはずです。
@sho-work sho-work added the work log ワークショップ作業メモ label Jan 27, 2024
@sho-work sho-work changed the title OSS Gate Workshop: ${LOCATION}: ${YEAR}-${MONTH}-${DAY}: ochi_work: ${OSS_NAME}: Work log OSS Gate Workshop: online: ${YEAR}-${MONTH}-${DAY}: ochi_work: ${OSS_NAME}: Work log Jan 27, 2024
@sho-work sho-work changed the title OSS Gate Workshop: online: ${YEAR}-${MONTH}-${DAY}: ochi_work: ${OSS_NAME}: Work log OSS Gate Workshop: online: 2024-01-27: ochi_work: ${OSS_NAME}: Work log Jan 27, 2024
@sho-work
Copy link
Contributor Author

sho-work commented Jan 27, 2024

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

@sho-work
Copy link
Contributor Author

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

Rubyのドキュメントを直すのであれば、これが参考になりそう

@sho-work
Copy link
Contributor Author

一旦rubyの以下のメソッドTime#strftime%Cの挙動が怪しい。
ドキュメントに2009年であれば 20と書いてあるが、2009年であれば 21ではないか?

https://docs.ruby-lang.org/ja/latest/method/Time/i/strftime.html

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

Time.new.strftime("%C")
=> "20"
$ ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

仕様の是非を確認するのはどうしたらよいのか?

Ruby のGitHub リポジトリは https://github.com/ruby/ruby
だが、issueがない

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

READMEから、次のページにたどり着いた。

https://docs.ruby-lang.org/en/master/contributing_md.html

Ruby Issue Tracking System: https://bugs.ruby-lang.org/

@sho-work
Copy link
Contributor Author

sho-work commented Jan 27, 2024

ruby 3.3で試してみる。

https://www.ruby-lang.org/ja/news/2023/12/25/ruby-3-3-0-released/

root@966bc04b1db1:/app# ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [aarch64-linux]
root@966bc04b1db1:/app# irb
irb(main):001> t = Time.new(2024,2,3,4,5,6,"+09:00")
=> 2024-02-03 04:05:06 +0900
irb(main):002> p t.strftime("%C") 
"20"
=> "20"

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

日本語のドキュメントだと分かりにくいが、Centuryという概念が西暦の上2桁を指すものになってしまっているように見える。

https://docs.ruby-lang.org/ja/latest/method/Time/i/strftime.html

%C: 世紀 (2009年であれば 20)
...
%Y: 西暦を表す数
%y: 西暦の下2桁(00-99)

英語だと

%C Century (20 in 2009)
...
%y Year without a century (00..99)
%Y Year which may include century, if provided

英語だと、%Cのみでなく、%y%Yの説明もおかしいのが分かる。
Year without a centuryというのは、明らかに上2桁の数字のことをcenturyと呼んでいる。
これは我々の一般的な世紀の概念と合わない。

https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes

上2桁の数字のことをcenturyと呼ぶのは、Pythonの英語ドキュメントでも同様だった。
(Pythonには%Cで世紀を返すフォーマットはないが)

ソフトウェア業界では上2桁のことをCenturyと呼ぶ文化があるのだろうか?

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

少なくともRubyの日本語ドキュメントでは%y%Yの説明に世紀という言葉を使っていない。

%y: 西暦の下2桁(00-99)

ならば、%C西暦の上2桁と記載したほうが良いドキュメントではないか?という考え方はできそう。
(Rubyの言語仕様は間違っていない。ドキュメントの言葉選びが紛らわしい、という視点)

@blacktoad30
Copy link
Contributor

blacktoad30 commented Jan 27, 2024

参考: dateコマンドのPOSIX仕様

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

参考: dateコマンドのPOSIX仕様

* [変換仕様](https://pubs-opengroup-org.translate.goog/onlinepubs/9699919799/utilities/date.html?_x_tr_sl=auto&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=wapp#tag_20_30_05_01)
  `%C`の説明が参考になりそうです。

おお。

%C
Century (a year divided by 100 and truncated to an integer) as a decimal number [00,99].

いい感じに説明してますね

* [アプリケーションの使用方法](https://pubs-opengroup-org.translate.goog/onlinepubs/9699919799/utilities/date.html?_x_tr_sl=auto&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=wapp#tag_20_30_16)
  `%C`が導入された経緯と注意点について書かれています。

これですね!なるほど〜

The century number is calculated as the year divided by 100 and truncated to an integer; it should not be confused with the use of ordinal numbers for centuries (for example, "twenty-first century".)

@sho-work
Copy link
Contributor Author

お二人とも、ありがとうございます!
内容まとめてみようと思います!

@sho-work
Copy link
Contributor Author

sho-work commented Jan 27, 2024

Rubyに立てようと思っているissue

概要

Time#strftimeの以下のメソッドで第一の位置引数が%Cの時に、西暦の上2桁を読み込んで返す仕様になっている。
この仕様は言語仕様としては正しいが、一般的な世紀とは異なるので、ドキュメント上では以下のような記述を加えた方が親切なのではないか?と思っている。

- %C: 世紀 (2009年であれば 20)
+ %C: 世紀 (2009年であれば 20。)。一般的な世紀とは異なり、西暦の上2桁を表す。

Rspec-Coreに立てようと思っているissue

概要(Draft)

.rspecを無視して実行したい時のオプションがなく、カスタムオプションの-Oオプションを使用しないといけない。
ユースケースとしてはよくあるものだと思うので、.rspecを無視するオプションがあってもいいのでは?と思った。
-NOTCONFIGみたいなオプションがあるといいかも。

RSpec::Core::Runner.run(['-O', ''])

Ref: https://github.com/rspec/rspec-core/blob/f273314f575ab62092b2ad86addb6a3c93d6041f/lib/rspec/core/configuration_options.rb#L129

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

「Rubyに立てようと思っているissue」の方は、「るりま」の方に立てるとよさそうな気がします!

ドキュメントの表現の仕方の改善提案、みたいな立ち位置になるかなあと

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

「一般的な世紀とは異なり、西暦の上2桁を表す」というような説明を足す、という改善はとても自然で良いものに思います!ぜひフィードバックしたいですね

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

https://docs.ruby-lang.org/ja/latest/method/Time/i/strftime.html
の右上のeditボタンからすぐにPR作れそう。

https://github.com/rurema/doctree/edit/master/refm/api/src/_builtin/Time#L552

@sho-work
Copy link
Contributor Author

るりまのPull Requestを作成する

@sho-work
Copy link
Contributor Author

sho-work commented Jan 27, 2024

PR作成できました!
サポートしてくださってありがとうございます!
rurema/doctree#2869

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

おお!簡潔でいい感じだと思います!

@daipom
Copy link
Contributor

daipom commented Jan 27, 2024

元ページのURLも貼っとくといいかもですね!

Copy link

おつかれさまでした!

ワークショップの終了にともないissueを閉じますが、このまま作業メモとして使っても構いません 👌

ワークショップの感想を集めています!

ブログなどに書かれた際は、このページへリンクの追加をお願いします 🙏

またの参加をお待ちしています!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work log ワークショップ作業メモ
Projects
None yet
Development

No branches or pull requests

3 participants