Skip to content

EUdds/Making-A-Point

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Making-A-Point

I heard that magic numbers in code are bad, so this will get rid of all of them.

Installation

$ pip install readability_improver
$ make-more-readable -h

Usage

$ 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 inplace

Examples

Before

Your unreadable code

// test.c
float getAmplitude(float x, float y) {
    return 1.0f / sqrtf(x * x + y * y);
}

Afer

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__

About

Provin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages