Generate documentation from annotated Acceleo - documentation-generation

As I'm currently doing research on model-based testing I often have write a lot of acceleo code. I'm currently at a point where I asked myself whether it is possible to generate automatically a documentation from my annotated acceleo templates and queries.
So my first step was to try out Doxygen to generate the documentation. I simply used the default settings of the doxygen generator except that I added the *.mtl ending to FILE_PATTERN and checked the EXTRACT_ALL option. But unfortunately, doxygen only parses the Java classes that run the acceleo code.
My question is, are there any options I miss to activate so that doxygen will work with acceleo? Or are there other alternatives?

Related

Debugging Acceleo M2T Transformation within MTL file

I'm currently setting up an Acceleo project to generate Java source code from an Eclipse UML2 model. I do have experiences with the Xtend code generator, but not with the Acceleo one. However, I wanted to try Acceleo as an alternative to Xtend.
Unfortunately, I do have problems with debugging the M2T transformation from within the MTL template file. All breakpoints I set in the MTL are just ignored and the debugger runs the transformation without stopping.
I've searched Stackoverflow and other sources for help, but none of the responses helped me to get the debugger to work.
I'm running the transformation as an Acceleo Application and am using the Java Application runner since the Acceleo Plug-in Application is no longer supported with Eclipse Oxygen.
Did anyone of you have similar troubles and/or found any solution?
Thanks for any hint.
Best regards
Timo Rohrberg
I have the same requirement, but apparently there is not way to debug it at runtime, as far as I know.
https://www.eclipse.org/forums/index.php?t=msg&th=1080008&goto=1740153&#msg_1740153
Create a wrapper service for java printing/logging.
This is not the best solution, but, I was able to make do.
You could also use the acceleo interpreter (using the acceleo eclipse perspective) to try and evaluate queries before changing your code.
https://wiki.eclipse.org/Acceleo/Interpreter
I use this with papyrus and it works nicely.
I found a solution (or workaround) to debug .mtl files.
In the manifest editor window of your eclipse plugin
-on the runtime tab add your bin folder (the folder containing the compiled .class and .emtl files) to the classpath.
After this your breakpoints in the .mtl files will work, if you run your Acceleo launcher in "Acceleo Plug-in Application" mode. (Configuration section in the Acceleo launcher window)
(Tested with Eclipse 19-03, Acceleo 3.7)

Clion sort include statements

Is there a way to sort my #include statements in Clion? Additionally, can I do this automatically every time I save? I didn't manage to find any such functionality or plugin.
Yes, it is possible with help of clang-format.
File->Settings...->Languages & Framework->C/C++->Clangd->Enable clangs server
clang-format should be installed in your system. Normally it is available in your favourite repository. You can specify the path to it if required
File->Settings...->Tools->clang-format
You have to put .clang-format file into your project root with coding rules. More information you can find on clang-format web site. For example, I am using Google coding rules. My content looks like this:
Language: Cpp
BasedOnStyle: Google
This includes already the include statements sorting. However, there is a choice of other ready-to-use coding styles like LLVM, Mozilla, WebKit, Chromium which you can use and if necessary modify or you can create your own format by providing set of rules you want. The rule you might be interesting in is
SortIncludes (bool)
If true, clang-format will sort #includes.
Please refer to the clang format documentation here

sonarqube 4.5 has misidentified a cpp module as c - how can I fix it

I created a multi-module project with a single sonar-project.properties. Most of the project is in c but one module is c++. I left the sonar.language property blank and ran sonar-runner with analysis.
The project and modules were created in the database and everything looked OK but when I did a preview on the same code I had a large number of new issues on the c++ project.
On closer inspection I found that the module in sonarqube was all wrong - it consisted of only the header files (.h) and most of the issues were the use of C style comments. It seems that the module was identified as a C module so all the .cpp files were ignored. However, in the preview the language was identified correctly and issues were found in the .cpp files that were clearly not know to sonarqube.
I cannot find any place in the UI to change the language of a module nor can I figure out a way to force it after the fact in my sonar-project.profiles.
First, sonar.language is apparently deprecated, and second, using module.sonar.language=cpp caused an error:
Caused by: sonar.profile was set to 'DEFAULT_C' but didn't match any profile for any language. Please check your configuration.
DEFAULT_C is something that we use for projects generally but not the one I'm working on. I have different profiles set up for different languages via the UI, but if I cannot get the analysis to see the correct language it doesn't help me much.
Any one have any idea how I can force the language of a module after the fact?
Hmm. I considered just deleting this but if I had found an answer on stackoverflow it would have eased my pain a little.
Brute force works.
Just set the language and the profile you want for the moudle and ignore complaints about such things being deprecated. Chosing a language won't force the right profile even if you have set up an explicit profile for the language in the UI - so just state it in the sonar-project.properties file.
In my case:
module.sonar.language=cpp
module.sonar.profile=MY_CPP_PROFILE
Throw sonar-runner at that and it will beat the backend into shape.

C unit test frameworks with Sonar

Is CppUnit the only C/C++ unit test framework currently available for use with Sonar?
What would be involved in adding additional C/C++ unit testing frameworks? (e.g. how many lines of code is the CppUnit plugin, how reusable, etc.)
I think you should better send your queries in Sonar's mailing lists : http://www.sonarsource.org/support/support/
See the unit test page: http://docs.codehaus.org/display/SONAR/Unit+Test+Support
From that page:
The C++ Plugin parses xunit compliant format using the
sonar.cxx.xunit.reportPath. To use other formats, first they need to
be converted using the property sonar.cxx.xunit.xsltURL
For convenience the following xsl are provided
boosttest-1.x-to-junit-1.0.xsl For transforming Boost-reports
cpptestunit-1.x-to-junit-1.0.xsl For transforming
CppTestUnit-reports cppunit-1.x-to-junit-1.0.xsl For transforming CppUnit-reports
So packages that support xUnit format, like Google Test Framework, should be supported. Otherwise, if they output xml they should be supportable by changing the xslt.

Are there any extensions for either Boost.Test or cppUnit which could provide HTML outputs etc?

I am involved in development of unit level test cases for our project. There are both managed code and native C++ code. After some study I chose NUnit for managed code. I would either use Gallio or FireBenchmarks which is an extension to provide HTML outputs and charts etc.
Do we have extensions like this for cppUnit or Boost.Test ? I have not decided which one to use. If there are none, which of these would be easier to extend to enable such a plugin ?
Please give your suggestions on this.
You can configure Boost.Test to generate XML output. The doc says:
This log format is designed for
automated test results processing. The
test log output XML schema depends on
the active log level threshold.
This can be enabled by specifying -output_format=XML on the command line, or by setting the environment variable BOOST_TEST_OUTPUT_FORMAT=XML. The related docs are here.
It is also possible to configure Boost.Test at compile time to produce XML output by default (described here)
In order to generate HTML you either need to implement your own formatter (which is possible, but nicely underdocumented, so please ask on the list) or to transform the XML in a postprocessing step.

Resources