Comments (5)
Yea happy to take a shot! And any guidance/tips on where to implement/test would be great, as Iβm not yet too familiar with the codebase :)
from bulloak.
Thanks for all the details! It definitely is more involved than I thought so I probably won't have the time to implement it anytime soon, and would happily defer the work to you if you have the bandwidth π
From a UX standpoint, I think the recursive parsing option is better than requiring a new keyword in tree files
from bulloak.
Cool! This sounds like a good use case ππ» I'm happy to implement it.
If you'd like to give it a go lmk first, and I'll ping you after I merge a big revamp for bulloak check
I'm working on.
from bulloak.
Okay, sorry for the delay, I finally have a structure that I'm happy with for bulloak check
, so I can share some pointers with you. I haven't merged it because I need to finish implementing the rules, add docs & more tests, but you can take a look at #31 if you want to start getting a hang of the new repo.
After thinking a bit more about this feature, I realized this is a non-trivial amount of work. However, the steps are roughly as follows:
- Take a look at the
_parse
function (arguably the obscurest part of the code because it's recursive),Line 202 in 5ebf414
TokenKind::It
branchLines 223 to 230 in 5ebf414
- One solution is to
_parse
recursively until it finds something that isn't aTokenKind::Word
. - Another is to add a new keyword which we remove further down the compiler so that it doesn't show up in the comments.
- Note that this should track the indentation level, unsure how this might look, but my first thought is to use a stack and add the current level to the
ast::Ast
variant created in the next bullet.
- One solution is to
- Then, you can add a new
ast::Ast
variant -- something likeActionDetail
orActionDescription
. - Then, you can extend
ast::Action
to include achildren: Vec<Ast>
and the compiler should guide you into filling all the gaps introduced, which should roughly be:- Add a corresponding
visit_action_detail
function to thesyntax::visitor::Visitor
trait. This will also break the project in a few places (semantics
,modifiers
&translator
). - Map all of the child
ActionDetail
of an action into thelexeme
field ofhir::Comment
inhir::translator
.
- Add a corresponding
- Then (or before), test it all out, make sure we don't create the new AST nodes when we shouldn't and add documentation.
It's quite a lot of work, so feel free to leave it to me. Also, the parsing step is a bit overcomplicated because it was more natural for me to do it recursively, but it should probably be done iteratively. If you decide to dive in, lmk if you have any questions!
Also, it's probably best if you wait a bit to give me time to finish #31.
from bulloak.
Thanks for all the details! It definitely is more involved than I thought so I probably won't have the time to implement it anytime soon, and would happily defer the work to you if you have the bandwidth π
Ofc! No worries. I'll get to it when I can!
from bulloak.
Related Issues (20)
- Commit Cargo.lock file HOT 9
- feature request: add support for different targeting behaviours HOT 8
- Panic when using proper English intepunction HOT 6
- bulloak check --fix doesnβt apply forge fmt settings from foundry.toml HOT 1
- Bulloak fails when word βwhenβ is used deep in the βItβ leaf HOT 5
- bulloak check panics HOT 4
- Add vm.skip(true); to generated tests HOT 6
- Bulloak scaffold panics when `,` in the leaf HOT 1
- Feature: Implement automatic fix for roots with different contract name HOT 3
- Feature: add fuzzing parameters
- Refactor: create a cfg struct to inject dep HOT 2
- Feature request: add a tag for the unit test coverage approach HOT 19
- Feature request: Ignore modifier definitions in the test contract HOT 10
- Bug: RevertWhen_Something doesn't apply when adding revert comments HOT 2
- Modifiers are confusing if staying empty. HOT 8
- Comments not working correctly when placed lines after/before the tree HOT 2
- Feature: Provide a way to specify condition names HOT 1
- Naming Check HOT 7
- Skipping modifiers makes the check command produce false positives HOT 3
- Add documentation for renaming test contracts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bulloak.