Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/huitseeker/comby-rust
Rust refactoring templates for comby, the structural find-and-replace tool.
https://github.com/huitseeker/comby-rust
comby linting parsing program-transformation refactoring rust search-and-replace syntax-transformation
Last synced: about 1 month ago
JSON representation
Rust refactoring templates for comby, the structural find-and-replace tool.
- Host: GitHub
- URL: https://github.com/huitseeker/comby-rust
- Owner: huitseeker
- License: mpl-2.0
- Created: 2019-09-28T20:21:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-17T07:50:54.000Z (about 2 years ago)
- Last Synced: 2024-12-24T05:54:01.948Z (about 1 month ago)
- Topics: comby, linting, parsing, program-transformation, refactoring, rust, search-and-replace, syntax-transformation
- Language: Rust
- Homepage:
- Size: 44.9 KB
- Stars: 33
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# comby-rust
Rewrite rules for [Rust](https://github.com/rust-lang/rust) code using the
[comby](https://comby.dev/) refactoring tool.## Overview
This structural find-and-replace tool allows implementing rules with different
purposes:- `templates.toml`:
refactorings that are non-controversial and will require minimal manual supervision a posteriori. They should not change code semantics.
- `experimental-templates.toml`:
refactorings that are a matter of style, or will require modifications in a large number of cases, but may still be useful.
- `nopanic.toml`:
refactorings that remove panics (and therefore change semantics).## Requirements and installation
Please refer to the [comby installation and usage instructions](https://comby.dev/docs/get-started).
## Running
- `comby -config templates.toml -f .rs` finds matches
- `comby -config templates.toml -f .rs -i` replaces file contents
- **You may want to run `cargo clean` before running the above**
- **You should run `cargo fmt` after running the above**Exclude `target` directory with:
- `comby -config template.toml -f .rs -i -exclude-dir target`
## Testing
See the `test/run.sh` script for templates and expected results.
## See also
[go-patterns](https://github.com/comby-tools/go-patterns), a similar pattern
repo for the Go language, which inspired this.## Licence
Copyright 2021 François Garillot
This software is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.## Code of Conduct
Please note that this project is released with a [Contributor Code of
Conduct][coc]. By participating in this project you agree to abide by its
terms.[coc]: https://github.com/huitseeker/comby-rust/blob/master/CODE_OF_CONDUCT.md