From 0f85dbbbbd543b66e485f8840620e89c0e333953 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sat, 19 Nov 2016 13:50:07 +0100 Subject: [PATCH] List the tools in the README. --- README.md | 47 ++++++++++++++++++++++++++++++++++++++++++ make-readme.py | 40 ++++++++++++++++++++++++++++++++++++ tools.py | 56 ++++++++++++++++++++++++++------------------------ 3 files changed, 116 insertions(+), 27 deletions(-) create mode 100755 make-readme.py diff --git a/README.md b/README.md index 307f10d..9ad7c07 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,50 @@ To run on an older ubuntu you can checkout an older version of vigil. e.g. After cloning do: # git checkout ubuntu-15.10 + +### Tools + +#### py + python_syntax python_unittests pydoc mypy python_coverage python_profile pycodestyle pyflakes pylint python_gut python_modulefinder python_mccabe bandit + +#### pyc + disassemble_pyc + +#### pl pm t + perl_syntax perldoc perltidy + +#### pod pod6 + perldoc + +#### java + uncrustify + +#### c h + splint uncrustify + +#### o + objdump_headers objdump_disassemble readelf + +#### cpp + bcpp uncrustify + +#### pdf + pdf2txt + +#### html + html_syntax tidy html2text + +#### php + php5_syntax + +#### zip + unzip + +#### tar.gz tgz + tar_gz + +#### tar.bz2 + tar_bz2 + +#### a so + nm diff --git a/make-readme.py b/make-readme.py new file mode 100755 index 0000000..d8946bf --- /dev/null +++ b/make-readme.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + + +import tools + + +BODY = """\ +# Vigil Code Monitor + +### Summary + +Vigil shows a list of status reports for a given codebase, and keeps them +up to date as the codebase changes. + +### Installation + +To run vigil: (Tested in Ubuntu 16.10 in gnome-terminal and stterm) + + # git clone https://github.com/ahamilton/vigil + # cd vigil + # ./install-dependencies + # ./vigil + +and to test its working properly: + + # ./test-all + +To run on an older ubuntu you can checkout an older version of vigil. +e.g. After cloning do: + + # git checkout ubuntu-15.10 + +### Tools""" + + +print(BODY) +for extensions, tools_ in tools.TOOLS_FOR_EXTENSIONS: + print() + print("#### " + " ".join(extensions)) + print(" " + " ".join(tool.__name__ for tool in tools_)) diff --git a/tools.py b/tools.py index 5f32d5a..10a56ca 100644 --- a/tools.py +++ b/tools.py @@ -707,34 +707,36 @@ def _generic_tools(): return [contents, metadata] +TOOLS_FOR_EXTENSIONS = \ + [ + (["py"], [python_syntax, python_unittests, pydoc, mypy, python_coverage, + python_profile, pycodestyle, pyflakes, pylint, python_gut, + python_modulefinder, python_mccabe, bandit]), + (["pyc"], [disassemble_pyc]), + (["pl", "pm", "t"], [perl_syntax, perldoc, perltidy]), + # (["p6", "pm6"], [perl6_syntax, perldoc]), + (["pod", "pod6"], [perldoc]), + (["java"], [uncrustify]), + (["c", "h"], [splint, uncrustify]), + (["o"], [objdump_headers, objdump_disassemble, readelf]), + (["cpp"], [bcpp, uncrustify]), + (["pdf"], [pdf2txt]), + (["html"], [html_syntax, tidy, html2text]), + (["php"], [php5_syntax]), + (["zip"], [unzip]), + (["tar.gz", "tgz"], [tar_gz]), + (["tar.bz2"], [tar_bz2]), + (["a", "so"], [nm]), + ] + + +@functools.lru_cache(maxsize=1) def _tools_for_extension(): - return { - "py": [python_syntax, python_unittests, pydoc, mypy, python_coverage, - python_profile, pycodestyle, pyflakes, pylint, python_gut, - python_modulefinder, python_mccabe, bandit], - "pyc": [disassemble_pyc], - "pl": [perl_syntax, perldoc, perltidy], - "pm": [perl_syntax, perldoc, perltidy], - "t": [perl_syntax, perldoc, perltidy], - # "p6": [perl6_syntax, perldoc], - # "pm6": [perl6_syntax, perldoc], - "pod": [perldoc], - "pod6": [perldoc], - "java": [uncrustify], - "c": [splint, uncrustify], - "h": [splint, uncrustify], - "o": [objdump_headers, objdump_disassemble, readelf], - "zip": [unzip], - "tar.gz": [tar_gz], - "tgz": [tar_gz], - "tar.bz2": [tar_bz2], - "a": [nm], - "so": [nm], - "pdf": [pdf2txt], - "html": [html_syntax, tidy, html2text], - "cpp": [bcpp, uncrustify], - "php": [php5_syntax], - } + result = {} + for extensions, tools in TOOLS_FOR_EXTENSIONS: + for extension in extensions: + result[extension] = tools + return result def tools_all():