Fokko commented on code in PR #8408:
URL: https://github.com/apache/iceberg/pull/8408#discussion_r1308388009


##########
python/.pre-commit-config.yaml:
##########
@@ -95,3 +69,9 @@ repos:
           ]
         additional_dependencies:
           - tomli==2.0.1
+  - repo: https://github.com/astral-sh/ruff-pre-commit

Review Comment:
   Should we move ruff more to the top? I like it to run it first since it is 
so fast.



##########
python/pyproject.toml:
##########
@@ -288,3 +281,47 @@ ignore_missing_imports = true
 
 [tool.coverage.run]
 source = ['pyiceberg/']
+
+[tool.ruff]
+src = ['pyiceberg/', 'tests/']
+# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
+# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
+# McCabe complexity (`C901`) by default.
+select = ["E", "F"]

Review Comment:
   When we remove certain other checkers, we have to make sure that they are 
enabled:
   ```suggestion
   select = ["E", "F", "W", "I", "UP"]
   ```
   
   Another one is pydocstyle (`D`), but then we have to add some ignores as 
well, since we're not there yet: https://github.com/apache/iceberg/issues/7776



##########
python/pyproject.toml:
##########
@@ -288,3 +281,47 @@ ignore_missing_imports = true
 
 [tool.coverage.run]
 source = ['pyiceberg/']
+
+[tool.ruff]
+src = ['pyiceberg/', 'tests/']
+# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
+# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
+# McCabe complexity (`C901`) by default.
+select = ["E", "F"]
+ignore = ["E501","E203","B024","B028"]
+
+# Allow autofix for all enabled rules (when `--fix`) is provided.
+fixable = ["ALL"]
+unfixable = []
+
+# Exclude a variety of commonly ignored directories.
+exclude = [
+    ".bzr",
+    ".direnv",
+    ".eggs",
+    ".git",
+    ".git-rewrite",
+    ".hg",
+    ".mypy_cache",
+    ".nox",
+    ".pants.d",
+    ".pytype",
+    ".ruff_cache",
+    ".svn",
+    ".tox",
+    ".venv",
+    "__pypackages__",
+    "_build",
+    "buck-out",
+    "build",
+    "dist",
+    "node_modules",
+    "venv",
+]
+per-file-ignores = {}
+# Ignore _all_ violations.
+# Same as Black.
+line-length = 130
+
+# Allow unused variables when underscore-prefixed.
+dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

Review Comment:
   Can you add this for PyUpgrade:
   ```
   [tool.ruff.pyupgrade]
   # Preserve types, even if a file imports `from __future__ import 
annotations`.
   keep-runtime-typing = true
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to