Skip to content

Add missing type hints #182

@Pennycook

Description

@Pennycook

Feature/behavior summary

Several legacy functions are missing type hints.

Although we've made good progress in adding missing type hints as we've developed new features, we still have a backlog of functionality that we haven't touched in some time.

Request attributes

  • Would this be a refactor of existing code?
  • Does this proposal require new package dependencies?
  • Would this change break backwards compatibility?

Related issues

No response

Solution description

We need to add type hints to the functions in the following files:

  • codebasin/init.py
  • codebasin/config.py
  • codebasin/file_parser.py
  • codebasin/file_source.py
  • codebasin/finder.py
  • codebasin/language.py
  • codebasin/platform.py
  • codebasin/preprocessor.py
  • codebasin/report.py
  • codebasin/tree.py
  • Type hints to util.py #191

...and/or refactor the code to replace the functionality in these files.

Additional notes

Applying the following patch enables flake8 to identify all the functions with missing type hints:

--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -51,6 +51,7 @@ repos:
           [
             flake8-debugger,
             flake8-use-fstring,
+            flake8-annotations,
           ]
         args:
           [

At the time of writing, there are 573 instances of missing type hints. I'd like to enable this as part of the CI, but it probably makes sense to wait until we've addressed some of these.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersrefactorImprovements to code structure

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions