Skip to content

Enable FA linter rules for enforcing type annotations #8271

@HyeockJinKim

Description

@HyeockJinKim

User Story

As a Backend.AI developer, I want to enable FA (flake8-annotations) rules to ensure complete type annotations across the codebase so that code quality and maintainability are improved.

Background

FA rules enforce type annotations on functions, methods, and variables. This ensures:

  • All function parameters have type hints
  • All function return types are annotated
  • Class attributes and variables are properly typed
  • No implicit Any types

Implementation Details

  • Enable FA rules in ruff configuration (FA100, FA102, etc.)
  • Add missing type annotations to functions and methods
  • Add missing return type annotations
  • Add type hints to class attributes and module-level variables
  • Fix all existing FA violations across the codebase
  • Update code style guidelines to require type annotations

Acceptance Criteria

  • FA rules are enabled in ruff.toml
  • All existing violations are fixed
  • All functions have parameter and return type annotations
  • Class attributes have type annotations
  • CI/CD linter checks pass
  • Code style documentation is updated

Technical Notes

  • May be a large effort depending on existing violations
  • Consider gradual rollout per package
  • Use mypy to verify type correctness
  • Avoid using Any type where possible

JIRA Issue: BA-4057

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions