Skip to content

Commit 74df04e

Browse files
authored
Merge pull request #88 from thawn/copilot/add-pre-commit-hooks
Add pre-commit hooks with Black formatter and flake8 linter
2 parents 7c1d90e + 220c2ce commit 74df04e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1542
-1142
lines changed

.flake8

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[flake8]
2+
max-line-length = 88
3+
# Black-compatible options
4+
# E203: Whitespace before ':' (conflicts with Black)
5+
# E501: Line too long (handled by Black where possible)
6+
# W503: Line break before binary operator (conflicts with Black)
7+
extend-ignore = E203,E501,W503
8+
9+
# Enforce all other errors
10+
select = E,W,F,B,C
11+
12+
exclude =
13+
.git,
14+
__pycache__,
15+
build,
16+
dist,
17+
.eggs,
18+
*.egg,
19+
.venv,
20+
venv,
21+
node_modules,

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ SQLite connection uses `check_same_thread=False` for Flask's multi-threaded envi
166166
4. Return JSON for AJAX or render template for pages
167167

168168
### Fixing E2E Test Issues
169-
1. Before re-running specific test, start the server manually:
169+
1. Before re-running specific test, start the server manually:
170170
```bash
171171
./ttmp32gme > /tmp/server.log 2>&1 & sleep(2) # Start server in background
172172
```

.github/workflows/copilot-setup-steps.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ on:
1212
jobs:
1313
copilot-setup-steps:
1414
runs-on: ubuntu-latest
15-
15+
1616
permissions:
1717
contents: read
18-
18+
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
2222
# fetch-depth will be overridden
23-
23+
2424
- name: Set up Python
2525
uses: actions/setup-python@v5
2626
with:
2727
python-version: '3.12'
28-
28+
2929
- name: Install uv
3030
uses: astral-sh/setup-uv@v4
3131
with:
3232
version: "latest"
33-
33+
3434
- name: Install system dependencies
3535
run: |
3636
sudo apt-get update
3737
sudo apt-get install -y wget unzip
38-
38+
3939
- name: Install Chrome and ChromeDriver
4040
run: |
4141
# Install Chrome
@@ -52,60 +52,60 @@ jobs:
5252
sudo mv chromedriver-linux64/chromedriver /usr/local/bin/
5353
sudo chmod +x /usr/local/bin/chromedriver
5454
rm -rf chromedriver-linux64*
55-
55+
5656
- name: Install tttool (from releases)
5757
run: |
5858
# Download a specific working version from GitHub releases
5959
# Using the correct URL pattern: tttool-{version}.zip
6060
TTTOOL_VERSION="1.8.1"
6161
echo "Installing tttool version $TTTOOL_VERSION"
62-
62+
6363
# Use system temp directory for extraction
6464
TEMP_DIR=$(mktemp -d)
6565
cd "$TEMP_DIR"
66-
66+
6767
wget -q "https://github.com/entropia/tip-toi-reveng/releases/download/${TTTOOL_VERSION}/tttool-${TTTOOL_VERSION}.zip"
68-
68+
6969
# Extract into temp directory
7070
unzip -q "tttool-${TTTOOL_VERSION}.zip"
71-
71+
7272
# Move the binary to /usr/local/bin
7373
chmod +x tttool
7474
sudo mv tttool /usr/local/bin/
75-
75+
7676
# Cleanup - change permissions recursively then remove
7777
cd "$GITHUB_WORKSPACE"
7878
chmod -R u+w "$TEMP_DIR" || true
7979
rm -rf "$TEMP_DIR"
80-
80+
8181
# Verify installation
8282
tttool --help || { echo "Error: tttool installation failed"; exit 1; }
83-
83+
8484
- name: Install ffmpeg (static build)
8585
run: |
8686
wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
8787
tar -xf ffmpeg-release-amd64-static.tar.xz
8888
sudo mv ffmpeg-*-amd64-static/ffmpeg /usr/local/bin/
8989
sudo mv ffmpeg-*-amd64-static/ffprobe /usr/local/bin/
9090
rm -rf ffmpeg-*-amd64-static*
91-
91+
9292
- name: Install Python dependencies
9393
run: |
9494
uv pip install --system -e ".[test]"
95-
95+
9696
- name: Prepare test fixtures
9797
run: |
9898
# Bundled test audio file already exists in repo
9999
ls -lh tests/fixtures/test_audio.mp3
100-
100+
101101
# Create test cover image if needed
102102
if [ ! -f tests/fixtures/test_cover.jpg ]; then
103103
python3 -c "from PIL import Image; img = Image.new('RGB', (100, 100), color='green'); img.save('tests/fixtures/test_cover.jpg')"
104104
fi
105-
105+
106106
# Verify files exist
107107
ls -lh tests/fixtures/
108-
108+
109109
- name: Verify setup
110110
run: |
111111
echo "Setup complete. Verifying installations..."

