[codelinks]# Configuration for source tracingset_local_url=false# Set to true to enable local code html and URL generationlocal_url_field="local"# Need's field name for local URLset_remote_url=true# Set to true to enable remote url to be generatedremote_url_field="remote-url"# Need's field name for remote URL[codelinks.projects.eac-cpp]remote_url_pattern="https://github.com/useblocks/eac/blob/{commit}/{path}#L{line}"# URL pattern for remote source code[codelinks.projects.eac-cpp.source_discover]src_dir="../src"# Relative path from this TOML config to the source directoryinclude=["*.cpp","*.h"]exclude=[]gitignore=truecomment_type="cpp"[codelinks.projects.eac-cpp.analyse]get_need_id_refs=trueget_oneline_needs=trueget_rst=true[codelinks.projects.eac-cpp.analyse.oneline_comment_style]# start_sequence = "@"# end_sequence for the online comments; default is an os-dependant newline characterfield_split_char=","needs_fields=[{"name"="title","type"="str"},{"name"="id","type"="str"},{"name"="type","type"="str","default"="impl"},{"name"="links","type"="list[str]","default"=[]},]
Step 3: Add the src-trace Directive
In your documentation files, add the following directive to display traced source code links:
..src-trace:::project: eac-cpp
:directory: .
Step 4: Annotate Your Source Code
Add comments to your source code files to link code lines to needs. For example, in src/main.cpp:
#include<iostream>// @Adding two integers, IMPL_1, impl, [REQ_0815]intadd(inta,intb){returna+b;}intmain(){std::cout<<"Hello World"<<std::endl;return0;}
Step 5: View Traced Files and Lines
After following the steps above, the documentation will show the traced files and lines for each need in the specified project (eac-cpp). Here we show only the implementation files (not test files):
This is a requirement that links to a need that has traced source code lines.
Note
Current limitation: ubCode is not aware of this need id yet. This means that
the ubCode navigation inside Visual Studio Code will not work and jumping from
this rst file to the source code line will not work. This will be implemented
and supported in a future release.