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

Path in warnings related to ids of instances is wrong #920

Open
KOLANICH opened this issue Nov 18, 2021 · 4 comments · May be fixed by kaitai-io/kaitai_struct_compiler#306
Open

Path in warnings related to ids of instances is wrong #920

KOLANICH opened this issue Nov 18, 2021 · 4 comments · May be fixed by kaitai-io/kaitai_struct_compiler#306

Comments

@KOLANICH
Copy link

it says /id, but instances have no /id in YAML DAG, it confuses tools relying on these paths.

@GreyCat
Copy link
Member

GreyCat commented Nov 18, 2021

Can you please provide full example of error message?

@KOLANICH
Copy link
Author

KOLANICH commented Nov 18, 2021

Warnings emitted while compiling https://github.com/KOLANICH-specs/kaitai_struct_formats/blob/d3c02f8ed80059f0113c6d6784f087588c921437/hardware/eink_wbf.ksy . Not exposed via JSON when used via CLI, but when used via JPype I have to detect them and distinguishnfrom errors. Since I detect them, I implemented conversion of them into python warnings instead of just ignoring. Since line is not exposed, I have written some code that uses the path to get the line. But the path is invalid.

@Mingun
Copy link

Mingun commented Nov 19, 2021

If you have a tool that sensitive to paths in errors, you would be interested in kaitai-io/kaitai_struct_compiler#229 which fixes many of them

@KOLANICH
Copy link
Author

Thanks, @Mingun. BTW I have looked into the patch, it seems it doesn't fix this issue. Its source is likely here: https://github.com/kaitai-io/kaitai_struct_compiler/blob/0acfa60452a10b770a2c2e746f3de057f8ab76d9/shared/src/main/scala/io/kaitai/struct/precompile/StyleCheckIds.scala#L48

generalmimon added a commit to kaitai-io/kaitai_struct_tests that referenced this issue Aug 29, 2024
Mingun added a commit to Mingun/kaitai_struct_compiler that referenced this issue Sep 8, 2024
Fixes kaitai-io/kaitai_struct#920

Error count: 62 -> 58 (-4). Fixed:

[info] - style_bad_len_inst_pos *** FAILED ***
[info]   [style_bad_len_inst_pos.ksy: /instances/size_of_foo/id:
[info]          warning: use `len_foo` instead of `size_of_foo`, given that it's only used as a byte size of `foo` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ]
[info]     did not equal
[info]   [style_bad_len_inst_pos.ksy: /instances/size_of_foo:
[info]          warning: use `len_foo` instead of `size_of_foo`, given that it's only used as a byte size of `foo` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ] (SimpleMatchers.scala:34)
[info] - style_bad_len_inst_value *** FAILED ***
[info]   [style_bad_len_inst_value.ksy: /instances/size_of_foo/id:
[info]          warning: use `len_foo` instead of `size_of_foo`, given that it's only used as a byte size of `foo` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ]
[info]     did not equal
[info]   [style_bad_len_inst_value.ksy: /instances/size_of_foo:
[info]          warning: use `len_foo` instead of `size_of_foo`, given that it's only used as a byte size of `foo` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ] (SimpleMatchers.scala:34)
[info] - style_bad_num_inst_pos *** FAILED ***
[info]   [style_bad_num_inst_pos.ksy: /instances/size_of_foo/id:
[info]          warning: use `num_foos` instead of `size_of_foo`, given that it's only used as repeat count of `foos` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ]
[info]     did not equal
[info]   [style_bad_num_inst_pos.ksy: /instances/size_of_foo:
[info]          warning: use `num_foos` instead of `size_of_foo`, given that it's only used as repeat count of `foos` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ] (SimpleMatchers.scala:34)
[info] - style_bad_num_inst_value *** FAILED ***
[info]   [style_bad_num_inst_value.ksy: /instances/size_of_foo/id:
[info]          warning: use `num_foos` instead of `size_of_foo`, given that it's only used as repeat count of `foos` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ]
[info]     did not equal
[info]   [style_bad_num_inst_value.ksy: /instances/size_of_foo:
[info]          warning: use `num_foos` instead of `size_of_foo`, given that it's only used as repeat count of `foos` (see https://doc.kaitai.io/ksy_style_guide.html#attr-id)
[info]   ] (SimpleMatchers.scala:34)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants