fix: resolve CI lint and build failures
- Fixed lint path in CI workflow from src/gdiffer/ to gitignore_generator/ - Fixed verification command from gdiffer --version to gitignore --version - Removed unused imports (pathlib.Path, typing.List, os, sys, pytest, unittest.mock.patch) - Removed unused variable assignments (category, index) - Fixed f-strings without placeholders - Renamed ambiguous variable 'l' to 'line' and 'prev_line' - Added type assertion for type narrowing in template_loader.py
This commit is contained in:
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from typing import Optional
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
@@ -67,11 +66,9 @@ def generate(
|
|||||||
if template_ref.startswith("ide:"):
|
if template_ref.startswith("ide:"):
|
||||||
template_name = template_ref[4:]
|
template_name = template_ref[4:]
|
||||||
content = template_loader.get_template_content(template_name)
|
content = template_loader.get_template_content(template_name)
|
||||||
category = "ides"
|
|
||||||
else:
|
else:
|
||||||
template_name = template_ref
|
template_name = template_ref
|
||||||
content = template_loader.get_template_content(template_name)
|
content = template_loader.get_template_content(template_name)
|
||||||
category = None
|
|
||||||
|
|
||||||
if content:
|
if content:
|
||||||
content_parts.append(f"# --- {template_name} ---\n")
|
content_parts.append(f"# --- {template_name} ---\n")
|
||||||
@@ -94,14 +91,14 @@ def generate(
|
|||||||
if validate:
|
if validate:
|
||||||
summary = validator.get_summary(final_content)
|
summary = validator.get_summary(final_content)
|
||||||
if summary["errors"] > 0:
|
if summary["errors"] > 0:
|
||||||
click.echo(f"\nValidation errors found:")
|
click.echo("\nValidation errors found:")
|
||||||
for issue in summary["issues"]:
|
for issue in summary["issues"]:
|
||||||
if issue.severity == "error":
|
if issue.severity == "error":
|
||||||
click.echo(f" Line {issue.line_number}: {issue.message}")
|
click.echo(f" Line {issue.line_number}: {issue.message}")
|
||||||
if not click.confirm("Generate anyway?"):
|
if not click.confirm("Generate anyway?"):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if summary["warnings"] > 0:
|
if summary["warnings"] > 0:
|
||||||
click.echo(f"\nValidation warnings:")
|
click.echo("\nValidation warnings:")
|
||||||
for issue in summary["issues"]:
|
for issue in summary["issues"]:
|
||||||
if issue.severity == "warning":
|
if issue.severity == "warning":
|
||||||
click.echo(f" Line {issue.line_number}: {issue.message}")
|
click.echo(f" Line {issue.line_number}: {issue.message}")
|
||||||
@@ -250,7 +247,7 @@ def template_info(template: str) -> None:
|
|||||||
click.echo(f"Error: Template '{template}' not found.")
|
click.echo(f"Error: Template '{template}' not found.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
lines = [l for l in content.splitlines() if l.strip() and not l.strip().startswith("#")]
|
lines = [line for line in content.splitlines() if line.strip() and not line.strip().startswith("#")]
|
||||||
|
|
||||||
click.echo(f"Template: {template}")
|
click.echo(f"Template: {template}")
|
||||||
click.echo(f"Lines: {len(content.splitlines())}")
|
click.echo(f"Lines: {len(content.splitlines())}")
|
||||||
|
|||||||
Reference in New Issue
Block a user