[flake8]
# black owns formatting and line length; flake8 is here for what black cannot
# see -- unused imports, shadowed names, unreachable code.
#
# Rewritten for this package.  The previous version was legacy's file copied
# verbatim, with per-file-ignores naming src/gasfir/kernels.py and friends --
# paths that do not exist here -- so it was silently exempting nothing and
# checking a source tree that was not ours.
max-line-length = 88

# E203  whitespace before ':'  — black inserts it deliberately in slices
# W503/W504  line break before/after a binary operator — mutually exclusive
#            rules, and black picks one of them
# E501  line length — black --check already enforces this, and duplicating it
#       only turns one problem into two failures
extend-ignore = E203,W503,W504,E501

exclude =
    .git,
    __pycache__,
    .pytest_cache,
    dist,
    build,
    docs/_build,
    # Regenerates reference data by importing legacy gasfir, which is not
    # installed here; it is documentation of provenance, not live code.
    tests/golden,
    scratch,
    Data,
    Data_to_archive,

per-file-ignores =
    # The package __init__ deliberately imports out of order: fast-math flags must
    # reach XLA_FLAGS *before* `import jax`, so enable_fast_math() runs first
    # (E402).  Everything else it imports is a re-export forming the public API,
    # which flake8 reads as unused (F401).
    src/gasfir/__init__.py: E402, F401
    # `l` is the angular-momentum quantum number and `m` its projection -- the
    # standard notation, and `l` is part of adk_rate's signature and its
    # static_argnames, so renaming it would change the public API to satisfy a
    # rule about `l` looking like `1`.
    src/gasfir/quasistatic.py: E741
    # Benchmarks put the package on sys.path before importing it, so their
    # imports cannot all sit at the top of the file.
    # `I` is intensity and `E` field amplitude -- physics notation (E741).
    benchmarks/*.py: E402, E741, E731
    # Tests: E402 for the same reason.  E731/E741 are allowed because a test
    # that deliberately builds a one-line lambda or indexes with `l` is clearer
    # for it, and renaming to satisfy a style rule would obscure the point.
    tests/*.py: E402, E731, E741
