DEV Community

loading...

Discussion on: Reek - Find your Code Smells!

Collapse
tadaboody profile image
Tomer

Would you look at that.
I'm currently working on a similar tool for python

Tadaboody / good_smell

A linting/refactoring library for python best practices and lesser-known tricks

Good Smell - it makes your code smell good!

A linting/refactoring library for python best practices and lesser-known tricks

Build Status Code style: black PyPi version

Installing:

pip install good_smell 

Usage:

good_smell warn - Print warnings about smells in the code

good_smell warn PATH
good_smell warn --path PATH

Alternativly you can run it through flake8. Smells will be with the code SMLxxx

good_smell fix - Print a fixed version of the code

good_smell fix PATH [STARTING_LINE] [END_LINE]
good_smell fix --path PATH [--starting-line STARTING_LINE] [--end-line END_LINE]

Supported code smells:

Range(len(sequence))

for i in range(len(sequence))
    x = sequence[i]
    do_thing(x,i)

will be fixed to

for i, x in enumerate(sequence)
    do_thing(x,i)

Directly nested for loops

for i in seq_a
    for j in seq_b:
        print(i, j)

to

import itertools
for i, j in itertools.product(seq_a, seq_b):
    print(i, j)

Developing

Clone the repository and run inside it

pip install -e .[dev]

This will install the requirements and…


I'll be looking at this for inspiration. Thanks!