.github/workflows/e2e-tests.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@ on:
1313

1414
permissions:
1515
contents: read
16-
16+
1717
jobs:
1818
e2e-tests:
1919
name: End-to-End Tests with Selenium
2020
runs-on: ubuntu-latest
2121
# Only run when 'run-e2e-tests' label is added or workflow is manually dispatched
2222
# if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'run-e2e-tests'
23-
23+
2424
permissions:
2525
contents: read
26-
26+
2727
steps:
2828
- uses: actions/checkout@v4
2929
with:
3030
fetch-depth: 0 # Needed for setuptools-scm
31-
31+
3232
- name: Set up Python
3333
uses: actions/setup-python@v5
3434
with:
3535
python-version: '3.12'
36-
36+
3737
- name: Install uv
3838
uses: astral-sh/setup-uv@v4
3939
with:
4040
version: "latest"
41-
41+
4242
- name: Install system dependencies
4343
run: |
4444
sudo apt-get update
4545
sudo apt-get install -y wget unzip
46-
46+
4747
- name: Install Chrome and ChromeDriver
4848
run: |
4949
# Install Chrome
@@ -60,64 +60,64 @@ jobs:
6060
sudo mv chromedriver-linux64/chromedriver /usr/local/bin/
6161
sudo chmod +x /usr/local/bin/chromedriver
6262
rm -rf chromedriver-linux64*
63-
63+
6464
- name: Install tttool (from releases)
6565
run: |
6666
# Download a specific working version from GitHub releases
6767
# Using the correct URL pattern: tttool-{version}.zip
6868
TTTOOL_VERSION="1.8.1"
6969
echo "Installing tttool version $TTTOOL_VERSION"
70-
70+
7171
# Use system temp directory for extraction
7272
TEMP_DIR=$(mktemp -d)
7373
cd "$TEMP_DIR"
74-
74+
7575
wget -q "https://github.com/entropia/tip-toi-reveng/releases/download/${TTTOOL_VERSION}/tttool-${TTTOOL_VERSION}.zip"
76-
76+
7777
# Extract into temp directory
7878
unzip -q "tttool-${TTTOOL_VERSION}.zip"
79-
79+
8080
# Move the binary to /usr/local/bin
8181
chmod +x tttool
8282
sudo mv tttool /usr/local/bin/
83-
83+
8484
# Cleanup - change permissions recursively then remove
8585
cd "$GITHUB_WORKSPACE"
8686
chmod -R u+w "$TEMP_DIR" || true
8787
rm -rf "$TEMP_DIR"
88-
88+
8989
# Verify installation
9090
tttool --help || { echo "Error: tttool installation failed"; exit 1; }
91-
91+
9292
- name: Install ffmpeg (static build)
9393
run: |
9494
wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
9595
tar -xf ffmpeg-release-amd64-static.tar.xz
9696
sudo mv ffmpeg-*-amd64-static/ffmpeg /usr/local/bin/
9797
sudo mv ffmpeg-*-amd64-static/ffprobe /usr/local/bin/
9898
rm -rf ffmpeg-*-amd64-static*
99-
99+
100100
- name: Install Python dependencies
101101
run: |
102102
uv pip install --system -e ".[test]"
103-
103+
104104
- name: Prepare test fixtures
105105
run: |
106106
# Bundled test audio file already exists in repo
107107
ls -lh tests/fixtures/test_audio.mp3
108-
108+
109109
# Create test cover image if needed
110110
if [ ! -f tests/fixtures/test_cover.jpg ]; then
111111
python3 -c "from PIL import Image; img = Image.new('RGB', (100, 100), color='green'); img.save('tests/fixtures/test_cover.jpg')"
112112
fi
113-
113+
114114
# Verify files exist
115115
ls -lh tests/fixtures/
116-
116+
117117
- name: Run E2E tests with pytest (includes tttool tests)
118118
run: |
119119
pytest tests/e2e/ -v --tb=short --html=e2e-report.html --self-contained-html
120-
120+
121121
- name: Upload test report
122122
uses: actions/upload-artifact@v4
123123
with:

.github/workflows/javascript-tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12-
12+
1313
strategy:
1414
matrix:
1515
node-version: [18.x, 20.x]
16-
16+
1717
steps:
1818
- uses: actions/checkout@v4
19-
19+
2020
- name: Setup Node.js ${{ matrix.node-version }}
2121
uses: actions/setup-node@v4
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424
cache: 'npm'
25-
25+
2626
- name: Install dependencies
2727
run: npm ci
28-
28+
2929
- name: Run tests
3030
run: npm test
31-
31+
3232
- name: Generate coverage report
3333
run: npm run test:coverage
34-
34+
3535
- name: Upload coverage reports
3636
uses: codecov/codecov-action@v3
3737
with:

0 commit comments

Comments
 (0)