Turns west-const C/C++ source files into east-const
Project description
Westerly
A wind blows over the C
so strong that it moves 'const' you see
from the west to the east
some of 'em at least
Westerly is a script to re-arrange const in your C/C++ source files to
follow east-const convention. Plenty of articles have been written about
why you would want to do that, I'm not going to repeat the arguments here
and will instead assume that you have arrived here because you are
convinced of the merits.
Installation
Todo once available PyPI ...
Usage
Once installed you can use the following command to run westerly on a source file:
westerly $file
By default, the rewritten source will be written to stdout. To perform
the replacement in-place, pass the --in-place option:
westerly --in-place $file
It is highly recommended that you only run westerly on version-controlled source-code, so you can go back in case something goes wrong. Westerly uses a set of heuristics to determine which consts to move and where, it doesn't actually have a full understanding of C++ syntax. No heuristic is perfect. You have been warned.
It is also highly recommended to pass the changed code through
clang-format (or git clang-format) as westerly will sometimes mess up
formatting a bit.
FAQ
Why, oh why?
Because sometimes you have solved all business cases and all that there is left to do is to cleanup up code and make it consistent. Yes, seriously.
Why doesn't westerly have options to control spacing around const?
I get it, you don't like the spaces westerly puts around const. You
would rather prefer to have it output const& instead of const &. You
are not alone. Surrounding const with spaces on boths sides is just
the pragmatic choice as there is no danger of fusing const with
surrounding tokens by accident. As mentioned above, you should pass your
code through clang-format after running westerly, which has plenty of
options to configure spaces around const.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file westerly-0.1.tar.gz.
File metadata
- Download URL: westerly-0.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20331e978f28124803d9d05e67356971964bf1487a885cad7addf4c58abfa756
|
|
| MD5 |
0dd8715c251dbedc890c2d3fd2a84c76
|
|
| BLAKE2b-256 |
632b2a8ca0cbd4ee00acc79417a3b46c3b7ff55f38f314458ae4d388547d8cc4
|
File details
Details for the file westerly-0.1-py3-none-any.whl.
File metadata
- Download URL: westerly-0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2a9db51487f099db66ca0cfea7852b8f27eb05883d1b8ca9937de3202d11dd9
|
|
| MD5 |
76a734e9c090a28f8474d32cfe445f28
|
|
| BLAKE2b-256 |
874b028487c7ce555743c559889c628ad80e7f95d64f6cfb7a866774db2d0a6c
|