Refactoring tools for Python

What is refactoring?

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

Refactoring tools for Python

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.

What are metrics

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?

Installation method

All of the above tools

pip install [tool]

You can install it using ** pip ** like this.

Have a comfortable refactoring life!

Recommended Posts

Refactoring tools for Python
python [for myself]
Python Tools for Visual Studio Installation Guide
Tips for making small tools in python
Python basics ② for statement
Various Python visualization tools
About Python, for ~ (range)
python textbook for beginners
python for android Toolchain
OpenCV for Python beginners
Install Python (for Windows)
[Python] for statement error
Python environment for projects
Summary of tools for operating Windows GUI with Python
Python memo (for myself): Array
Python list, for statement, dictionary
Refactoring Learned in Python (Basic)
Python for Data Analysis Chapter 4
Modern Python for intermediate users
Learning flow for Python beginners
Python 3.6 installation procedure [for Windows]
BigQuery integration for Python users
Python learning plan for AI learning
Set Up for Mac (Python)
Search for strings in Python
Python Tkinter notes (for myself)
Tools used for sutra copying
OpenCV3 installation for Python3 @macOS
[Python] xmp tag for photos
Python environment construction For Mac
Techniques for sorting in Python
pp4 (python power for anything)
Python3 environment construction (for beginners)
Roadmap for publishing Python packages
Python 3 series installation for mac
Python #function 2 for super beginners
Python template for Codeforces-manual test-
Basic Python grammar for beginners
3 months note for starting Python
Qt for Python app self-update
Python for Data Analysis Chapter 2
100 Pandas knocks for Python beginners
Checkio's recommendation for learning Python
Keyword arguments for Python functions
[For organizing] Python development environment
[Python] Sample code for Python grammar
Python for super beginners Python #functions 1
[Python / PyQ] 4. list, for statement
Simple HTTP Server for python
[Python + Selenium] Tips for scraping
Python #list for super beginners
~ Tips for beginners to Python ③ ~
Extract only Python for preprocessing
Indentation formatting for python scripts
Introduction to Python For, While
About "for _ in range ():" in python
tesseract-OCR for Python [Japanese version]
[Python] Iterative processing (for, while)
Python for Data Analysis Chapter 3
Install dlib for Python (Windows)
Check for memory leaks in Python