Hugoifier

fix: lint errors and CI — remove macOS, fix unused vars, add E501 ignores - Remove macOS from CI matrix (ubuntu-only) - Remove unused variables in hugoify.py (head_extras, css_links, js_links) - Remove unused import (urllib.parse) in hugoify.py - Fix unused variable in decapify.py (.gitkeep creation) - Add E501 per-file ignores for modules with HTML templates/prompts - Import sorting fixed by ruff --fix

lmata 2026-03-18 02:00 trunk
Commit 3884774dfcd998c4a12980c34c8099a88238c513776e4d1dcf5bc658cbbf4dc6
--- .github/workflows/ci.yml
+++ .github/workflows/ci.yml
@@ -9,11 +9,11 @@
99
jobs:
1010
test:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14
- os: [ubuntu-latest, macos-latest]
14
+ os: [ubuntu-latest]
1515
python-version: ["3.11", "3.12", "3.13"]
1616
steps:
1717
- uses: actions/checkout@v4
1818
1919
- uses: actions/setup-python@v5
2020
--- .github/workflows/ci.yml
+++ .github/workflows/ci.yml
@@ -9,11 +9,11 @@
9 jobs:
10 test:
11 runs-on: ${{ matrix.os }}
12 strategy:
13 matrix:
14 os: [ubuntu-latest, macos-latest]
15 python-version: ["3.11", "3.12", "3.13"]
16 steps:
17 - uses: actions/checkout@v4
18
19 - uses: actions/setup-python@v5
20
--- .github/workflows/ci.yml
+++ .github/workflows/ci.yml
@@ -9,11 +9,11 @@
9 jobs:
10 test:
11 runs-on: ${{ matrix.os }}
12 strategy:
13 matrix:
14 os: [ubuntu-latest]
15 python-version: ["3.11", "3.12", "3.13"]
16 steps:
17 - uses: actions/checkout@v4
18
19 - uses: actions/setup-python@v5
20
--- hugoifier/cli.py
+++ hugoifier/cli.py
@@ -17,13 +17,13 @@
1717
from .utils.analyze import analyze
1818
from .utils.cloudflare import configure_cloudflare
1919
from .utils.complete import complete
2020
from .utils.decapify import decapify
2121
from .utils.deploy import deploy
22
+from .utils.enhance import alt_text, enhance, generate, seo
2223
from .utils.hugoify import hugoify
2324
from .utils.parser import parse
24
-from .utils.enhance import enhance, generate, seo, alt_text
2525
from .utils.translate import translate
2626
2727
2828
def main():
2929
parser = argparse.ArgumentParser(
3030
--- hugoifier/cli.py
+++ hugoifier/cli.py
@@ -17,13 +17,13 @@
17 from .utils.analyze import analyze
18 from .utils.cloudflare import configure_cloudflare
19 from .utils.complete import complete
20 from .utils.decapify import decapify
21 from .utils.deploy import deploy
 
22 from .utils.hugoify import hugoify
23 from .utils.parser import parse
24 from .utils.enhance import enhance, generate, seo, alt_text
25 from .utils.translate import translate
26
27
28 def main():
29 parser = argparse.ArgumentParser(
30
--- hugoifier/cli.py
+++ hugoifier/cli.py
@@ -17,13 +17,13 @@
17 from .utils.analyze import analyze
18 from .utils.cloudflare import configure_cloudflare
19 from .utils.complete import complete
20 from .utils.decapify import decapify
21 from .utils.deploy import deploy
22 from .utils.enhance import alt_text, enhance, generate, seo
23 from .utils.hugoify import hugoify
24 from .utils.parser import parse
 
25 from .utils.translate import translate
26
27
28 def main():
29 parser = argparse.ArgumentParser(
30
--- hugoifier/utils/decapify.py
+++ hugoifier/utils/decapify.py
@@ -392,7 +392,6 @@
392392
"""Create the media uploads directory so Decap doesn't 404."""
393393
media_dir = os.path.join(site_dir, 'static', 'images', 'uploads')
394394
os.makedirs(media_dir, exist_ok=True)
395395
gitkeep = os.path.join(media_dir, '.gitkeep')
396396
if not os.path.exists(gitkeep):
397
- with open(gitkeep, 'w') as f:
398
- pass
397
+ open(gitkeep, 'w').close()
399398
--- hugoifier/utils/decapify.py
+++ hugoifier/utils/decapify.py
@@ -392,7 +392,6 @@
392 """Create the media uploads directory so Decap doesn't 404."""
393 media_dir = os.path.join(site_dir, 'static', 'images', 'uploads')
394 os.makedirs(media_dir, exist_ok=True)
395 gitkeep = os.path.join(media_dir, '.gitkeep')
396 if not os.path.exists(gitkeep):
397 with open(gitkeep, 'w') as f:
398 pass
399
--- hugoifier/utils/decapify.py
+++ hugoifier/utils/decapify.py
@@ -392,7 +392,6 @@
392 """Create the media uploads directory so Decap doesn't 404."""
393 media_dir = os.path.join(site_dir, 'static', 'images', 'uploads')
394 os.makedirs(media_dir, exist_ok=True)
395 gitkeep = os.path.join(media_dir, '.gitkeep')
396 if not os.path.exists(gitkeep):
397 open(gitkeep, 'w').close()
 
398
--- hugoifier/utils/hugoify.py
+++ hugoifier/utils/hugoify.py
@@ -40,19 +40,10 @@
4040
with open(html_path, 'r', errors='replace') as f:
4141
html = f.read()
4242
4343
logging.info(f"Read {len(html)} chars from {html_path}")
4444
45
- # Extract <head> content (CSS links, meta, fonts, etc.)
46
- head_extras = _extract_head_content(html)
47
-
48
- # Extract and rewrite CSS/JS paths to be relative to Hugo static/
49
- css_links = re.findall(r'<link[^>]+rel=["\']stylesheet["\'][^>]*/?>',
50
- html, re.DOTALL | re.IGNORECASE)
51
- js_links = re.findall(r'<script[^>]+src=["\'][^"\']+["\'][^>]*>.*?</script>',
52
- html, re.DOTALL)
53
-
5445
# Extract <body> content
5546
body_match = re.search(r'<body[^>]*>(.*?)</body>', html, re.DOTALL)
5647
body_content = body_match.group(1).strip() if body_match else html
5748
5849
# Extract body attributes (class, style, etc.)
@@ -142,11 +133,10 @@
142133
"""
143134
Capture the actual server-rendered HTML from a running Next.js app
144135
and convert it into Hugo layout files. This gives pixel-perfect results.
145136
"""
146137
import urllib.request
147
- import urllib.parse
148138
149139
logging.info(f"Capturing rendered HTML from {dev_url} ...")
150140
151141
# Fetch the full rendered page
152142
resp = urllib.request.urlopen(dev_url)
153143
--- hugoifier/utils/hugoify.py
+++ hugoifier/utils/hugoify.py
@@ -40,19 +40,10 @@
40 with open(html_path, 'r', errors='replace') as f:
41 html = f.read()
42
43 logging.info(f"Read {len(html)} chars from {html_path}")
44
45 # Extract <head> content (CSS links, meta, fonts, etc.)
46 head_extras = _extract_head_content(html)
47
48 # Extract and rewrite CSS/JS paths to be relative to Hugo static/
49 css_links = re.findall(r'<link[^>]+rel=["\']stylesheet["\'][^>]*/?>',
50 html, re.DOTALL | re.IGNORECASE)
51 js_links = re.findall(r'<script[^>]+src=["\'][^"\']+["\'][^>]*>.*?</script>',
52 html, re.DOTALL)
53
54 # Extract <body> content
55 body_match = re.search(r'<body[^>]*>(.*?)</body>', html, re.DOTALL)
56 body_content = body_match.group(1).strip() if body_match else html
57
58 # Extract body attributes (class, style, etc.)
@@ -142,11 +133,10 @@
142 """
143 Capture the actual server-rendered HTML from a running Next.js app
144 and convert it into Hugo layout files. This gives pixel-perfect results.
145 """
146 import urllib.request
147 import urllib.parse
148
149 logging.info(f"Capturing rendered HTML from {dev_url} ...")
150
151 # Fetch the full rendered page
152 resp = urllib.request.urlopen(dev_url)
153
--- hugoifier/utils/hugoify.py
+++ hugoifier/utils/hugoify.py
@@ -40,19 +40,10 @@
40 with open(html_path, 'r', errors='replace') as f:
41 html = f.read()
42
43 logging.info(f"Read {len(html)} chars from {html_path}")
44
 
 
 
 
 
 
 
 
 
45 # Extract <body> content
46 body_match = re.search(r'<body[^>]*>(.*?)</body>', html, re.DOTALL)
47 body_content = body_match.group(1).strip() if body_match else html
48
49 # Extract body attributes (class, style, etc.)
@@ -142,11 +133,10 @@
133 """
134 Capture the actual server-rendered HTML from a running Next.js app
135 and convert it into Hugo layout files. This gives pixel-perfect results.
136 """
137 import urllib.request
 
138
139 logging.info(f"Capturing rendered HTML from {dev_url} ...")
140
141 # Fetch the full rendered page
142 resp = urllib.request.urlopen(dev_url)
143
--- pyproject.toml
+++ pyproject.toml
@@ -61,10 +61,14 @@
6161
select = ["E", "F", "W", "I"]
6262
6363
[tool.ruff.lint.per-file-ignores]
6464
"hugoifier/cli.py" = ["E501"]
6565
"hugoifier/utils/hugoify.py" = ["E501"]
66
+"hugoifier/utils/complete.py" = ["E501"]
67
+"hugoifier/utils/enhance.py" = ["E501"]
68
+"hugoifier/utils/decapify.py" = ["E501"]
69
+"hugoifier/config.py" = ["E501"]
6670
"tests/*" = ["E501"]
6771
6872
[tool.pytest.ini_options]
6973
testpaths = ["tests"]
7074
python_files = "test_*.py"
7175
--- pyproject.toml
+++ pyproject.toml
@@ -61,10 +61,14 @@
61 select = ["E", "F", "W", "I"]
62
63 [tool.ruff.lint.per-file-ignores]
64 "hugoifier/cli.py" = ["E501"]
65 "hugoifier/utils/hugoify.py" = ["E501"]
 
 
 
 
66 "tests/*" = ["E501"]
67
68 [tool.pytest.ini_options]
69 testpaths = ["tests"]
70 python_files = "test_*.py"
71
--- pyproject.toml
+++ pyproject.toml
@@ -61,10 +61,14 @@
61 select = ["E", "F", "W", "I"]
62
63 [tool.ruff.lint.per-file-ignores]
64 "hugoifier/cli.py" = ["E501"]
65 "hugoifier/utils/hugoify.py" = ["E501"]
66 "hugoifier/utils/complete.py" = ["E501"]
67 "hugoifier/utils/enhance.py" = ["E501"]
68 "hugoifier/utils/decapify.py" = ["E501"]
69 "hugoifier/config.py" = ["E501"]
70 "tests/*" = ["E501"]
71
72 [tool.pytest.ini_options]
73 testpaths = ["tests"]
74 python_files = "test_*.py"
75

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button