From 5fcdd0ea5035ec9b84c33755747dc7c9007fd4f4 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Fri, 17 May 2019 11:10:45 +1000 Subject: [PATCH] Remove code formatters. - Maybe these should be returned if the output is a diff with the current file. - bcpp, uncrustify, gofmt, clang_format. --- README.md | 11 +++++----- eris/tools.py | 20 ----------------- eris/tools.toml | 22 +++++-------------- tests/golden-files/results/bcpp-hello_cpp | 8 ------- .../results/uncrustify-closure-util_java | 1 - tests/golden-files/results/uncrustify-hello_c | 7 ------ .../golden-files/results/uncrustify-hello_cpp | 8 ------- tests/golden-files/results/uncrustify-hello_h | 6 ----- tests/tools_test.py | 10 --------- 9 files changed, 10 insertions(+), 83 deletions(-) delete mode 100644 tests/golden-files/results/bcpp-hello_cpp delete mode 100644 tests/golden-files/results/uncrustify-closure-util_java delete mode 100644 tests/golden-files/results/uncrustify-hello_c delete mode 100644 tests/golden-files/results/uncrustify-hello_cpp delete mode 100644 tests/golden-files/results/uncrustify-hello_h diff --git a/README.md b/README.md index ed9cb9a..aabc9c4 100644 --- a/README.md +++ b/README.md @@ -23,20 +23,19 @@ then to run: ### Tools -Extensions(94) | Tools(60) +Extensions(93) | Tools(56) ----------:| ----- .* | [contents](http://pygments.org/) • metadata • [git_blame](https://git-scm.com/docs/git-blame) • [git_log](https://git-scm.com/docs/git-log) .py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://mypy-lang.org/) • [python_coverage](https://coverage.readthedocs.io/) • [pycodestyle](http://pycodestyle.pycqa.org/en/latest/) • [pydocstyle](http://www.pydocstyle.org/en/2.1.1/usage.html) • [pyflakes](https://pypi.org/project/pyflakes/) • [pylint](https://www.pylint.org/) • [python_gut](https://github.com/ahamilton/eris/blob/master/gut.py) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [dis](https://docs.python.org/3/library/dis.html) • [python_mccabe](https://pypi.org/project/mccabe/) • [bandit](https://pypi.org/project/bandit/) .pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/) .pod .pod6 | [perldoc](http://perldoc.perl.org/) -.java | [uncrustify](https://github.com/uncrustify/uncrustify) -.c .h | [c_syntax_gcc](https://gcc.gnu.org/) • [uncrustify](https://github.com/uncrustify/uncrustify) • [cppcheck](http://sourceforge.net/p/cppcheck/wiki/Home/) • [clang_format](https://clang.llvm.org/docs/ClangFormat.html) -.cc .cpp .hpp | [cpp_syntax_gcc](https://gcc.gnu.org/) • bcpp • [uncrustify](https://github.com/uncrustify/uncrustify) • [cppcheck](http://sourceforge.net/p/cppcheck/wiki/Home/) • [clang_format](https://clang.llvm.org/docs/ClangFormat.html) +.c .h | [c_syntax_gcc](https://gcc.gnu.org/) • [cppcheck](http://sourceforge.net/p/cppcheck/wiki/Home/) +.cc .cpp .hpp | [cpp_syntax_gcc](https://gcc.gnu.org/) • [cppcheck](http://sourceforge.net/p/cppcheck/wiki/Home/) .rb | [ruby_syntax](http://www.ruby-lang.org/) .lua | [lua_syntax](http://www.lua.org) • [lua_check](https://github.com/mpeterv/luacheck) -.js | [js_syntax](http://nodejs.org/) • [clang_format](https://clang.llvm.org/docs/ClangFormat.html) +.js | [js_syntax](http://nodejs.org/) .php | [php7_syntax](https://en.wikipedia.org/wiki/PHP) -.go | [gofmt](https://golang.org) • [go_vet](https://golang.org) • [golint](https://github.com/golang/lint) • [godoc](http://golang.org/x/tools) +.go | [go_vet](https://golang.org) • [golint](https://github.com/golang/lint) • [godoc](http://golang.org/x/tools) .bash .sh .dash .ksh | [shellcheck](https://www.shellcheck.net/) .pdf | [pdf2txt](https://github.com/pdfminer/pdfminer.six) .html .htm | [html_syntax](http://www.html-tidy.org/) • [tidy](http://www.html-tidy.org/) • [html2text](http://www.mbayer.de/html2text/) • [pandoc](https://pandoc.org/) diff --git a/eris/tools.py b/eris/tools.py index fbb4629..4d73b94 100644 --- a/eris/tools.py +++ b/eris/tools.py @@ -434,26 +434,6 @@ def tidy(path): return Status.normal, fill3.Text(stdout) -@deps(deps={"bcpp"}, executables={"bcpp"}) -def bcpp(path): - stdout, stderr, returncode = _do_command(["bcpp", "-fi", path]) - status = Status.normal if returncode == 0 else Status.problem - return status, _syntax_highlight_using_path(stdout, path) - - -@deps(deps={"uncrustify"}, url="uncrustify", executables={"uncrustify"}) -def uncrustify(path): - with tempfile.TemporaryDirectory() as temp_dir: - config_path = os.path.join(temp_dir, "uncrustify.cfg") - stdout, stderr, returncode = _do_command( - ["uncrustify", "--detect", "-f", path, "-o", config_path]) - if returncode == 0: - stdout, stderr, returncode = _do_command( - ["uncrustify", "-c", config_path, "-f", path]) - status = Status.normal if returncode == 0 else Status.problem - return status, _syntax_highlight_using_path(stdout, path) - - MAX_IMAGE_SIZE = 200 diff --git a/eris/tools.toml b/eris/tools.toml index 275dfa3..399db04 100644 --- a/eris/tools.toml +++ b/eris/tools.toml @@ -10,15 +10,14 @@ tools_for_extensions = [ # [["pyc"], ["pydisasm"]], [["pl", "pm", "t"], ["perl_syntax", "perldoc", "perltidy"]], # [["p6", "pm6"], ["perl6_syntax", "perldoc"]], - [["pod", "pod6"], ["perldoc"]], [["java"], ["uncrustify"]], - [["c", "h"], ["c_syntax_gcc", "uncrustify", "cppcheck", "clang_format"]], - [["cc", "cpp", "hpp"], ["cpp_syntax_gcc", "bcpp", "uncrustify", - "cppcheck", "clang_format"]], + [["pod", "pod6"], ["perldoc"]], + [["c", "h"], ["c_syntax_gcc", "cppcheck"]], + [["cc", "cpp", "hpp"], ["cpp_syntax_gcc", "cppcheck"]], [["rb"], ["ruby_syntax"]], [["lua"], ["lua_syntax", "lua_check"]], - [["js"], ["js_syntax", "clang_format"]], + [["js"], ["js_syntax"]], [["php"], ["php7_syntax"]], - [["go"], ["gofmt", "go_vet", "golint", "godoc"]], + [["go"], ["go_vet", "golint", "godoc"]], [["bash", "sh", "dash", "ksh"], ["shellcheck"]], [["pdf"], ["pdf2txt"]], [["html", "htm"], ["html_syntax", "tidy", "html2text", "pandoc"]], @@ -213,12 +212,6 @@ tools_for_extensions = [ dependencies = ["cppcheck"] command = "cppcheck" -[clang_format] - dependencies = ["clang-format"] - url = "https://clang.llvm.org/docs/ClangFormat.html" - command = "clang-format" - success_status = "normal" - [ruby_syntax] dependencies = ["ruby"] command = "ruby -c" @@ -235,11 +228,6 @@ tools_for_extensions = [ dependencies = ["lua-check"] command = "luacheck" -[gofmt] - dependencies = ["golang-go"] - command = "gofmt" - success_status = "normal" - [go_vet] dependencies = ["golang-go"] command = "go vet" diff --git a/tests/golden-files/results/bcpp-hello_cpp b/tests/golden-files/results/bcpp-hello_cpp deleted file mode 100644 index d2f88ba..0000000 --- a/tests/golden-files/results/bcpp-hello_cpp +++ /dev/null @@ -1,8 +0,0 @@ -(B#include(B (B(B (B -(B (B -(Busing(B (Bnamespace(B std;(B (B -(B (B -(Bint(B (Bmain(B()(B (B -(B{(B (B -(B cout << (B"Hello World"(B << endl;(B -(B}(B (B \ No newline at end of file diff --git a/tests/golden-files/results/uncrustify-closure-util_java b/tests/golden-files/results/uncrustify-closure-util_java deleted file mode 100644 index 1039aa1..0000000 --- a/tests/golden-files/results/uncrustify-closure-util_java +++ /dev/null @@ -1 +0,0 @@ -(B \ No newline at end of file diff --git a/tests/golden-files/results/uncrustify-hello_c b/tests/golden-files/results/uncrustify-hello_c deleted file mode 100644 index 6f0ceae..0000000 --- a/tests/golden-files/results/uncrustify-hello_c +++ /dev/null @@ -1,7 +0,0 @@ -(B#include(B (B(B (B -(B (B -(Bint(B (Bmain(B()(B (B -(B{(B (B -(B printf((B"Hello World\n"(B);(B -(B (Breturn(B (B0(B;(B (B -(B}(B (B \ No newline at end of file diff --git a/tests/golden-files/results/uncrustify-hello_cpp b/tests/golden-files/results/uncrustify-hello_cpp deleted file mode 100644 index d2f88ba..0000000 --- a/tests/golden-files/results/uncrustify-hello_cpp +++ /dev/null @@ -1,8 +0,0 @@ -(B#include(B (B(B (B -(B (B -(Busing(B (Bnamespace(B std;(B (B -(B (B -(Bint(B (Bmain(B()(B (B -(B{(B (B -(B cout << (B"Hello World"(B << endl;(B -(B}(B (B \ No newline at end of file diff --git a/tests/golden-files/results/uncrustify-hello_h b/tests/golden-files/results/uncrustify-hello_h deleted file mode 100644 index a073754..0000000 --- a/tests/golden-files/results/uncrustify-hello_h +++ /dev/null @@ -1,6 +0,0 @@ -(B#ifndef HELLO_H(B -(B#define HELLO_H(B -(B (B -(Bvoid(B (Bhello(B();(B (B -(B (B -(B#endif(B (B \ No newline at end of file diff --git a/tests/tools_test.py b/tests/tools_test.py index 0753d01..61f9a6e 100755 --- a/tests/tools_test.py +++ b/tests/tools_test.py @@ -154,13 +154,6 @@ class ToolsTestCase(unittest.TestCase): # self._test_tool(tools.perl6_syntax, # [("perl6.p6", tools.Status.problem)]) - def test_uncrustify(self): - self._test_tool(tools.uncrustify, - [("closure-util.java", tools.Status.problem), - ("hello.c", tools.Status.normal), - ("hello.h", tools.Status.normal), - ("hello.cpp", tools.Status.normal)]) - def test_c_syntax_gcc(self): self._test_tool(tools.c_syntax_gcc, [("hello.c", tools.Status.ok)]) @@ -204,9 +197,6 @@ class ToolsTestCase(unittest.TestCase): def test_cpp_syntax_gcc(self): self._test_tool(tools.cpp_syntax_gcc, [("hello.cpp", tools.Status.ok)]) - def test_bcpp(self): - self._test_tool(tools.bcpp, [("hello.cpp", tools.Status.normal)]) - def test_php7_syntax(self): self._test_tool(tools.php7_syntax, [("root.php", tools.Status.ok)])