dissect.cstruct icon indicating copy to clipboard operation
dissect.cstruct copied to clipboard

Create a tool for stubs in cstruct v4

Open Miauwkeru opened this issue 1 year ago • 1 comments

The only thing that does not work as intended yet is the dereference of pointer. As in, it doesn't return the desired type information but just T

Miauwkeru avatar Feb 27 '24 10:02 Miauwkeru

Codecov Report

Attention: Patch coverage is 93.30454% with 31 lines in your changes missing coverage. Please review.

Project coverage is 92.28%. Comparing base (d2f2ee7) to head (cf212f0). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dissect/cstruct/tools/stubgen.py 90.15% 13 Missing :warning:
dissect/cstruct/bitbuffer.py 72.72% 3 Missing :warning:
dissect/cstruct/types/base.py 90.90% 3 Missing :warning:
dissect/cstruct/utils.py 70.00% 3 Missing :warning:
dissect/cstruct/compiler.py 87.50% 1 Missing :warning:
dissect/cstruct/cstruct.py 99.17% 1 Missing :warning:
dissect/cstruct/types/char.py 93.75% 1 Missing :warning:
dissect/cstruct/types/enum.py 95.45% 1 Missing :warning:
dissect/cstruct/types/int.py 80.00% 1 Missing :warning:
dissect/cstruct/types/leb128.py 80.00% 1 Missing :warning:
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #72      +/-   ##
==========================================
- Coverage   92.33%   92.28%   -0.06%     
==========================================
  Files          20       21       +1     
  Lines        2180     2463     +283     
==========================================
+ Hits         2013     2273     +260     
- Misses        167      190      +23     
Flag Coverage Δ
unittests 92.28% <93.30%> (-0.06%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Feb 27 '24 10:02 codecov[bot]

I added some more tests, and noticed there was still some issues with import stuff from a file. As all signatures/names dissapear once the stub file is there. I attempted to fix this by adding more checks in stubify_file. This seems good enough for now, but I think it might be better to use ast in the future. And maybe look if we can use mypy to generate the stubs with hooks.

Miauwkeru avatar Feb 13 '25 15:02 Miauwkeru

I have made a lot of suggested changes with https://github.com/fox-it/dissect.cstruct/pull/72/commits/7c93f22dd11f51a4e035ee5e84693aa10c34b986

Schamper avatar Mar 04 '25 16:03 Schamper