Skip to content

Fix import ordering for isort compliance#10

Merged
pangerlkr merged 2 commits intomainfrom
claude/fix-ci-cd-pipeline-failure
Feb 16, 2026
Merged

Fix import ordering for isort compliance#10
pangerlkr merged 2 commits intomainfrom
claude/fix-ci-cd-pipeline-failure

Conversation

@Claude
Copy link
Contributor

@Claude Claude AI commented Feb 16, 2026

The CI/CD pipeline was failing on isort checks due to incorrect import ordering in gateway files.

Changes

  • gateway/main_production.py: Reordered imports to place local modules (config, database) before third-party imports (FastAPI, pydantic, etc.) per PEP 8 import grouping
  • gateway/database.py: Reformatted multi-line sessionmaker call to single line
  • pyproject.toml: Added configuration to ensure black and isort compatibility with consistent line length (127) and import formatting
# Before
import redis
from fastapi import FastAPI
from config import get_settings

# After  
import redis
from config import get_settings
from fastapi import FastAPI

Co-authored-by: pangerlkr <73515951+pangerlkr@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Fix CI/CD pipeline and linting issues Fix import ordering for isort compliance Feb 16, 2026
@Claude Claude AI requested a review from pangerlkr February 16, 2026 15:18
@pangerlkr pangerlkr marked this pull request as ready for review February 16, 2026 15:19
Copilot AI review requested due to automatic review settings February 16, 2026 15:19
@pangerlkr pangerlkr merged commit c0fae8b into main Feb 16, 2026
10 of 11 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to fix import ordering to comply with isort checks in the CI/CD pipeline, but the import ordering is incorrect. The PR adds pyproject.toml configuration for black and isort, reorders imports in gateway/main_production.py, and reformats some long lines to fit within the 127-character limit.

Changes:

  • Added pyproject.toml with black and isort configuration (line length 127, isort profile "black")
  • Incorrectly reordered imports in gateway/main_production.py by placing local modules before third-party imports (opposite of PEP 8 requirements)
  • Reformatted multi-line statements to single lines in gateway/main_production.py and gateway/database.py

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Adds black and isort configuration with line length 127 and compatibility settings
gateway/main_production.py Incorrectly reorders imports (places local before third-party instead of after), and reformats long lines
gateway/database.py Reformats sessionmaker initialization from multi-line to single line

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 9 to 17
@@ -14,9 +16,6 @@
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import ordering is incorrect according to PEP 8 and isort standards. Per PEP 8, imports should be grouped in this order: (1) standard library, (2) third-party, (3) local application imports.

Currently, local imports (config, database) are placed before third-party imports (fastapi, pydantic, slowapi, etc.). They should be placed after all third-party imports, with a blank line separating the groups. The correct order should be:

import redis
from fastapi import FastAPI, HTTPException, Request, status
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
from pydantic import BaseModel, Field, validator
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded
from slowapi.util import get_remote_address

from config import get_settings
from database import DatabaseManager, IOCRecord, ReconTask

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +10
from config import get_settings
from database import DatabaseManager, IOCRecord, ReconTask
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description incorrectly states that local modules should be placed "before third-party imports per PEP 8 import grouping." This is backwards - PEP 8 actually requires local application imports to come AFTER third-party imports, not before. The correct order per PEP 8 is: (1) standard library, (2) third-party, (3) local. This discrepancy between the description and the actual PEP 8 standard suggests a misunderstanding of the import ordering rules.

Copilot uses AI. Check for mistakes.
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.

3 participants