Re: Ignoring blocks of code..?
Simon Harris <[email protected]> Fri, 15 Apr 2005 01:36:36 +1000
| Newsgroups | gmane.comp.java.simian.user |
|---|---|
| Message-ID | <[email protected]> |
Mark, It's 1.30am here but I've been awake writing (or at least attempting to write) so your email was a nice distraction :) I have to admit that I'm not a great fan of ignoring blocks myself. I feel it is far too easy to abuse. I do however concede that it may sometimes be necessary to use. Along the same lines, when someone told me about the use of #region/#endregion in C# I was a little take aback as it seemed to be that the code was being polluted by constructs designed solely for the tool. But again, I concede that the reality is most people code within the tool anyway. Thanks for the kind words too by the way. Always nice to know people are finding Simian useful. Oh, the #region/#reqion stuff really does just ignore all regions. Someone asked for it a while ago, back before I even knew what they were for :) Anyway, I guess it comes down to how much you trust your developers not to subvert the process by simply marking up the code. As the customer, I'm more than happy to do what you think is going to help improve your code quality. Besides, I honestly haven't come up with a better alternative. hehe. Maybe it's an option we just have to have? Simon On 15/04/2005, at 1:22 AM, Mark Webb wrote: > > Simon > > Thanks for the prompt reply. > > I noticed the #region support, but given that our code is mainly (about > 95+%) C++, the remainder being C# or some other language this doesn't > work for us yet. > On the subject of regions, does this switch ignore ALL regioned code? > Is > it possible to ignore regions with specific names? > The reason I ask, is that we region all of our C# code into logical > blocks to ease code reading. > > The ideal would be to find a language agnostic solution. > Maybe an option like... > -ignoreblock "// START ignore dupes" "// END ignore dupes" > Or for VB this might read > -ignoreblock "' START ignore dupes" "' END ignore dupes" > > So that we can mark the code in anyway we see fit, and Simian can be > passed the appropriate markers. > > I am not so keen on the solution of a file containing file and line > numbers. As you say this is volatile and would need to maintained as > the > code base changes. > > BTW, I have to say Simian is an excellent tool and has already helped > us > significantly reduce code duplication. Once we can get a clean run > (i.e. > we have filtered out 'good' duplicates, and fixed 'bad' duplicates) we > hope to use it as a policing tool to automatically catch the Copy-Paste > offenders :) > > Cheers, > Mark > > -----Original Message----- > From: Simon Harris [mailto:[email protected]] > Sent: Thursday, April 14, 2005 11:12 AM > To: [email protected] > Subject: Re: [simian-user] Ignoring blocks of code..? > > Hi Mark, > > This is an interesting and ongoing debate in the simian user community; > ie what to do about duplicates that you wish to ignore. > > There are a few options. One would be to mark-up the source code. If > you > are using C#, this is already possible as #region #endregion markers > are > already supported. > > If this doesn't work for you, or you are using some other language, > another option would be to come up with some other kind of tag to > indicate that simian should ignore it. > > Yet another possible solution would be have a file containing code > fragments that are consider "legal" duplicates. > > And one final, yet somewhat volatile, approach would be to have a file > containing files and line number ranges of code blocks to ignore. > > One thing that has come up occasionally is that duplicate blocks that > one considers to be "legal" may well be candidates for code generation > - thought his doesn't sound like it's the case in your situation. Or > even template methods - though I have a general disdain for these. > > Any and all of these are possible, it's really a matter of what you > think would work for you. > > Regards, > > Simon > > On 15/04/2005, at 12:19 AM, Mark Webb wrote: > >> >> >> Is there any way to ignore blocks of code from parsing? >> >> We have a number of code snippets that are flagged as duplicates, but >> really are not (about a half dozen over 4million lines of code). >> >> It would be useful if there were either a directive I can put in the >> code, or a flag I can pass to Simian that can ignore all code segments > >> that I have validated manually. >> >> If not, might this be something that can be added in a future version? >> >> Cheers >> Mark >> > > -- > Simon Harris > RedHill Consulting, Pty. Ltd. > 12/55-67 Batman Street > West Melbourne VIC 3003 > http://www.redhillconsulting.com.au > mob: +61 417 505 611 > yahoo/skype: haruki_zaemon > > > > -- Simon Harris RedHill Consulting, Pty. Ltd. 12/55-67 Batman Street West Melbourne VIC 3003 http://www.redhillconsulting.com.au mob: +61 417 505 611 yahoo/skype: haruki_zaemon