Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving ruff setup #224

Merged
merged 44 commits into from
Jun 28, 2024
Merged

Improving ruff setup #224

merged 44 commits into from
Jun 28, 2024

Commits on Jun 26, 2024

  1. Redefining ruff, starting with target-version = "py38"

    Let's remove all rules so far, and re-introduce those by following the
    definitions of pylint.
    
    The first rule is target-version infered from the package definition that
    requires-python >= 3.8.
    castelao committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    b3edb62 View commit details
    Browse the repository at this point in the history
  2. Excluding CSV and ref.*?py

    Patterns defined at .python-lint lines 10 & 14.
    castelao committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    8c9f307 View commit details
    Browse the repository at this point in the history
  3. Disabling rules according to .python-lint

    Current setup defined between lines 57-105.
    castelao committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    5db2b31 View commit details
    Browse the repository at this point in the history
  4. max-nested-blocks

    Defining `max-nested-blocks` as .pyhton-lint line 141.
    castelao committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    e29073e View commit details
    Browse the repository at this point in the history
  5. Confirming with expected-line-ending-format

    While pylint defines `expected-line-ending-format`, ruff uses
    `line-ending` instead. Defined in .python-lint line 254.
    castelao committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    ece6552 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ec2fa95 View commit details
    Browse the repository at this point in the history
  7. indent-width

    castelao committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    8024105 View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2024

  1. multiple-statements-on-one-line-colon

    Equivalent to single-line-if-stmt at line 278 of .python-lint
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    47f0635 View commit details
    Browse the repository at this point in the history
  2. task-tags

    In reference to notes, line 291 of .python-lint
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    7293026 View commit details
    Browse the repository at this point in the history
  3. In respect t ologging-modules, line 285 of .python-lint

    We don't need that with ruff, but here is a placeholder if we want to
    add more than default `logger` in the future.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    5889784 View commit details
    Browse the repository at this point in the history
  4. unused imports

    Addressing "init-import=no" in line 402 from .python-lint
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    2368874 View commit details
    Browse the repository at this point in the history
  5. Defining max-args

    Interestingly, max-args is defined as 5 in line 434, but PLR0913 rule is
    ignored.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    f93b7b1 View commit details
    Browse the repository at this point in the history
  6. Defining DESIGN explicit setup

    To reflect DESIGN section in .python-lint, pages 431-463.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    576763c View commit details
    Browse the repository at this point in the history
  7. Closest option of satisfy EXCEPTIONS

    Ruff doesn't implement the exactly the same, but E722 is good enough if
    not even better.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    0316003 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4f3c334 View commit details
    Browse the repository at this point in the history
  9. Re-introducing (Q) flake8-quotes rules

    sup3r do not follow:
    - Q000 bad-quotes-inline-string
    - Q004 unnecessary-escaped-quote
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    56f5c9d View commit details
    Browse the repository at this point in the history
  10. Re-introducing (I) isort rules

    sup3r do not follow I001: unsorted-imports.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    bc06fad View commit details
    Browse the repository at this point in the history
  11. Re-introducing (NPY) NymPy-specific rules

    sup3r doesn't follow NPY002, but we might want to re-consider that in
    the future.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    2340702 View commit details
    Browse the repository at this point in the history
  12. style: Conforming with UP039

    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    3d482a3 View commit details
    Browse the repository at this point in the history
  13. Re-introducing (UP) pyupgrade rules

    sup3r doesn't follow:
    - UP009: utf8-encoding-declaration
    - UP015: redundant-open-modes
    - UP032: f-string
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    070d7b9 View commit details
    Browse the repository at this point in the history
  14. Re-introducing (A) flake8-builtins

    sup3r doesn't conform with, but should reconsider that in the future:
    - A001: builtin-variable-shadowing
    - A002: builtin-argument-shadowing
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    80b8ee2 View commit details
    Browse the repository at this point in the history
  15. Re-introducing (ARG) flake8-unused-arguments rules

    sup3r doesn't conform with:
    - ARG002: unused-method-argument
    - ARG003: unused-class-method-argument
    - ARG004: unused-static-method-argument
    - ARG005: unused-lambda-argument
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    ebfbc74 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    2f921d6 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    e319929 View commit details
    Browse the repository at this point in the history
  18. Re-introducing (COM) flake8-commas rules

    sup3r doesn't conform with:
    - COM812: missing-trailing-comma
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    43c0dd3 View commit details
    Browse the repository at this point in the history
  19. Introducing (N) pep8-naming rules

    sup3r doesn't conform with:
    - N802: invalid-function-name
    - N803: invalid-argument-name
    - N806: non-lowercase-variable-in-function
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    2454b47 View commit details
    Browse the repository at this point in the history
  20. Introducing (D) pydocstyle rules

    sup3r doesn't conform with:
    - D105: undocumented-magic-method
    - D200: fits-on-one-line
    - D202: no-blank-line-after-function
    - D204: one-blank-line-after-class
    - D205: blank-line-after-summary
    - D207: under-indentation
    - D209: new-line-after-last-paragraph
    - D400: ends-in-period
    - D401: non-imperative-mood
    - D404: docstring-starts-with-this
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    6ac9622 View commit details
    Browse the repository at this point in the history
  21. Introducing (PL) Pylint rules

    sup3r doesn't conform with:
    - PLR2004: magic-value-comparison
    - PLW2901: redefined-loop-name
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    92ed73d View commit details
    Browse the repository at this point in the history
  22. Running ruff with GA

    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    e14a08d View commit details
    Browse the repository at this point in the history
  23. Nothing is fixable for now

    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    c12f36f View commit details
    Browse the repository at this point in the history
  24. Using ruff with pre-commmit

    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    ec3e916 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    7234595 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    4390315 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    12521db View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    eadd1cb View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    2330df6 View commit details
    Browse the repository at this point in the history
  30. Adding (C4) flake8-comprehensions

    As suggested by @bnb32
    
    sup3r doesn't conform with:
    - C408: unnecessary-collection-call
    - C414: unnecessary-double-cast-or-process
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    163e63e View commit details
    Browse the repository at this point in the history
  31. Adding rule (C90) mccabe

    As suggested by @bnb32
    
    Using max-complexity as previously defined for flake8
    (lintesrs/.flake8) as equal to 12.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    57ff41c View commit details
    Browse the repository at this point in the history
  32. Adding convention (C) and flake8-logging (LOG)

    @bnb32 any other rule that you would like to include?
    castelao committed Jun 27, 2024
    1 Configuration menu
    Copy the full SHA
    2c4b4d5 View commit details
    Browse the repository at this point in the history
  33. validate all codebase with super-linter

    There were some misterious situations where super-linter was not
    properly checking the code. Paul mentioned a setup that limits checks to
    the very last commit only. I expect that VALIDATE_ALL_CODEBASE should
    address that.
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    e1a08ec View commit details
    Browse the repository at this point in the history
  34. Adding (SIM) flake8-simplify rules

    As suggested by @bnb32.
    
    sup3r doesn't conform with:
    - SIM108: if-else-block-instead-of-if-exp
    - SIM117: multiple-with-statements
    - SIM118: in-dict-keys
    - SIM211: if-expr-with-false-true
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    f860ff6 View commit details
    Browse the repository at this point in the history
  35. Adding (PERF) Perflint rules

    As suggested by @bnb32
    
    sup3r doesn't conform with:
    - PERF102: incorrect-dict-iterator
    - PERF203: try-except-in-loop
    - PERF401: manual-list-comprehension
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    90a0af9 View commit details
    Browse the repository at this point in the history
  36. We don't need to run on the full code base anymore

    With the pull_request trigger we don't need VALIDATE_ALL_CODEBASE set to
    true anymore. Otherwise it's running twice. Thanks @ppinchuk!
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    c843ae7 View commit details
    Browse the repository at this point in the history
  37. clean: Removing implicit rules

    While conforming with the legacy setup, I added a few explicit specific
    rules but in the final version didn't make sense anymore since those
    are now implicit. For instance, no need of "E701" is added "E".
    castelao committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    8180a82 View commit details
    Browse the repository at this point in the history