Skip to content

Commit 2d14af9

Browse files
authored
Merge pull request #1064 from GitGuardian/severine/set-env-var-to-ignore-ggshield-output
chore: disable rich output with an env var + rm dead code
2 parents 4c75f07 + 40b83d1 commit 2d14af9

File tree

2 files changed

+2
-130
lines changed

2 files changed

+2
-130
lines changed

ggshield/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ def main(args: Optional[List[str]] = None) -> Any:
196196
multiprocessing.freeze_support()
197197

198198
log_utils.disable_logs()
199-
if sys.stderr.isatty():
199+
200+
if not os.getenv("GG_PLAINTEXT_OUTPUT", False) and sys.stderr.isatty():
200201
ui.set_ui(RichGGShieldUI())
201202

202203
force_utf8_output()

tests/conftest.py

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -60,135 +60,6 @@ def do_not_use_colors(monkeypatch):
6060
monkeypatch.setenv("NO_COLOR", "1")
6161

6262

63-
PIPFILE_WITH_VULN = """
64-
[[source]]
65-
url = "https://pypi.org/simple"
66-
verify_ssl = true
67-
name = "pypi"
68-
69-
[packages]
70-
sqlparse = "==0.4.4"
71-
72-
[dev-packages]
73-
74-
[requires]
75-
python_version = "3.10"
76-
"""
77-
78-
PIPFILE_LOCK_WITH_VULN = """
79-
{
80-
"_meta": {
81-
"hash": {
82-
"sha256": "2bf167f6a72aaa0f48f5876945f2a37874f3f114dad5e952cd7df9dfe8d9d281"
83-
},
84-
"pipfile-spec": 6,
85-
"requires": {
86-
"python_version": "3.10"
87-
},
88-
"sources": [
89-
{
90-
"name": "pypi",
91-
"url": "https://pypi.org/simple",
92-
"verify_ssl": true
93-
}
94-
]
95-
},
96-
"default": {
97-
"sqlparse": {
98-
"hashes": [
99-
"sha256:0323c0ec29cd52bceabc1b4d9d579e311f3e4961b98d174201d5622a23b85e34",
100-
"sha256:69ca804846bb114d2ec380e4360a8a340db83f0ccf3afceeb1404df028f57268"
101-
],
102-
"index": "pypi",
103-
"version": "==0.4.4"
104-
}
105-
},
106-
"develop": {}
107-
}
108-
"""
109-
110-
PIPFILE_LOCK_WITH_VULN_NO_FIX = """
111-
{
112-
"_meta": {
113-
"hash": {
114-
"sha256": "2bf167f6a72aaa0f48f5876945f2a37874f3f114dad5e952cd7df9dfe8d9d281"
115-
},
116-
"pipfile-spec": 6,
117-
"requires": {
118-
"python_version": "3.10"
119-
},
120-
"sources": [
121-
{
122-
"name": "pypi",
123-
"url": "https://pypi.org/simple",
124-
"verify_ssl": true
125-
}
126-
]
127-
},
128-
"default": {
129-
"h2o": {
130-
"hashes": [],
131-
"index": "pypi",
132-
"version": "==3.18.0.8"
133-
}
134-
},
135-
"develop": {}
136-
}
137-
"""
138-
139-
PIPFILE_NO_VULN = """
140-
[[source]]
141-
url = "https://pypi.org/simple"
142-
verify_ssl = true
143-
name = "pypi"
144-
145-
[packages]
146-
sqlparse = "==0.5.0"
147-
148-
[dev-packages]
149-
150-
[requires]
151-
python_version = "3.10"
152-
"""
153-
154-
PIPFILE_LOCK_NO_VULN = """
155-
{
156-
"_meta": {
157-
"hash": {
158-
"sha256": "9e0257467cb126854e4a922f143941c3ffd38bca1c5805c778f96af3832f9fd3"
159-
},
160-
"pipfile-spec": 6,
161-
"requires": {
162-
"python_version": "3.10"
163-
},
164-
"sources": [
165-
{
166-
"name": "pypi",
167-
"url": "https://pypi.org/simple",
168-
"verify_ssl": true
169-
}
170-
]
171-
},
172-
"default": {
173-
"sqlparse": {
174-
"hashes": [
175-
"sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3",
176-
"sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c"
177-
],
178-
"index": "pypi",
179-
"version": "==0.5.0"
180-
}
181-
},
182-
"develop": {}
183-
}
184-
"""
185-
186-
187-
@pytest.fixture
188-
def pipfile_lock_with_vuln() -> str:
189-
return PIPFILE_LOCK_WITH_VULN
190-
191-
19263
def clean_directory(path: Path):
19364
for filepath in path.iterdir():
19465
if filepath.is_file():

0 commit comments

Comments
 (0)