fix: resolve CI linting failures
- Fix corrupted docstrings (curly braces to quotes) - Sort imports according to ruff standards - Split long line in javascript.py for readability - Add module-level docstrings to test files - Add docstring to BaseGenerator.__init__ method - Fix regex pattern in RustDetector
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
"""JavaScript endpoint detector for Express and Fastify."""
|
"""JavaScript endpoint detector for Express and Fastify."""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from docgen.models import Endpoint, HTTPMethod
|
|
||||||
from docgen.detectors.base import BaseDetector
|
from docgen.detectors.base import BaseDetector
|
||||||
|
from docgen.models import Endpoint, HTTPMethod
|
||||||
|
|
||||||
|
|
||||||
class JavaScriptDetector(BaseDetector):
|
class JavaScriptDetector(BaseDetector):
|
||||||
@@ -59,7 +61,12 @@ class JavaScriptDetector(BaseDetector):
|
|||||||
|
|
||||||
def _detect_framework(self, content: str) -> Optional[str]:
|
def _detect_framework(self, content: str) -> Optional[str]:
|
||||||
"""Auto-detect the JavaScript framework."""
|
"""Auto-detect the JavaScript framework."""
|
||||||
if "from '@fastify/" in content or "from 'fastify'" in content or "import fastify" in content:
|
fastify_patterns = [
|
||||||
|
"from '@fastify/",
|
||||||
|
"from 'fastify'",
|
||||||
|
"import fastify",
|
||||||
|
]
|
||||||
|
if any(p in content for p in fastify_patterns):
|
||||||
return "fastify"
|
return "fastify"
|
||||||
if 'require("fastify")' in content or "require('fastify')" in content:
|
if 'require("fastify")' in content or "require('fastify')" in content:
|
||||||
return "fastify"
|
return "fastify"
|
||||||
|
|||||||
Reference in New Issue
Block a user