Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Use a path string instead of a string list to encode Node paths

Đang mở
#2,462 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@r-c-n đang làm issue này rồi.

Từ ngày 18/3/2024.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Currently, all Nodes have a path field that encodes the path to that node from a root node (in practice, a checkout node) as a list of strings. I don't know the reason to pick a list to encode a path, but there are certain shortcomings that come with it, the most important of which is that it severely handicaps the way it can be used in queries. That is, we can't search for nodes with a certain string in their paths because we can't express that kind of condition (match an element inside a list) in our queries.

I propose we use a more universal approach to paths and use a common slash-separated path string instead?

Pros:

  • They can be properly used as query conditions
  • They can carry additional information that the lists can't provide: for instance, we can encode whether a node is a leaf node or an intermediate node by having the intermediate nodes end their path string with a trailing slash ('/'). This would give us additional expressiveness in the queries for free, we'd be able to quickly identify if a node contains children nodes or if it's a leaf node.
  • No loss of expressiveness or features compared to the current implementation.

Cons:

  • The character used as the separator can't appear in the name of a test suite, test case, etc.

This could be done with very few code changes, a simple set of helper functions can do the work of managing this field (appending parts to the path, setting a trailing slash when adding children nodes, unpacking path parts, etc).

Ngôn ngữ chính
Python
Star
120
Fork
108
Merge trung bình
1 ngày 12 giờ
Pull request đã merge (30 ngày)
21

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của kernelci/kernelci-core

Tất cả issue của kernelci/kernelci-core

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.