Skip to content

Commit

Permalink
Merge pull request #9 from gauge-sh/update-version-0-14
Browse files Browse the repository at this point in the history
Update extension to support the latest version of tach
  • Loading branch information
caelean authored Nov 13, 2024
2 parents 110e535 + c681662 commit 3af988d
Show file tree
Hide file tree
Showing 8 changed files with 774 additions and 704 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
Expand Down
14 changes: 6 additions & 8 deletions bundled/tool/lsp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import pathlib
import sys
import traceback
from typing import Any
from typing import TYPE_CHECKING, Any

try:
from tach.check import CheckResult
except ImportError:
pass
if TYPE_CHECKING:
from tach.extension import CheckResult


# **********************************************************
Expand Down Expand Up @@ -52,7 +50,7 @@ def update_sys_path(path_to_add: str, strategy: str) -> None:
MAX_WORKERS = 5
# TODO: Centralize version
LSP_SERVER = server.LanguageServer(
name="Tach", version="0.10.3", max_workers=MAX_WORKERS
name="Tach", version="0.14.3", max_workers=MAX_WORKERS
)


Expand Down Expand Up @@ -113,7 +111,7 @@ def _parse_boundary_errors(checked_result: CheckResult | None, uri):
return []
diagnostics = []
for err in checked_result.errors:
if str(err.file_path) in uri and err.error_info.exception_message:
if str(err.file_path) in uri and err.error_info.to_pystring():
start = lsp.Position(
line=err.line_number - 1,
character=0,
Expand All @@ -124,7 +122,7 @@ def _parse_boundary_errors(checked_result: CheckResult | None, uri):
start=start,
end=end,
),
message=err.error_info.exception_message,
message=err.error_info.to_pystring(),
severity=lsp.DiagnosticSeverity.Error,
source=TOOL_MODULE,
)
Expand Down
19 changes: 6 additions & 13 deletions bundled/tool/tach_util.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from __future__ import annotations
from typing import TYPE_CHECKING

from tach.check import CheckResult, check
from tach.extension import check
from tach.parsing.config import parse_project_config
from tach.cli import parse_arguments
from tach.colors import BCOLORS
from tach.constants import CONFIG_FILE_NAME
from tach.errors import TachSetupError
from tach.filesystem import find_project_config_root
from tach.parsing import parse_project_config

if TYPE_CHECKING:
from tach.extension import CheckResult


def run_tach_check(argv: list[str], path: str):
Expand All @@ -29,15 +33,4 @@ def run_tach_check(argv: list[str], path: str):
checked_result: CheckResult = check(
project_root=root, project_config=project_config, exclude_paths=exclude_paths
)
for boundary_error in checked_result.errors:
# Hack for now - update error message displayed to user
error_info = boundary_error.error_info
if (
not error_info.exception_message
and boundary_error.error_info.is_dependency_error
):
error_info.exception_message = (
f"Cannot import '{boundary_error.import_mod_path}'. "
f"Module '{error_info.source_module}' cannot depend on '{error_info.invalid_module}'."
)
return checked_result
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pip==24.0
pytest==8.2.2
pyright==1.1.377
ruff==0.4.1
tach==0.10.3
tach==0.14.3
# LSP
pygls==1.3.1
nox==2024.4.15
Expand Down
Loading

0 comments on commit 3af988d

Please sign in to comment.