eBPFDevSecTools / opened

OPENED Tool to extract specific eBPF functions from large monoliths (tested on Katran, Mizar, Cilium..)
Apache License 2.0
12 stars 6 forks source link

Scrub all in-code comments and add to comment stub. with line number #60

Closed sdsen closed 1 year ago

sdsen commented 1 year ago

Is your feature request related to a problem? Please describe. The comment stub should store all code line specific comments along with line number where the comment is found. As it is not possible to identify lines which correspond to the comment, we will not attempt to determine the same. Describe the solution you'd like Modify comment_remover function to identify and save the in-code comments along with their place of occurance.

sdsen commented 1 year ago

This will entail extending the following function: https://github.com/sdsen/opened_extraction/blob/main/src/remove_c_style_comments.py which has regex to identify multi-line, multi-format comments. You will need a modified regex which given a buffer returns array of inline comments, ideally keyed with line number in source_file.

sdsen commented 1 year ago
  1. This code removes reads between specific lines and removes inline comments and return buffer: https://github.com/sdsen/opened_extraction/blob/0573e14c73ecf6f84804e6e3fdd37266e40e700c/src/summarizer.py#L249
  2. Call your inline commentor like this: https://github.com/sdsen/opened_extraction/blob/main/src/code_commentor.py#L60 and write the output dict to capability_dict.
dushyantbehl commented 1 year ago

Code in #79