Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 83 additions & 176 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,187 +122,94 @@ exclude = [

[tool.ruff.lint]
select = ["ALL"]
exclude = [
"tests/**",
"scripts/**",
"docs/**",
"examples/**",
]
Comment on lines +125 to +130
Copy link
Member

Choose a reason for hiding this comment

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

We shouln't blank ignore all this. If some rules obviously don't make sense in some of these, we should use [tool.ruff.per-file-ignores] like so:

[tool.ruff.lint.per-file-ignores]
"src/database/migrations/*"= ["INP001", "ARG001", "E501"]
"tests/*"= ["S101"]
"scripts/**" = ["T201"]

(example taken from a repo of mine, adapt as needed)

Copy link
Author

Choose a reason for hiding this comment

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

I was thinking that we ignore them for now, and re-enable them once we are finished with fixing the library code.

Copy link
Member

Choose a reason for hiding this comment

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

Ignoring every rule may perhaps do more harm than good. If it's just 5-10 rules we might as well selectively ignore them


# When ignoring a rule globally, please consider if it can be ignored in a more specific way.
# Also, leave a comment explaining why the rule is ignored.
extend-ignore = [
"A001", # Ignored when migrating from original codebase, idem for others if not mentioned otherwise
"PLW1641", # Object does not implement `__hash__` method
"PLC0415", # Allow non top-level imports in some files
"A002",
"A005",
"ANN001",
"ANN002",
"ANN003",
"ANN201",
"ANN202",
"ANN204",
"ANN205",
"ANN206",
"ANN401",
"ARG001",
"ARG002",
"ARG003",
"ARG004",
"ARG005",
"ASYNC230",
"BLE001",
"C416",
"C417",
"C420",
"C901",
"COM812",
"D100",
"D101",
"D102",
"D103",
"D105",
"D107",
"D202",
"D205",
"D212",
"D214",
"D215",
"D400",
"D401",
"D402",
"D404",
"D409",
"D412",
"D413",
"D415",
"D416",
"D417",
"DTZ003",
"DTZ004",
"DTZ005",
"E501",
"E712",
"E713",
"E721",
"E731",
"E741",
"EM101",
"EM102",
"EM103",
"ERA001",
"F401",
"F402",
"F403",
"F405",
"FBT001",
"FBT002",
"FBT003",
"FIX002",
"FURB167",
"FURB188",
"ISC001",
"N801",
"N803",
"N804",
"N806",
"N807", # Function name should not start and end with `__` (dunder)
"N811",
"N818",
"PERF102",
"PERF203",
"PERF401",
"PGH003",
"PLC0105",
"PLR0206",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
"PLR1704",
"PLR1714",
"PLR2004",
"PLR5501",
"PLW0602",
"PLW0603",
"PLW2901",
"PTH100",
"PTH107",
"PTH110",
"PTH118",
"PTH120",
"PTH122",
"PTH123",
"PYI016",
"PYI019",
"PYI024",
"PYI032",
"PYI034",
"PYI036",
"PYI041",
"PYI046",
"RET501",
"RET502",
"RET503",
"RET504",
"RET505",
"RET506",
"RET507",
"RSE102",
"RUF001",

# Needs discussion
"ANN202", # Private function typing
"ANN204", # dunder method missing return type
"D", # Missing docstring (if it doesnt end up being ignored, "D203" conflicts with formatter)
"INP001", # Missing __init__.py file
"E501", # Line too long
# "F401", # unused imports - should be ignored on a file/line-level
# "FBT001", "FBT002" # Boolean-typed positional argument in function definition
"N801", # class naming convention
"N803", # uppercase function parameters
"PLR2004", # magic numbers
"PLW0602", "PLW0603", # global usage
"PTH", # file manipulation without pathlib
"SIM115", # built-in open() usage without context manager
# "ASYNC230", # built-in open() used in async function (aiofiles?)
"RUF001", # String contains ambiguous char - only an issue because of ext.commands
"S307", # eval() usage
"S603", # subprocess.Popen() usage - sinks
"T201", # print() usage - logging?
"TC001", # move imports to TYPE_CHECKING block if they are only used for typing (even if no circular import)
"PLC0105", # convariant TypeVar naming
"RUF005",
"RUF006",
"RUF012",
"RUF013",
"RUF015",
"RUF021",
"RUF022",
"RUF023",
"RUF046",
"RUF051",
"S101",
"S110",
"S307",
"S311",
"S603",
"SIM102",
"SIM105",
"SIM108",
"SIM114",
"SIM115",
"SIM118",
"SIM201",
"SIM212",
"SIM910",
"T201",
"TC001",
"TC003",
"TC004",
"TC006",
"TD002",
"TD003",
"TD006",
"TID252",
"TRY002",
"TRY003",
"TRY201",
"TRY300",
"TRY301",
"UP006",
"UP031",
"UP032",
"UP035",
"A004",
"D104",
"D200",
"D213",
"D406",
"F541",
"F811",
"FA100",
"INP001",
"S104",
"SIM116",
"SLF001",
"W293",
"D211",
"D203", # conflicts with formatter
"PLR0904", # not suitable for a library like pycord
# "RUF006", # weakreferenced asyncio tasks and futures



"PERF401", # Do not recommend list comprehension instead of for loop & append()
"N804", # ruff issue - https://github.com/astral-sh/ruff/issues/6017
"TRY301", # raise inside try block
"SIM108", # Do not recommend single-line tenerary expressions
"SIM105", # Do not recommend contextlib.suppress() instead of try-except-pass (context manager is slower)
"ARG", # Unused arguments
"ANN002", "ANN003", # *args and **kwargs missing type annotations
"TC006", # Do not require quotes in typing.cast()
"PERF203", # try-except inside loop
"S311", # random.Random usage
"S110", # try-except-pass without logging it
"N818", # Exception subclass prefix is not "Error"
"N811", # Constant imported as non-constant (ruff false positive)
"N807", # Function name should not start and end with `__` (dunder)
"FBT003", # Boolean passed to function call as positional argument
"PLC0415", # Allow non top-level imports in some files
"PLW1641", # Object does not implement `__hash__` method
"ANN401", # typing.Any usage
"EM101", "EM102", "EM103", # exception formatting - f strings, str.format, etc
"COM812", # Missing trailing comma
"N806", # Uppercase variable names
"BLE001", # Catch (Base)Exception
"TRY002", # Allow raising Exception()
"TRY003", # Passing args to Exceptions
"RUF013", # import not at top level
"PLR6301", # Unused self
"RET501", # Implicit return None
"RET502", # return statement without explicit value
"RET503", # Implicit return None
"CPY", # Missing copyright notice
"TD002", # TO_DO comment without author assigned
"TD003", # TO_DO commend without issue link
"FIX002", # Existence of TO_DO comments
"SLF001", # sunder / dunder access from outside of the class
"ERA001", # Commented out code
"C901", # Complex function
"ASYNC109", # async function has 'timeout' kwarg
"E731", # lambda assigned to variable
"F403", "F405", # * import usage
"RSE102", # Redundant parentheses when raising exceptions
"TC003", # Do not move stdlib imports to TYPE_CHECKING block
"TID252", # Allow relative imports

"PLR0904", # Too many public methods on class
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments
"PLR0914", # Too many local variables
"PLR0915", # Too many statements
"PLR0916", # Too many booleans inside single if statement
"PLR0917", # Too many positional arguments
]

[tool.ty.environment]
Expand Down
Loading