Skip to content

Instantly share code, notes, and snippets.

@v3ss0n
Created February 6, 2025 15:12
Show Gist options
  • Save v3ss0n/3b0a8ac808f6930ea04e4ada62d904f4 to your computer and use it in GitHub Desktop.
Save v3ss0n/3b0a8ac808f6930ea04e4ada62d904f4 to your computer and use it in GitHub Desktop.

Revisions

  1. v3ss0n created this gist Feb 6, 2025.
    183 changes: 183 additions & 0 deletions pyproject.toml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,183 @@
    [tool.ruff]
    exclude = [
    ".bzr",
    ".direnv",
    ".eggs",
    ".git",
    ".hg",
    ".mypy_cache",
    ".nox",
    ".pants.d",
    ".ruff_cache",
    ".svn",
    ".tox",
    ".venv",
    "__pypackages__",
    "_build",
    "buck-out",
    "build",
    "dist",
    "node_modules",
    "venv",
    '__pycache__',
    "src/swparse/db/migrations/versions/*.py",
    ]
    fix = true
    line-length = 120
    lint.ignore = [
    "E501", # pycodestyle line too long, handled by black
    "D100", # pydocstyle - missing docstring in public module
    "D101", # pydocstyle - missing docstring in public class
    "D102", # pydocstyle - missing docstring in public method
    "D103", # pydocstyle - missing docstring in public function
    "D104", # pydocstyle - missing docstring in public package
    "D105", # pydocstyle - missing docstring in magic method
    "D106", # pydocstyle - missing docstring in public nested class
    "D107", # pydocstyle - missing docstring in __init__
    "D202", # pydocstyle - no blank lines allowed after function docstring
    "D205", # pydocstyle - 1 blank line required between summary line and description
    "D415", # pydocstyle - first line should end with a period, question mark, or exclamation point
    "UP037", # pyupgrade - removes quotes from type annotation
    "A003", # flake8-builtins - class attribute {name} is shadowing a python builtin
    "B010", # flake8-bugbear - do not call setattr with a constant attribute value
    "B008", # flake8-bugbear - Do not perform function call `Parameter` in argument defaultsRuff(B008)
    "RUF012", # ruff - mutable class attributes should be annotated with `typing.ClassVar`
    "ANN401", # ruff - Dynamically typed expressions (typing.Any) are disallowed
    "ANN102",
    "ANN101", # ruff - Missing type annotation for `self` in method
    "PLR0913", # ruff - Too many arguments to function call
    "PLR2004", # Magic value used in comparison
    "FBT001", # Boolean typed positional argument in function definition
    "FBT002", # Boolean default positional argument in function definition
    "FBT003", # Boolean Boolean default positional argument in function definition
    "ARG002", # Unused method argument
    "ARG001", # Unused function argument
    "TD002",
    "TD003",
    "FIX002",
    "PGH003",
    "RUF006",
    "SLF001",
    "PT007",
    'PT004',
    'PT005',
    'S603',
    "E501", # pycodestyle line too long, handled by black
    "PLW2901", # pylint - for loop variable overwritten by assignment target
    "ANN401",
    "ANN102",
    "ANN101",
    "FBT",
    "PLR0913", # too many arguments
    "PT",
    "TD",
    "PERF203", # ignore for now; investigate
    ]
    lint.select = ["ALL"]
    lint.unfixable = ["F401"]
    # Allow unused variables when underscore-prefixed.
    lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
    src = ["src", "tests/"]
    target-version = "py311"

    [tool.ruff.lint.pydocstyle]
    convention = "google"

    [tool.ruff.lint.mccabe]
    max-complexity = 12

    [tool.ruff.lint.pep8-naming]
    classmethod-decorators = [
    "classmethod",
    "sqlalchemy.ext.declarative.declared_attr",
    "sqlalchemy.orm.declared_attr.directive",
    "sqlalchemy.orm.declared_attr",
    ]

    [tool.ruff.lint.isort]
    known-first-party = ['tests', 'swparse']

    [tool.ruff.lint.per-file-ignores]
    "*/migrations/*.py" = ['D104', 'D103', 'D205', 'D212']
    "__init__.py" = ['F401', 'D104']
    "docs/\*/*.*" = ["S", "B", "DTZ", "A", "TCH", "ERA", "D", "RET", "E731", "RUF012", "FA100", "ARG001"]
    "docs/conf.py" = ["FIX002", "ARG001", "INP001"]
    "scripts/\*/*.*" = ["D", "ARG", "EM", "TRY", "G", "FBT", "INP001"]
    "scripts/*.py" = ["INP001", "ERA001"]
    "src/swparse/db/migrations/versions/*.py" = ["ANN201", "INP001"]
    "tests/*.py" = ['D103', 'S101', 'D104']

    [tool.slotscheck]
    strict-imports = false

    [tool.codespell]
    ignore-words-list = "alog"
    skip = 'pdm.lock, package-lock.json'

    [tool.mypy]
    disallow_any_generics = false
    disallow_incomplete_defs = true
    disallow_untyped_decorators = true
    disallow_untyped_defs = true
    exclude = '''(?x)(
    ^build/
    |^dist/
    |^.venv/
    |^node_modules/
    |^migrations/
    )
    '''
    implicit_reexport = false
    plugins = []
    strict = true
    warn_import-untyped = false
    warn_redundant_casts = true
    warn_return_any = true
    warn_unreachable = true
    warn_unused_configs = true
    warn_unused_ignores = true

    [[tool.mypy.overrides]]
    disallow_untyped_decorators = false
    module = ["tests.*"]

    [[tool.mypy.overrides]]
    disallow_untyped_calls = false
    disallow_untyped_decorators = false
    module = ["aisoql.*"]

    [[tool.mypy.overrides]]
    ignore_missing_imports = true
    module = ["sqlalchemy.*", "saq.*", "uvicorn.*", "aiohttp.*", "jsbeautifier", "jsbeautifier.*", "uvloop", "uvloop.*"]

    [[tool.mypy.overrides]]
    ignore_errors = true
    module = ["swparse.db.migrations.*", "swparse.lib.dto.\*"]

    [tool.pyright]
    exclude = ["scripts", "docs"]
    include = ["src/swparse", "tests"]
    reportArgumentType = "information"
    reportAssignmentType = "information"
    reportAttributeAccessIssue = "information"
    reportCallIssue = "information"
    reportGeneralTypeIssues = "information"
    reportIncompatibleMethodOverride = "information"
    reportIncompatibleVariableOverride = "information"
    reportMissingImports = "error"
    reportMissingModuleSource = "error"
    reportMissingTypeArgument = "information"
    reportMissingTypeStubs = "information"
    reportOperatorIssue = "information"
    reportOptionalCall = "information"
    reportOptionalMemberAccess = "information"
    reportOptionalOperand = "information"
    reportPossiblyUnboundVariable = "warning"
    reportUnknownArgumentType = "information"
    reportUnknownMemberType = "information"
    reportUnknownParameterType = "information"
    reportUnknownVariableType = "information"
    reportUnsupportedDunderAll = "warning"
    reportUntypedFunctionDecorator = "information"
    reportUnusedVariable = "warning"
    typeCheckingMode = "strict"