williballenthin / INDXParse

Tool suite for inspecting NTFS artifacts.
http://www.williballenthin.com/forensics/mft/indxparse/
Apache License 2.0
216 stars 42 forks source link

Start `mypy` static code review via Makefile framework #59

Closed ajnelson-nist closed 1 year ago

ajnelson-nist commented 1 year ago

Disclaimer: Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose.

Issues #38 and #41 began discussions on a testing framework that would eventually include static type review.

Work done recently with @sldouglas-nist has been adding type signatures. Testing of each submitted pull request has included a manual run of mypy against some objective script files within INDXParse.

This patch begins automating the review of type signatures, following the results of some discussions on Issue 38 - namely, use of Make. Make is used for the static type review, intentionally instead of pre-commit, due to a certain behavior that could arise: If pre-commit encounters any failure that it can't automatically fix, the user in their local editing environment is prevented from completing the git commit command. A change to a type signature can have a wide- ranging effect, and this patch is added to prevent that user-experience. (Some of this has been discussed at further length in case-utils PR 37, where pre-commit was added to another project.)

The Makefile added in this patch runs mypy review over selected files analyzed to date, with the expectation that eventually the command will become mypy indxparse, not enumerating specific files. The GitHub Action is updated to include make check (parameterized for the runner's selected Python) as the last step run.

The Makefile also confirms that the package installs in a Python 3 virtual environment, and incorporates the mypy package through a new feature, testing.

References: