• binaryriot@fediverser.communick.devB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I have to admit… compared to some older ruff I had on disk it now reports like double of “errors”. 99% of them irrelevant to actual issues. It’s over reporting silly things so much it has become useless to use. It may or may not report something critical between all the noise, but it’s hard to see the tree because of the forest, so to speak.

    I guess this is that new “black” stuff?


    If I was to make my code compatible to what it wants I couldn’t use/read it anymore. :) Probably my programs would stop working too:

    T201 `print` found
    

    I guess I have to comment that out.

    ERA001 Found commented-out code
    

    Oups. I guess I just rm *.py to fix the madness. 😎

      • binaryriot@fediverser.communick.devB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        My projects are usually just standalone scripts, so no pyproject.toml.

        I use a global “.pylintrc” in my home directory for pylint, which I occasionally copy over to project folders that get synced to public github repositories, but that’s it.

        Personally I would prefer this to be just the .py file, not all the other fluff one needs to add: https://github.com/the-real-tokai/grablinks

        • legobmw99@fediverser.communick.devB
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          I think that one off standalone scripts are probably not the use case linters (especially ones like ruff that prioritize speed on large code bases) have in mind

      • binaryriot@fediverser.communick.devB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        I only experimented with it briefly (the old version and the new version I downloaded today). I don’t remember configuring anything, so I assume it runs like that by default:

        $ ruff config
        allowed-confusables
        builtins
        cache-dir
        dummy-variable-rgx
        exclude
        extend
        extend-exclude
        extend-ignore
        extend-select
        external
        fix
        fix-only
        fixable
        format
        force-exclude
        ignore
        ignore-init-module-imports
        line-length
        required-version
        respect-gitignore
        select
        show-source
        show-fixes
        src
        namespace-packages
        target-version
        task-tags
        typing-modules
        unfixable
        update-check
        flake8-annotations
        flake8-bandit
        flake8-bugbear
        flake8-builtins
        flake8-comprehensions
        flake8-errmsg
        flake8-quotes
        flake8-self
        flake8-tidy-imports
        flake8-type-checking
        flake8-gettext
        flake8-implicit-str-concat
        flake8-import-conventions
        flake8-pytest-style
        flake8-unused-arguments
        isort
        mccabe
        pep8-naming
        pycodestyle
        pydocstyle
        pylint
        pyupgrade
        per-file-ignores
        

        Certainly this will become more useful toned down to sane limits, but it needs time/ research/ reading lots of documentation(?) to sort that out. A more sane default would be nice, IMHO.

          • binaryriot@fediverser.communick.devB
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            That’s interesting.

            After some digging I found a “ruff.toml” in an unusual place for a unix’y command line tool (~/Library/Application Support/ruff/ruff.toml)

            select = ["ALL"]
            ignore = []
            fixable = []
            unfixable = []
            

            I don’t know what put it there, certainly not my doing as far as I can remember. But that explains some things, I guess. 😱

    • ogtfo@fediverser.communick.devB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      If your project has a significant enough scope that a tool like ruff is warranted, you really should have proposer logging setup instead of print statement, and you should be relying on your version control instead of commenting out code.

    • Rand_alThor_@fediverser.communick.devB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      You enable all Rules on a personal project? Why?

      Anyway time for you to get some humbleness and realize the fault lies with the person in the chair. You. Not even reading the first page of the documentation or following it learning best practices to pick or not pick. Then coming a making an obviously uninformed comment.

      https://en.m.wiktionary.org/wiki/PEBCAK

      Btw both of those seem like useful errors.

    • Gloomy-Fix-4393@fediverser.communick.devB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      sounds like you haven’t learned most of what is being taught by the greats such as Uncle Bob and his clean code talks.

      print() in almost every case should probably be logger.log() if it is important.

      comments, doc strings aside, are usually (almost always?) a “code smell”.

      • binaryriot@fediverser.communick.devB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        “Clean code” is always about preference. I like code I can read and understand. If I want extra comments or keep some commented code to make a thought process about a coding decision more clear then that’s not a bad thing, IMHO.

        And if print() is such a bad thing, why wasn’t it deprecated for Python 3? Again this probably just comes down to preference again. I just print a final result of a program to stdout (which can be binary data, or some SVG, or just some lines of information). That has nothing to do with “logging”, IMHO.

        I don’t know who Uncle Bob is. 😳