Skip to content

Add pre-commit configuration and fix linting issues - #17486

Closed
pminko101 wants to merge 7 commits into
AUTOMATIC1111:devfrom
pminko101:pminko101-urban-fortnight
Closed

pminko101 wants to merge 7 commits into
AUTOMATIC1111:devfrom
pminko101:pminko101-urban-fortnight

Conversation

@pminko101

Copy link
Copy Markdown

Description

  • Adds .pre-commit-config.yaml to enable automated code quality checks on every commit
  • Configures pre-commit hooks for Python (Ruff) and JavaScript (ESLint) linting and formatting
  • Fixes F811 linting errors in modules/processing.py by removing duplicate field definitions that were shadowed by properties
  • Runs ruff-format across the codebase to ensure consistent Python code formatting

This PR establishes a development workflow where contributors automatically run linters and formatters before each commit, improving code consistency and reducing CI failures.

Changes

  • New file: .pre-commit-config.yaml - Configures Ruff (linting/formatting) and ESLint (JS linting) with ESLint v8 for .eslintrc.js compatibility
  • Fixed: modules/processing.py - Removed duplicate sd_model and mask_blur field definitions that conflicted with their @Property decorators
  • Formatted: 168 files across the codebase formatted consistently by ruff-format

Checklist:

- Create .pre-commit-config.yaml with Ruff (Python), ESLint (JavaScript), and formatting hooks
- Fix F811 errors in modules/processing.py by removing duplicate field definitions
  - Remove sd_model field (replaced by @Property)
  - Remove mask_blur field (replaced by @Property)
- Run ruff-format across codebase for consistent Python formatting

Enables code quality checks on every commit with pre-commit framework.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pminko101
pminko101 changed the base branch from master to dev September 10, 2026 09:51
Copilot and others added 6 commits September 10, 2026 21:43
# Conflicts:
#	modules/api/api.py
#	modules/cmd_args.py
#	modules/extras.py
#	modules/hashes.py
#	modules/images.py
#	modules/launch_utils.py
#	modules/modelloader.py
#	modules/processing.py
#	modules/scripts_auto_postprocessing.py
#	modules/scripts_postprocessing.py
#	modules/sd_disable_initialization.py
#	modules/sd_hijack_optimizations.py
#	modules/sd_models.py
#	modules/sd_schedulers.py
#	modules/shared_options.py
#	modules/textual_inversion/textual_inversion.py
#	modules/ui_components.py
#	modules/ui_extra_networks.py
#	modules/ui_loadsave.py
#	modules/upscaler.py
#	scripts/postprocessing_codeformer.py
#	scripts/postprocessing_gfpgan.py
#	scripts/postprocessing_upscale.py
#	scripts/xyz_grid.py
Fix the test-server startup regression by restoring the names re-exported
from modules.paths. Several modules and builtin extension preload scripts
import data_path/models_path and related values from modules.paths; dropping
those imports caused CI startup to fail before tests ran.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CPU test job reached web UI startup after the paths.py fix but then failed
because modules.shared no longer re-exported the paths_internal values used by
startup code. Restore the original re-exports so shared.sd_configs_path,
shared.models_path, and related attributes remain available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The CPU test job now starts the app far enough to build the extensions UI, but
that code still expects modules.ui.wrap_gradio_call to exist via the ui module's
call_queue imports. Restore that import so the test server can finish starting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The earlier lint cleanup removed StableDiffusionProcessing dataclass fields that
used to accept sd_model and mask_blur constructor arguments. Startup now works,
but API and UI call sites were still passing those legacy kwargs, causing 500s
in txt2img/img2img tests. Stop passing sd_model explicitly and map mask_blur
to mask_blur_x/mask_blur_y.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add explicit __all__ exports for the re-exported names in modules.paths,
modules.shared, and modules.ui so Ruff no longer removes or flags the imports
that other modules access through those module namespaces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@w-e-w w-e-w closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants