Book a Demo

Author Topic: Code Templates / StyleCop  (Read 3639 times)

RainerQ

  • EA User
  • **
  • Posts: 122
  • Karma: +1/-0
    • View Profile
Code Templates / StyleCop
« on: March 22, 2010, 01:25:57 am »
Hello,

I am using StyleCop in my visual studio projects to verify the coding style.
EA with its default code templates generates the code in a way, StyleCop doesn't like it at all.

Is anybody else using StyleCop in VS together with EA?
If yes how did you solve the issue?

Besides is ther a way to - easyly have EA use "Spaces" instead of Tabs on code generation?

Thanks for hints an tips.

Regards
Rainer

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Code Templates / StyleCop
« Reply #1 on: March 22, 2010, 05:26:51 am »
Hi Rainer,

We're also using certain coding rules for the C/C++ code in our company. That's generally also true for the generated code. We don't have a tool running, but at least human reviewers that could complain and extend the review session unnecessary.
It's relatively easy to adapt the code generation templates EA provides by default for a certain language or specific stereotypes. Process of some trial and error maybe, but generally viable. Despite you have s.th. in the code models that EA uses that violates some very basic differences from the paradigms used of your tool.
Look here to get a better grip of EAs code template language:
http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/codetemplates_2.html

HTH
g.

P.S.: If you put spaces in the templates they shoud 'spit out' spaces, if you put tabs there, then tabs.
« Last Edit: March 22, 2010, 05:29:40 am by g.makulik »
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

RainerQ

  • EA User
  • **
  • Posts: 122
  • Karma: +1/-0
    • View Profile
Re: Code Templates / StyleCop
« Reply #2 on: March 22, 2010, 06:57:25 pm »
Hi Günther,

thanks a lot for your answers. This weekend I tried to modify the code templates towards the layout I would like to have.

For me as a beginner this is a little bit intricate and inconvenient and I was hoping that some code templates like I need already exist, for me to copy/past  ;)

Well in the worst case I will have to the hand work ::)

Regards
Rainer

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Code Templates / StyleCop
« Reply #3 on: March 22, 2010, 09:43:49 pm »
Quote

Well in the worst case I will have to the hand work ::)
Depends on your workload I think. I personally prefer to do such "proof of concepts" on my own, at least to a point where I can be sure of myself being able to 'direct' others.
That was one of the reasons why I've been "playing" around with EA also a lot at home (and still do, but not to that extend it was during evaluation phase).

VBR
Günther