472 subscribers
6 photos
1 video
2 files
550 links
python, go, code quality, security, magic

Website and RSS:
https://itgram.orsinium.dev

Source:
https://github.com/orsinium/itgram

Author:
@orsinium
https://orsinium.dev/
Download Telegram
refurb is yet another linter for Python. What makes it special is that it internally runs as a mypy plugin. This gives the linter static information about types for everything. As a result, refurb can give more precise and reliable suggestions. But of course it also means refurb is slower than something like pycodestyle which works on regular expressions or ruff which is written on Rust and works only with AST.

#python
Mutation testing is technique for evaluating how good your tests are. The idea is that a special tool (or a very bored human) breaks the code by slightly changing ("mutating") something in it and then running all the tests, and the tests must fail. If they don't fail, you either have dead code or the tests aren't good enough.

There are some pre-requisites for when it mkes sense to do that:

1. The test coverage is 100%. If it's not, you already know what you should write tests for.
2. The tests are fast.
3. The tests are reliable.
4. The codebase is small.

mutmut is a tool for mutation testing of Python code. You simply point it to the directory with the code, directory with the tests, and what command to use to run the tests, and it will do the rest. When it's done, you can generate an HTML report with the list of diffs of mutations for each file that weren't detected by the tests.

I think it's an "advanced" testing technique. I use it not that often and only on small projects that need to be reliable. There are quite a few "false positives" (things that you can't and shouldn't test, like databse connection options), but from my experience it also a very reliable way to detect what tests you're missing.

#python
taplo is a CLI tool (and a Rust library) for working with TOML. It can check TOML files for syntax errors, validate them against JSON schemas, and format.

The best thing about it is the Even Better TOML VSCode plugin wrapping taplo that provides all the same things as CLI plus smart syntax highlighting, navigation, refactoring, and even autocomplete for pyproject.toml, fly.toml, Cargo.toml and a few other formats).

#rust