GithubHelp home page GithubHelp logo

zhoudaxia233 / py-wtf Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 32 KB

A static analyzer of Python which forces you to write comments, and write them in a well-mannered way.

License: MIT License

Python 100.00%
static-analyzer python3

py-wtf's Introduction

py-wtf

A static analyzer of Python which forces you to write comments, and write them in a well-mannered way.

wtf is short for what the function or why that function.

Since most of the time, when you read some code snippet of your own without comments, you might have the question, "what the function was used for? Why did I write that function? What the hell was I thinking about at that time?" And my product is to help you with this problem.


Requirements

Python >= 3.5


Installation

Install py-wtf:

sudo pip3 install py-wtf

Developing

Install py-wtf for development:

sudo python3 setup.py develop

Usage

Before you actually use it, there are two modes in this tool that you need to know:

  • normal mode
  • strict mode

In normal mode, both comments (#-style) and docstrings will be considered as "comments". It won't complain missing of comments if you'd at least written a # mark for your functions.

However, in strict mode, it only considers docstrings as "comments". So, if you only have comments (#-style) in your script, it will report warnings.

The default mode is normal mode.


Use it as a command in Terminal:

# you can process multiple files at the same time
wtf NAME_OF_FILE0.py NAME_OF_FILE1.py NAME_OF_FILEn.py

# you can process a folder of files (currently only one folder is supported)
wtf NAME_OF_FOLDER

# you can switch to strict mode by passing -s argument
wtf NAME_OF_FILE.py -s

or

use it as a normal Python library:

import pywtf

It only complains the missing of class's docstrings, class member functions' comments and top-level functions' comments. It DOESN'T care about docstrings or comments for source files.

py-wtf's People

Contributors

zhoudaxia233 avatar

Stargazers

Tomas Čerkasas avatar

Watchers

James Cloos avatar

Forkers

zthaa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.