[tool.black] line-length = 120 [tool.isort] profile = "black" line_length = 120 [tool.pylint.BASIC] good-names = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "ex", "Run", "_", "x", "y", "z" ] [tool.pylint.main] # https://github.com/pylint-dev/pylint/issues/3242#issuecomment-776482259 # Please don't use ** for the pattern. It will cause pylint to crash. # the crash error message would like: # re.error: multiple repeat at position 41 ignore-paths = [".*/examples/directml/llm/chat_app/.*"] [tool.pylint.messages_control] disable = [ # TODO:(myguo): consider remove them in the blacklist "broad-exception-caught", "c-extension-no-member", "cyclic-import", # Disable cyclic-import because it is pylint bug "consider-using-f-string", "consider-using-from-import", "format", "expression-not-assigned", "line-too-long", "import-error", "import-outside-toplevel", "invalid-name", "no-else-continue", "no-else-raise", "no-else-return", "no-name-in-module", "no-member", "no-self-argument", "too-few-public-methods", "too-many-arguments", "too-many-branches", "too-many-function-args", "too-many-instance-attributes", "too-many-locals", "too-many-nested-blocks", "too-many-public-methods", "too-many-return-statements", "too-many-statements", "missing-docstring", "fixme", "unspecified-encoding", "unused-argument" ] [tool.ruff] line-length = 120 target-version = "py38" [tool.ruff.lint] select = [ "A", # flake8-builtins "B", # flake8-bugbear "C4", # flake8-comprehensions "CPY", # flake8-copyright "D", # flake8-docstrings, "E", # pycodestyle "F", # Pyflakes "FLY", # flake8-flynt "G", # flake8-logging-format "ICN", # flake8-import-conventions "INP", # flake8-no-pep420 "INT", # flake8-gettext "ISC", # flake8-implicit-str-concat "LOG", # flake8-logging "N", # pep8-naming "NPY", # numpy "PD", # flake8-pandas "PERF", # Perflint "PGH", # pygrep-hooks "PIE", # flake8-pie "PLC", # pylint conventions "PLE", # pylint errors "PLW", # pylint warnings "PT", # flake8-pytest "PTH", # flake8-use-pathlib "PYI", # flake8-pyi "Q", # flake8-quotes "RET", # flake8-return "RSE", # flake8-raise "RUF", # Ruff-specific rules "SIM", # flake8-simplify "T10", # flake8-debugger "T20", # flake8-print "TCH", # flake8-type-checking "TD", # flake8-todo "TID", # flake8-tidy-imports "TRY", # tryceratops "UP", # pyupgrade "W", # pycodestyle "YTT" # flake8-2020, ] # NOTE: Refrain from growing the ignore list unless for exceptional cases. # Always include a comment to explain why. ignore = [ "B028", # FIXME: Add stacklevel to warnings "B905", # keep using less than Python 3.10. The strict is added in Python 3.10 "D100", # Ignore missing docstring in public module "D101", # Ignore missing docstring in public class "D102", # Ignore missing docstring in public method "D103", # Ignore missing docstring in public function "D104", # Ignore missing docstring in public package "D105", # Ignore missing docstring in magic method "D106", # Ignore missing docstring in public nested class "D107", # Ignore missing docstring in __init__ "D406", # Ignore new line after section name "D407", # Ignore dashed-underline-after-section "N803", # Argument casing "N812", # Allow import torch.nn.functional as F "N999", # Module names "NPY002", # np.random.Generator may not always fit our use cases "PERF203", # "try-except-in-loop" only affects Python <3.11, and the improvement is minor; can have false positives "PLW0603", # TODO: temp disable global variable check "PT004", # Ignore pytest fixture name "PT019", # Ignore pytest fixture name "PTH100", # We still support os.path.abspath "PTH103", # We still support os.makedirs "PTH106", # We still support os.rmdir "PTH107", # We still support os.remove "PTH110", # We still support os.path.exists "PTH118", # We still need support os.path.join "PTH119", # We still need support os.path.basename "PTH120", # We still need support os.path.dirname "PTH123", # we still need built-in open "RET505", # We prefer if/else clauses explicitly "RET506", # We prefer if/else clauses explicitly "RET507", # We prefer if/else clauses explicitly "RUF010", # keeping using str type explicitly "RUF013", # Ignore Optional type hints warning since it is available in Python 3.10 "SIM105", # We don't prefer use context.suppress "SIM108", # We don't encourage ternary operators "TD003", # Ignore TODO links "TRY002", # Ignore create custom exception "TRY003", # Ignore check message not defined in the exception class "TRY004", # Ignore prefer TypeError over ValueError "TRY300", # Ignore check if return in try block "UP032", # Ignore string format calls "UP038" # Ignore old isinstance hints ] ignore-init-module-imports = true unfixable = [ "F401", # Unused imports "SIM112" # Use upper case for env vars ] [tool.ruff.lint.flake8-tidy-imports] # Disallow all relative imports. ban-relative-imports = "all" [tool.ruff.lint.pep8-naming] # Allow Pydantic's `@validator` decorator to trigger class method treatment. classmethod-decorators = ["classmethod", "olive.common.pydantic_v1.validator", "olive.common.pydantic_v1.root_validator"] [tool.ruff.lint.per-file-ignores] ".azure_pipelines/**" = ["INP001"] "examples/**" = ["TID252", "INP001"] "docs/**" = ["INP001"] "test/**" = ["INP001"] "scripts/**" = ["INP001"] "examples/directml/llm/chat_app/**" = ["TID252", "UP006", "T201"] "olive/cli/**" = ["T201"]