Closed mds1 closed 9 months ago
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.
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 :)
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 https://github.com/alexfertel/bulloak/pull/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:
_parse
function (arguably the obscurest part of the code because it's recursive), https://github.com/alexfertel/bulloak/blob/5ebf414ee6b5b930d03f21bdfc50ca660a589b85/src/syntax/parser.rs#L202 specifically at the TokenKind::It
branch https://github.com/alexfertel/bulloak/blob/5ebf414ee6b5b930d03f21bdfc50ca660a589b85/src/syntax/parser.rs#L223-L230
_parse
recursively until it finds something that isn't a TokenKind::Word
.ast::Ast
variant created in the next bullet.ast::Ast
variant -- something like ActionDetail
or ActionDescription
.ast::Action
to include a children: Vec<Ast>
and the compiler should guide you into filling all the gaps introduced, which should roughly be:
visit_action_detail
function to the syntax::visitor::Visitor
trait. This will also break the project in a few places (semantics
, modifiers
& translator
).ActionDetail
of an action into the lexeme
field of hir::Comment
in hir::translator
.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 https://github.com/alexfertel/bulloak/pull/31.
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
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!
I have a function that looks like this:
The rationale is add a lot of block properties to make it as unique as possible across chains/txs. But this isn't all possible properties, so a spec might look like this:
But that's not fully specified as it doesn't specify which block properties. So it might be nice to support something like this:
Which would get rendered into a test like this:
In other words, the rule here is: Anything nested under an
it
gets included in the comments for thatit
, and it gets included at the respective indent level. So since there's one level of nesting for all those bullet points, in the comment they are indented by two spaces. As another example:would generate: