Python AST Parsing and Custom Linting

Описание к видео Python AST Parsing and Custom Linting

Let's write a custom linting plugin!

Linting is the process of checking your code for various stylistic and structural things that you (subjectively) want to avoid. Flake8 is a popular linter that has a lot of good default checks, but what if you want to make your own checks? In that case, you can write your own custom Flake8 plugin, which is what we do in this video! We will use the ast module to programmatically parse and examine the structure of our Python code in order to actually implement the checks.

Note: flake8 no longer supports 4 letter prefixes as of version 5, so MCOD has been changed to MC in the source code.

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
flake8: https://flake8.pycqa.org/en/latest/
ast docs: https://docs.python.org/3/library/ast...
Another great flake8 plugin tutorial:    • a flake8 plugin from scratch (interme...  
Import loops vid:    • Avoiding import loops in Python  
Multiple assignment vid:    • Multiple Assignments in Python  
Testing/packaging vid:    • Automated Testing in Python with pyte...  

SUPPORT ME ⭐
---------------------------------------------------
Patreon:   / mcoding  
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate

Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, John Martin, Casey G

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding  

CHAPTERS
---------------------------------------------------
0:00 Intro
0:18 What's a linter?
0:49 The goal
1:12 Don't use regex
1:58 Abstract Syntax Trees
3:31 NodeVisitor
4:42 Plugin skeleton
6:36 Our first error
7:03 No local import check
8:19 Refactoring checks
9:05 Adding options
10:13 Homework
10:51 Package your plugin

Комментарии

Информация по комментариям в разработке