MonkeyCanCode opened a new pull request, #117: URL: https://github.com/apache/polaris-tools/pull/117
Similar to https://github.com/apache/polaris/pull/3305, enforce mypy for MCP code base. Here is the before the fix: ``` ➜ mcp-server git:(mcp_mypy) ✗ uv run pre-commit run --all-files [INFO] Installing environment for https://github.com/pre-commit/mirrors-mypy. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... trim trailing whitespace.................................................Passed fix end of files.........................................................Passed debug statements (python)................................................Passed ruff check...............................................................Passed ruff format..............................................................Passed mypy.....................................................................Failed - hook id: mypy - exit code: 1 mcp-server/polaris_mcp/authorization.py:76: error: Function is missing a type annotation [no-untyped-def] mcp-server/polaris_mcp/authorization.py:86: error: Value of type "tuple[str, float] | None" is not indexable [index] mcp-server/polaris_mcp/authorization.py:118: error: Incompatible return value type (got "dict[str, str | None]", expected "dict[str, str] | None") [return-value] mcp-server/polaris_mcp/authorization.py:123: error: Incompatible return value type (got "dict[str, str | None]", expected "dict[str, str] | None") [return-value] mcp-server/polaris_mcp/tools/policy.py:152: error: Argument 3 to "_handle_list" of "PolarisPolicyTool" has incompatible type "str | None"; expected "str" [arg-type] mcp-server/polaris_mcp/tools/policy.py:155: error: Argument 4 to "_handle_get" of "PolarisPolicyTool" has incompatible type "str | None"; expected "str" [arg-type] mcp-server/polaris_mcp/tools/policy.py:158: error: Argument 4 to "_handle_create" of "PolarisPolicyTool" has incompatible type "str | None"; expected "str" [arg-type] mcp-server/polaris_mcp/tools/policy.py:161: error: Argument 4 to "_handle_update" of "PolarisPolicyTool" has incompatible type "str | None"; expected "str" [arg-type] mcp-server/polaris_mcp/tools/policy.py:164: error: Argument 4 to "_handle_delete" of "PolarisPolicyTool" has incompatible type "str | None"; expected "str" [arg-type] mcp-server/polaris_mcp/tools/policy.py:167: error: Argument 4 to "_handle_attach" of "PolarisPolicyTool" has incompatible type "str | None"; expected "str" [arg-type] mcp-server/polaris_mcp/tools/policy.py:170: error: Argument 4 to "_handle_detach" of "PolarisPolicyTool" has incompatible type "str | None"; expected "str" [arg-type] mcp-server/polaris_mcp/server.py:418: error: Incompatible types in assignment (expression has type "dict[str, Any]", target has type "bool") [assignment] mcp-server/int_test/client.py:118: error: Function is missing a type annotation [no-untyped-def] mcp-server/int_test/client.py:187: error: Function is missing a return type annotation [no-untyped-def] mcp-server/int_test/client.py:187: note: Use "-> None" if function does not return a value mcp-server/tests/test_table_tool.py:108: error: Unsupported target for indexed assignment ("Collection[str]") [index] mcp-server/tests/test_server.py:90: error: Argument 1 to "_normalize_namespace" has incompatible type "tuple[str, int]"; expected "str | Sequence[str]" [arg-type] mcp-server/tests/test_rest_tool.py:108: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:109: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:110: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:111: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:112: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:113: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:114: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:116: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:158: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:159: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:160: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:161: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_rest_tool.py:162: error: Value of type "dict[str, Any] | None" is not indexable [index] mcp-server/tests/test_config.py:67: error: Function is missing a type annotation for one or more arguments [no-untyped-def] Found 30 errors in 8 files (checked 25 source files) ``` And with this PR: ``` ➜ mcp-server git:(mcp_mypy) uv run pre-commit run --all-files trim trailing whitespace.................................................Passed fix end of files.........................................................Passed debug statements (python)................................................Passed ruff check...............................................................Passed ruff format..............................................................Passed mypy.....................................................................Passed ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
