{ "info": { "author": "Michael Krause", "author_email": "michael@krause-software.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance", "Topic :: Utilities" ], "description": "whatstyle\n=============\n\nwhatstyle finds a code format style that fits given source files.\n\nCode formatters like clang-format or uncrustify usually need a specific style\ndefinition how to reformat the code.\nThis program looks at your source code and generates a style definition\nthat the reformatted source fits its original formatting as closely\nas possible.\n\nIt should help programmers to begin using a formatting tool right away\nwithout the need to invest hours of reading the formatting tool\ndocumentation.\n\nThe currently supported formatters are `clang-format`_, YAPF_, Tidy_, indent_,\n`Artistic Style`_, Uncrustify_, scalariform_, scalafmt_, rfmt_ and rustfmt_.\n\n.. _`clang-format`: http://clang.llvm.org/docs/ClangFormat.html\n.. _YAPF: https://github.com/google/yapf\n.. _Tidy: http://www.html-tidy.org\n.. _indent: http://www.freebsd.org/cgi/man.cgi?query=indent\n.. _Artistic Style: http://astyle.sourceforge.net\n.. _Uncrustify: https://github.com/uncrustify/uncrustify\n.. _scalariform: https://github.com/scala-ide/scalariform\n.. _scalafmt: https://github.com/olafurpg/scalafmt\n.. _rfmt: https://github.com/google/rfmt\n.. _rustfmt: https://github.com/rust-lang-nursery/rustfmt\n\n.. contents::\n\nHow to run\n------------------\n\nFirst you choose one or more of your source files whose style you find\nrepresentative of the style you want to keep.\nThe source files should cover a wide range of language constructs and\nto keep runtime down not exceed a few thousand lines if possible.\n\nYou specify the formatter and source files as follows:\n\n.. code-block:: bash\n\n $ whatstyle.py -f clang-format tests/examples/gumbo-parser/utf8.c\n\nwhatstyle will then try different options while reporting intermediate results.\nAfter a while you get back a result like this:\n\n.. code-block:: bash\n\n ### This style was chosen for your .clang-format - it perfectly matches your sources.\n BasedOnStyle: Google\n AlignAfterOpenBracket: DontAlign\n SpaceAfterCStyleCast: true\n\nAdding the option ``--mode resilient`` will usually add more options to your style so\nthat a heavily out of shape version of your sources can be better retransformed into your\nstyle.\n\nStyle difference effects vs options documentation\n-------------------------------------------------\n\nReading the documention of the invidual options of a formatter takes time and does not\nnecessarily make clear how an option influences the formatting.\nYou can try something like this instead:\n\n.. code-block:: bash\n\n $ whatstyle.py --variants tests/examples/xv6/printf.c\n\nFirst the best matching style is chosen and then every option is replaced or augmented by\nevery possible value. All combinations that actually made a difference are grouped and\ndisplayed side by side.\nThe variant on the left is the original from the best style, on the right is another\noption setting that usually makes things worse.\nBelow the option values, differing code fragments are shown, you can use ``--numhunks``\nto show more diff hunks per variation.\nUse ``--ansi`` to display the variants table in an ANSI terminal, ``--html`` to open it\nin a browser or ``--ansihtml`` for a darker look in a browser.\n\n.. image:: https://raw.github.com/wiki/mikr/whatstyle/images/variants.png\n :target: https://raw.github.com/wiki/mikr/whatstyle/images/variants.png\n :alt: Format Style Variants\n\nUsage scenarios\n---------------\n\nFor information about some useful scenarios run:\n\n.. code-block:: bash\n\n $ whatstyle.py --usage-examples\n\nor read the text at the beginning of whatstyle.py.\n\nRequirements\n------------------\n\nwhatstyle needs at least Python 2.7 and it works as well with\nPython 3.2, 3.3, 3.4 and 3.5. Jython and pypy are supported.\n\nAlso whatstyle needs at least one code formatter in the current ``PATH``.\n\nThe presence of either ``diff`` or ``git`` is optional but useful because the diff quality of\nboth of them may be better than Python's difflib and this results in a different and usually\nbetter matching style.\n\nThis program should work on OS X, Windows, Linux, FreeBSD and OpenBSD.\n\nHow it works\n------------------\n\nThe program basically works by reformatting the source with many\ncombinations of options and running a diff between the original\nand the reformatted source code.\n\nFirst the major standard styles (e.g. WebKit, GNU, LLVM) are evaluated\nand the closest one chosen as a baseline.\n\nSuccessively every choice of every style option is added to test\nif the additional option further reduces the differences.\nWhen no more option settings can improve the result the most appropriate\nstyle has been found.\n\nAmong a number of candidate styles with the same diff quality\nthe one with the least number of explicit options is chosen\nto keep the style definition brief.\n\nAuthor\n------\n\nwhatstyle was written by `Michael Krause `_.\n\nLicense\n-------\n\nwhatstyle is available under the `MIT license `_. See the LICENSE file for more info.\n\nThe project specific Open Source licenses of the source codes in tests/examples are present in their respective directories.\n\nSee also\n--------\n\n`Unformat: Python3 utility to generate a .clang-format file from example code-base `_.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mikr/whatstyle", "keywords": "formatter beautifier clang-format yapf tidy indent astyle uncrustify scalariform scalafmt rfmt rustfmt", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "whatstyle", "package_url": "https://pypi.org/project/whatstyle/", "platform": "any", "project_url": "https://pypi.org/project/whatstyle/", "project_urls": { "Homepage": "https://github.com/mikr/whatstyle" }, "release_url": "https://pypi.org/project/whatstyle/0.1.8/", "requires_dist": null, "requires_python": "", "summary": "whatstyle finds a code format style that fits given source files.", "version": "0.1.8" }, "last_serial": 5522203, "releases": { "0.1.8": [ { "comment_text": "", "digests": { "md5": "5523516683b6a47e5e15975b9f1c400c", "sha256": "bef54fa4baa3cf8d8b0059437b761a6e979eacb4c0196e9fdbcb7451e13260db" }, "downloads": -1, "filename": "whatstyle-0.1.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5523516683b6a47e5e15975b9f1c400c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 68878, "upload_time": "2019-07-12T08:30:38", "url": "https://files.pythonhosted.org/packages/e0/f4/65b684bdb2bd4c8b81514e416b2cd76478bfc39288572200f93c71bc764d/whatstyle-0.1.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "834cd450b2283301fd83bdbd3b51ccca", "sha256": "d4f451d782bfeda5d05c61e1ae7cfcc9eafb0e9a7b95d4a635e1cfb0a2e8b981" }, "downloads": -1, "filename": "whatstyle-0.1.8.tar.gz", "has_sig": false, "md5_digest": "834cd450b2283301fd83bdbd3b51ccca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 163228, "upload_time": "2019-07-12T08:30:40", "url": "https://files.pythonhosted.org/packages/ea/dd/f267cc6a2ada0e4347bec69549feae95c704513d7d80ba93919f8e44291d/whatstyle-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5523516683b6a47e5e15975b9f1c400c", "sha256": "bef54fa4baa3cf8d8b0059437b761a6e979eacb4c0196e9fdbcb7451e13260db" }, "downloads": -1, "filename": "whatstyle-0.1.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5523516683b6a47e5e15975b9f1c400c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 68878, "upload_time": "2019-07-12T08:30:38", "url": "https://files.pythonhosted.org/packages/e0/f4/65b684bdb2bd4c8b81514e416b2cd76478bfc39288572200f93c71bc764d/whatstyle-0.1.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "834cd450b2283301fd83bdbd3b51ccca", "sha256": "d4f451d782bfeda5d05c61e1ae7cfcc9eafb0e9a7b95d4a635e1cfb0a2e8b981" }, "downloads": -1, "filename": "whatstyle-0.1.8.tar.gz", "has_sig": false, "md5_digest": "834cd450b2283301fd83bdbd3b51ccca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 163228, "upload_time": "2019-07-12T08:30:40", "url": "https://files.pythonhosted.org/packages/ea/dd/f267cc6a2ada0e4347bec69549feae95c704513d7d80ba93919f8e44291d/whatstyle-0.1.8.tar.gz" } ] }