Faint Comments
This repository is my attempt in 100 commits competition.
⚠️ This project is in PoC and still needs to be polished. Always pin version. Do backup or use version control before applying any command.
What it is?
This library keeps your code comments in separate file and allows to put them back on.
Why
Comments are code smell. But sometimes:
- you just want to have your own note that should never appear in Version Control.
- you have code that needs some comments but comments must always be removed before deploy on production.
- you want to give someone instruction on what to do in certain files.
In all this cases it would be handy to keep all comments in separate file that could be potentially git ignored but at the same time applied whenever you want to read them.
Also I thought I can learn some cool algorithms and tools.
Demo
I need to record the example of usage.
How to install
Not installable yet. I need to change name and send to PyPi.
How to use
faint is made of two main subcommands:
faint extract <file name>which removes comments from code and place them in separateJSONfile.faint join <file name>which applies comments fromJSONfile (if exists) in corresponding places.
By default (not changeable yet) JSON files are named as comments_<original name>.json.
So you can add to .gitignore line like comments_*.json.
Workflow
First use extract on the file. Then you can:
- Use
joinand not modify the file - Use
joinand modify the file - Continue to modify the file and then use
join
Then:
- If you apply
joinon file that matches exactly the file afterextractit should be fast and simple and you should get all comments back in place. - If you apply
joinand file follows the structure good enough you should also get all comments back in right place.
In both cases the extract should work as at the beginning.
Current version does not allow for:
extracton alreadyextracted file (it will discard all comments inJSON)joinon alreadyjoined file (it will place the comments twice)
So if you want to add any new comments you should first join comments and the extract them.
Supported languages
This tool uses TreeSitter. For every language the AST (Abstract Syntax Tree) has different nodes.
For this reason every language needs to be covered separately.
- Python
TODO
- Make it pip installable
- Fix double join
- When extracting, compare with current
JSON - Show abandoned comments
- Show deleted comments
- When
joinand comment is abandoned inform user. Then suggest--forceflag. - Allow for path to subdirectory
- Figure out how to install TreeSitter per language
- Add Git hook
- Handle when there is new comment on already
extracted file - Create
join-extractcommand
Future plans
Metadata
Release files for faint 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| faint-0.1.tar.gz | 16.4 kB | Without provenance | Details for faint-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| faint-0.1-py3-none-any.whl | Python 3 | none | any | Details for faint-0.1-py3-none-any.whl |
Total release size: 27.6 kB
Release files / faint-0.1.tar.gz
| Download URL | faint-0.1.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
913357abfbb283effdbb96b6626c6e3fca86d567e5476608c20ebc13cb9cad4a
|
|
BLAKE2b-256 checksum How to use checksums |
1e6663a071243d9c7b934011b7624fe39e8161e39ea95e8d14c0972dcba5a43a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Release files / faint-0.1-py3-none-any.whl
| Download URL | faint-0.1-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9daa1e5c3a9fa46012f561f9a6f7672743f9f5419bfaaae71d3ccb36b009698b
|
|
BLAKE2b-256 checksum How to use checksums |
0ca301f019f0c6220fc01c3ff2375ee2048a4a92dbd115f5ebf8f4ed41ee5976
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Security for faint 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.