flatt-security / shisho

Lightweight static analyzer for several programming languages
https://docs.shisho.dev
GNU Affero General Public License v3.0
370 stars 15 forks source link

Language Support: YAML #53

Open lmt-swallow opened 3 years ago

lmt-swallow commented 3 years ago

tree-sitter grammar for YAML is here. It would be helpful to validate YAML quickly.

lmt-swallow commented 2 years ago

I've considered how this support should be and decided to introduce a new DSL to describe a query, apart from the current one, to search over/transform codes. Note that this decision still needs to be self-reviewed carefully.

Reason

Our existing DSL is good at describing a query in the almost same form as codes to search over/transform. However, for some languages that are used for describing a data structure instead of a control flow, such as JSON or YAML, this kinda DSL could be expressive too much! What we really need to handle them is a simpler one with minimum expressivity.

Initial Design of Our New DSL

Now I'm thinking about syntax & semantics for our new DSL. It can be something like jq or yq; their DSLs are expressive enough to describe what kind of data should be matched and how the data should be like.

Another choice could be some kinda language with a notation to describe the commutativity of components. I may have read an academic paper on this topic.