Skip to content

Commit fc43162

Browse files
committed
Merge branch 'master' of github.com:open-cogsci/pyqt_code_editor
2 parents de807dc + 97be96b commit fc43162

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pyqt_code_editor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from ._settings import settings
44

5-
__version__ = '0.0.33'
5+
__version__ = '0.0.34'

pyqt_code_editor/worker/providers/ruff.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
import tempfile
33
import json
44
import os
5+
import sys
56
import logging
67
logger = logging.getLogger(__name__)
78

89

910
def ruff_check(code: str, prefix: str | None = None) -> list[dict]:
1011
"""
1112
Lints Python source code using Ruff.
12-
13+
1314
Args:
1415
code (str): The Python source code to lint.
1516
"""
@@ -25,9 +26,14 @@ def ruff_check(code: str, prefix: str | None = None) -> list[dict]:
2526
tmp_file_path = tmp_file.name
2627
print(tmp_file.name)
2728
cmd = ["ruff", "check", tmp_file_path, "--output-format", "json"]
29+
30+
# Set creation flags for Windows to prevent console window from appearing
31+
creation_flags = subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0
32+
2833
try:
2934
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
30-
stderr=subprocess.PIPE, text=True)
35+
stderr=subprocess.PIPE, text=True,
36+
creationflags=creation_flags)
3137
stdout, stderr = process.communicate()
3238
except Exception as e:
3339
logger.error(f'failed to invoke ruff: {e}')
@@ -49,4 +55,4 @@ def ruff_check(code: str, prefix: str | None = None) -> list[dict]:
4955
'code': message['code'],
5056
'message': message['message'],
5157
})
52-
return formatted_result
58+
return formatted_result

0 commit comments

Comments
 (0)