encounter / dtk-template

Project template for decomp-toolkit
Creative Commons Zero v1.0 Universal
15 stars 13 forks source link

Fix `pyright` complaints and run `black` #12

Closed ribbanya closed 6 months ago

ribbanya commented 6 months ago

Before:

❯ pyright .

/dtk-template/tools/ninja_syntax.py
  /dtk-template/tools/ninja_syntax.py:128:31 - error: Argument of type "list[NinjaPath]" cannot be
 assigned to parameter "__iterable" of type "Iterable[str]" in function "extend"
    "list[NinjaPath]" is incompatible with "Iterable[str]"
      Type parameter "_T_co@Iterable" is covariant, but "NinjaPath" is not a subtype of "str"
        Type "NinjaPath" cannot be assigned to type "str"
          "Path" is incompatible with "str" (reportGeneralTypeIssues)
  /dtk-template/tools/ninja_syntax.py:132:31 - error: Argument of type "list[NinjaPath]" cannot be
 assigned to parameter "__iterable" of type "Iterable[str]" in function "extend"
    "list[NinjaPath]" is incompatible with "Iterable[str]"
      Type parameter "_T_co@Iterable" is covariant, but "NinjaPath" is not a subtype of "str"
        Type "NinjaPath" cannot be assigned to type "str"
          "Path" is incompatible with "str" (reportGeneralTypeIssues)
  /dtk-template/tools/ninja_syntax.py:138:32 - error: Argument of type "list[NinjaPath]" cannot be
 assigned to parameter "__iterable" of type "Iterable[str]" in function "extend"
    "list[NinjaPath]" is incompatible with "Iterable[str]"
      Type parameter "_T_co@Iterable" is covariant, but "NinjaPath" is not a subtype of "str"
        Type "NinjaPath" cannot be assigned to type "str"
          "Path" is incompatible with "str" (reportGeneralTypeIssues)
/dtk-template/tools/project.py
  /dtk-template/tools/project.py:584:27 - error: Argument of type "Path | Any" cannot be assigned 
to parameter "obj" of type "str" in function "add"
    Type "Path | Any" cannot be assigned to type "str"
      "Path" is incompatible with "str" (reportGeneralTypeIssues)
  /dtk-template/tools/project.py:819:19 - error: "progress_path" is possibly unbound (reportUnboun
dVariable)
5 errors, 0 warnings, 0 informations 

After:

❯ pyright .

0 errors, 0 warnings, 0 informations 
encounter commented 6 months ago

Is the .flake8 totally necessary? Or can it be moved out of the root? I’d prefer to keep the root clean

ribbanya commented 6 months ago

Or can it be moved out of the root? I’d prefer to keep the root clean

Not really. black and flake8 (and by extension pyright) are in an eternal holy war with each other, so if you want both to be happy then you have to configure flake8 somehow.

Moving .flake8 to tools would make it complain about line length in configure.py.

ribbanya commented 6 months ago

And yeah, it's really dumb.