meson icon indicating copy to clipboard operation
meson copied to clipboard

Cleanup the dlang module and add annotations

Open dcbaker opened this issue 4 years ago • 3 comments

Initially I just wanted to quickly add annotations, but discovered that there was some serious duplication of code (plus some confusion on python class vs instance attributes). This starts by de-duplicating the code to find dub between the the DubDependency class and the DlangModule class. It does this using a constructor (yes, a constructor, not an initializer), which isn't a common pattern in python, but I think is pretty elegant in this situation. Then the standard type cleanups and the addition to the run mypy script.

This does not use typed_kwargs for the one method in the module, as the keyword arguments seem to be more freeform than structured inputs, that are just passed directly into a json file.

dcbaker avatar Nov 23 '21 21:11 dcbaker

Codecov Report

Attention: Patch coverage is 68.57143% with 11 lines in your changes missing coverage. Please review.

Project coverage is 70.26%. Comparing base (905a361) to head (2d9d693). Report is 2963 commits behind head on master.

Files Patch % Lines
mesonbuild/dependencies/dub.py 60.00% 5 Missing and 3 partials :warning:
mesonbuild/modules/dlang.py 80.00% 1 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9622      +/-   ##
==========================================
+ Coverage   67.40%   70.26%   +2.86%     
==========================================
  Files         402      201     -201     
  Lines       85482    42757   -42725     
  Branches    17622     8899    -8723     
==========================================
- Hits        57615    30044   -27571     
+ Misses      23262    10364   -12898     
+ Partials     4605     2349    -2256     

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

codecov[bot] avatar Nov 23 '21 21:11 codecov[bot]

I apparently didn't realize this PR existed when I submitted #10096 which added type-checking for the module but didn't touch annotations at all.

Anyway, this currently conflicts quite a bit, but could also be re-scoped to just the cleanup half of the PR.

eli-schwartz avatar May 23 '22 21:05 eli-schwartz

Is the cleanup portion of this PR still valid?

tristan957 avatar May 23 '23 22:05 tristan957