Giter Site home page Giter Site logo

Comments (8)

artis3n avatar artis3n commented on August 17, 2024 1

Git diff shows this fixing the issue! Comments are removed from the generated documentation

image

from konstraint.

jalseth avatar jalseth commented on August 17, 2024

Konstraint treats the @kinds tag as the end of the header block when parsing the policy description. This was selected when @kinds was the only tag Konstraint supported, so this may need a refresh.

Since all of the @ tags are optional and can exist in any order, it may be best to add an @end tag or something similar so Konstraint can easily know when a comment is no longer a part of the header block. What are your thoughts @artis3n @jpreese ?

from konstraint.

artis3n avatar artis3n commented on August 17, 2024

Ah, and I don't use the @kind tag because I'm writing policies beyond just kubernetes - using Konstraint for policy documentation of the rest of what Conftest can test as well as k8s.

I understand Konstraint is primarily a tool to templatize policies between Conftest and Gatekeeper, but to leverage its policy self-documentation utilities - I would prefer Konstraint to use the contiguous block of comments above a package declaration / at the top of a file and ignore any other comments in the file. Then, the content can exist in that contiguous block in any order, and anything within that contiguous comment block that does not begin with @ should be treated as part of the policy description.

read lines in file, while line begins with #, treat as part of policy header, break when line no longer begins with #. But it doesn't look like you maintain the file structure when parsing the Rego, you have all comments in the file and have to work with that. If that is the case, then adding a @end works. That suggests there should be a @begin or @start highlighting the start of where Konstraint should look for policy declaration - if the r.comments is ordered such that the comment lines appear in the same order that they are written in the file, earlier lines first.

I have used Go, many years ago, and have only interacted with rego for writing policies. So hopefully my comments make sense for the tools we have in the language.

from konstraint.

jalseth avatar jalseth commented on August 17, 2024

That sounds good, and it shouldn't be too hard to implement. I'll probably have time to get to this next week.

from konstraint.

jalseth avatar jalseth commented on August 17, 2024

@artis3n this was implemented in #104 and it seems to work in my testing. Can you try with your policies and let me know if you run into any issues?

from konstraint.

artis3n avatar artis3n commented on August 17, 2024

Will check on Monday

from konstraint.

artis3n avatar artis3n commented on August 17, 2024

Is there any particular cadence to Konstraint's release cycle? It would be nice to take advantage of this fix but I don't see that #104 has been released.

from konstraint.

jalseth avatar jalseth commented on August 17, 2024

@artis3n We don't have any formal release schedule at the moment, but I think it would be fair to target monthly at a minimum going forward, with a release every 2 weeks being a stretch goal. @jpreese do you have any thoughts?

from konstraint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.