Skip to content

Commit 09aa62c

Browse files
committed
chore: fix test failed
1 parent 0f7faff commit 09aa62c

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

.flake8

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203, E501, W503
4+
5+
# Exclude Ghidra Jython scripts - they use Ghidra's runtime globals
6+
# (currentProgram, getScriptArgs, etc.) which are injected at runtime
7+
exclude =
8+
ghidra_decompile.py,
9+
ghidra_decompile_elf.py,
10+
__pycache__,
11+
.git,
12+
*.pyc

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install black flake8
28+
pip install black flake8 isort
2929
3030
- name: Check formatting with black
3131
run: |
3232
python -m black --check --diff libsurgeon.py evaluate_quality.py tests/*.py
3333
3434
- name: Lint with flake8
3535
run: |
36-
python -m flake8 libsurgeon.py evaluate_quality.py tests/*.py --max-line-length=88 --extend-ignore=E203,E501,W503
36+
python -m flake8 .
3737
3838
# ============================================================
3939
# Unit Tests

libsurgeon.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from datetime import datetime
3535
from enum import Enum
3636
from pathlib import Path
37-
from typing import Dict, List, Optional, Tuple
37+
from typing import Dict, List, Optional
3838

3939
# ============================================================
4040
# Color and Display Utilities
@@ -176,7 +176,7 @@ def show_progress(
176176
def show_progress_final(total: int, elapsed: int):
177177
"""Show final completed progress bar"""
178178
bar = draw_progress_bar(total, total)
179-
print(f"\r\033[K\n\033[K\n", end="")
179+
print("\r\033[K\n\033[K\n", end="")
180180
print("\033[2A", end="")
181181
print(
182182
f"{Colors.GREEN}[{bar}]{Colors.NC} {Colors.BOLD}100%{Colors.NC} ({total}/{total}) | Total: {format_time(elapsed)}"
@@ -774,7 +774,7 @@ def process_elf_file(
774774
log_info(f"Decompiling {total_funcs} functions...")
775775
print() # Space for progress bar
776776
print()
777-
except:
777+
except (ValueError, IndexError):
778778
pass
779779
elif "[PROGRESS]" in line and analysis_done:
780780
try:
@@ -794,7 +794,7 @@ def process_elf_file(
794794
show_progress(
795795
current_func, total_funcs, elapsed, last_func_name, eta
796796
)
797-
except:
797+
except (ValueError, IndexError):
798798
pass
799799
elif "ANALYZING" in line and not analysis_done:
800800
print(

tests/test_libsurgeon.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
is_archive_file,
3737
is_elf_file,
3838
matches_pattern,
39-
show_progress,
40-
show_progress_final,
4139
)
4240

4341
# Path setup is done in conftest.py

0 commit comments

Comments
 (0)