I heard that magic numbers in code are bad, so this will get rid of all of them.
$ pip install readability_improver
$ make-more-readable -h$ make-more-readable -h
usage: make-more-readable [-h] [-i] path [constants]
Makes your code 1000% more readable
positional arguments:
path File or directory to convert
constants Filename to dump constants to
optional arguments:
-h, --help show this help message and exit
-i, --inplace Convert file inplaceYour unreadable code
// test.c
float getAmplitude(float x, float y) {
return 1.0f / sqrtf(x * x + y * y);
}Your more readable code
// test.c
#include "constants.h"
float getAmplitude(float x, float y) {
return ONE_POINT_ZERO / sqrtf(x * x + y * y);
}
// constants.h
#ifndef __CONSTANTS_H__
#define __CONSTANTS_H__
// This file was generated by readability_improver. Do not edit this file directly.
#define ONE_POINT_ZERO 1.0
#endif // __CONSTANTS_H__