Refactoring is the process of changing the source code without changing the behavior of the program. In software development, as the source code is created, the program often becomes redundant and dirty due to design changes and bug fixes in the middle. "Refactoring" is to solve these problems and modify the source code so that it can flexibly respond to future specification changes.
What is refactoring? | refactoring --Meaning / Definition: IT Glossary http://e-words.jp/w/%E3%83%AA%E3%83%95%E3%82%A1%E3%82%AF%E3%82%BF%E3%83%AA%E3%83%B3%E3%82%B0.html
I referred to here. It's a great slide and I recommend you read it.
Refactoring tools this and that ~ May the force be with you ~ http://tell-k.github.io/pyconjp2014/#/
flake8
flake8 2.5.4 : Python Package Index https://pypi.python.org/pypi/flake8
** flake8 ** is a combination of both PyFlakes
and pep8
tools.
Most checks can be done with this flake8 alone.
If you're using VCS such as * git *, there are also commands where flake8 will create hooks ** such as ** pre-commit **.
flake8 --install-hook
Also, this flake8 can use ** extension plugin **, For example, ** flake8-docstring ** that corresponds to * PEP257 * (docstring coding convention).
flake8-docstrings 0.1.0 : Python Package Index https://pypi.python.org/pypi/flake8-docstrings/0.1.0
If you are ** Vimmer **, there is also a Vim plugin called ** vim-flake8 **.
nvie/vim-flake8: Flake8 plugin for Vim https://github.com/nvie/vim-flake8
autopep8
autopep8 1.2.4 : Python Package Index https://pypi.python.org/pypi/autopep8
** autopep8 ** is a tool that automatically formats pep8 compliant code.
Personally, rather than using an automatic shaping tool like this It is better to use flake8 to fix each error by yourself. I don't recommend it because you can learn how to write code.
autoflake
autoflake 0.6.6 : Python Package Index https://pypi.python.org/pypi/autoflake
** autoflake ** is an automatic formatting tool that complies with PyFlakes errors.
docformatter
docformatter 0.7.1 : Python Package Index https://pypi.python.org/pypi/docformatter
** docformatter ** is the same kind of automatic formatting tool as autopep8 etc. The docformatter does not format the code, but the ** docstring ** used in the code.
radon
radon 1.3.2 : Python Package Index https://pypi.python.org/pypi/radon
** radon ** is a Python tool that calculates various metrics from source code.
Metrics are English words that mean prosody and songwriting. Also, the plural form of the noun "metric" which means metric, scale, metric, distance, etc. It is also a suffix that adds meanings such as "scale of ...", "measurement method of ...", and "measurement method of ..." along with nouns that represent fields and objects.
What are metrics | metrics-Opinion / Definition: IT Glossary http://e-words.jp/w/%E3%83%A1%E3%83%88%E3%83%AA%E3%82%AF%E3%82%B9.html
In other words, it measures and evaluates the maintainability of the source code. In radon, the evaluation is done in 6 stages ** from A to F **.
radon measures the following three types.
Do you often check the second maintainability?
All of the above tools
pip install [tool]
You can install it using ** pip ** like this.
Have a comfortable refactoring life!
Recommended Posts