Remove id from paths to instances in style warnings#306
Remove id from paths to instances in style warnings#306Mingun wants to merge 4 commits intokaitai-io:masterfrom
id from paths to instances in style warnings#306Conversation
It is. I recently extended the The tests you're fixing here were added in kaitai-io/kaitai_struct_tests@c911e0a to demonstrate kaitai-io/kaitai_struct#920. So ideally you should add |
533c134 to
4ed5981
Compare
|
@generalmimon, could you look again? This PR fixes 13 errors |
d2a946b to
af582ae
Compare
|
@GreyCat, @generalmimon , this PR reduces error count from currently 54 to 42. It is small win, do you mind to merge it? |
GreyCat
left a comment
There was a problem hiding this comment.
Generally, looks good to me and relatively straightforward fix! Thanks @Mingun!
@generalmimon, do you have any concerns or shall we merge this?
generalmimon
left a comment
There was a problem hiding this comment.
I think it's fine too, it indeed fixes some of the test failures.
You know I'm not a big fan of adding comments unless it's absolutely necessary, but if you do, I'd prefer them to make sense...
|
|
||
| def resolveUserType(curClass: ClassSpec, dataType: DataType, path: List[String]): Iterable[CompilationProblem] = { | ||
| /** | ||
| * Resolves the type of the `dataType` of an attribute defined in `curClass`. |
There was a problem hiding this comment.
I'm not sure what "the type of the dataType" means, maybe just
| * Resolves the type of the `dataType` of an attribute defined in `curClass`. | |
| * Resolves the `dataType` of an attribute defined in `curClass`. |
...?
There was a problem hiding this comment.
It is reference to user-defined class (and maybe to built-in type? Don't remember. Affected by the lack of documentation, so I cannot agree with your statement that something is obvious here...). By the way, the whole procedure looks complicated and buggy, but it is fixed in #309
af582ae to
b868509
Compare
|
@generalmimon, your suggestion applied |
Fixes kaitai-io/kaitai_struct#920 Error count: 59 -> 55 (-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)
…TH" errors Error count: 55 -> 48 (-7). Fixed: [info] - id_clash_params_vs_inst_pos *** FAILED *** [info] [id_clash_params_vs_inst_pos.ksy: /instances/foo: [info] error: duplicate attribute ID 'foo', previously defined at /params/0 [info] ] [info] did not equal [info] [id_clash_params_vs_inst_pos.ksy: /instances/foo: [info] error: duplicate attribute ID 'foo', previously defined at /params/0/id [info] ] (SimpleMatchers.scala:34) [info] - id_clash_params_vs_inst_value *** FAILED *** [info] [id_clash_params_vs_inst_value.ksy: /instances/bar: [info] error: duplicate attribute ID 'bar', previously defined at /params/1 [info] ] [info] did not equal [info] [id_clash_params_vs_inst_value.ksy: /instances/bar: [info] error: duplicate attribute ID 'bar', previously defined at /params/1/id [info] ] (SimpleMatchers.scala:34) [info] - id_clash_params_vs_seq *** FAILED *** [info] [id_clash_params_vs_seq.ksy: /seq/0: [info] error: duplicate attribute ID 'foo', previously defined at /params/1 [info] ] [info] did not equal [info] [id_clash_params_vs_seq.ksy: /seq/0/id: [info] error: duplicate attribute ID 'foo', previously defined at /params/1/id [info] ] (SimpleMatchers.scala:34) [info] - id_clash_seq_vs_inst_pos *** FAILED *** [info] [id_clash_seq_vs_inst_pos.ksy: /instances/foo: [info] error: duplicate attribute ID 'foo', previously defined at /seq/0 [info] ] [info] did not equal [info] [id_clash_seq_vs_inst_pos.ksy: /instances/foo: [info] error: duplicate attribute ID 'foo', previously defined at /seq/0/id [info] ] (SimpleMatchers.scala:34) [info] - id_clash_seq_vs_inst_value *** FAILED *** [info] [id_clash_seq_vs_inst_value.ksy: /instances/bar: [info] error: duplicate attribute ID 'bar', previously defined at /seq/1 [info] ] [info] did not equal [info] [id_clash_seq_vs_inst_value.ksy: /instances/bar: [info] error: duplicate attribute ID 'bar', previously defined at /seq/1/id [info] ] (SimpleMatchers.scala:34) [info] - id_dup_params *** FAILED *** [info] [id_dup_params.ksy: /params/2: [info] error: duplicate attribute ID 'foo', previously defined at /params/0 [info] ] [info] did not equal [info] [id_dup_params.ksy: /params/2/id: [info] error: duplicate attribute ID 'foo', previously defined at /params/0/id [info] ] (SimpleMatchers.scala:34) [info] - id_dup_seq *** FAILED *** [info] [id_dup_seq.ksy: /seq/2: [info] error: duplicate attribute ID 'foo', previously defined at /seq/0 [info] ] [info] did not equal [info] [id_dup_seq.ksy: /seq/2/id: [info] error: duplicate attribute ID 'foo', previously defined at /seq/0/id [info] ] (SimpleMatchers.scala:34)
Error count: 48 -> 47 (-1). Fixed: [info] - type_unknown_switch *** FAILED *** [info] [type_unknown_switch.ksy: /seq/0/type/cases/IntNum(42)/type: [info] error: unable to find type 'some_unknown_name', searching from type_unknown_switch [info] ] [info] did not equal [info] [type_unknown_switch.ksy: /seq/0/type/cases/IntNum(42): [info] error: unable to find type 'some_unknown_name', searching from type_unknown_switch [info] ] (SimpleMatchers.scala:34)
b868509 to
0ae70e1
Compare
It seems relatively new error, but the code was not changed since 2021...
Fixes errors like:
/instances/size_of_foo/idis not-existing path. Instances does not haveid, the name of instance is itsid.Fixes kaitai-io/kaitai_struct#920.
Also fixes a couple of other errors