RE: Ignoring blocks of code..?
"Mark Webb" <[email protected]> Thu, 14 Apr 2005 12:03:58 -0400
| Newsgroups | gmane.comp.java.simian.user |
|---|---|
| Message-ID | <ECE66FDC2D185F40A7E8B6E66F4C894206CC5741@msgusaemb01.autodesk.com> |
Simon Your syntax looks fine, thanks for considering this for 2.1.5. Best regards Mark=20 -----Original Message----- From: Simon Harris [mailto:[email protected]]=20 Sent: Thursday, April 14, 2005 11:58 AM To: [email protected] Subject: Re: [simian-user] Ignoring blocks of code..? Mark, Consider it on the list for 2.1.5 along with the stylesheet stuff mentioned earlier tonight. FWIW, it's pretty easy to turn then code that ignores #region/#endregion into a specific instance of this more general case anyway. As for syntax, how about -ignoreBlock=3D"START":"END" to keep it inline with the other options. I realise that the command-line syntax is somewhat strange but that's because I never actually thought anyone would use it hehehe. Cheers, Simon On 15/04/2005, at 1:49 AM, Mark Webb wrote: > > Simon, > > I know all about those late nighters... :) > > I mostly agree about the idea of ignoring blocks, and it's potential=20 > for abuse. > > The hacky alternative I considered is for use to inject comment blocks > every so often (under the threshold level) or reorder the code itself=20 > so that they no longer look alike to Simian. This is, IMO much worse=20 > and could affect the readability of the code, or worse introduce bugs=20 > immediately. > > As far as our development process goes, we actually have a bunch of=20 > perl scripts that execute after our nightly build that look for 'bad=20 > things' > in the projects and the code > (for example we keep track of developers TODO comments etc, to make=20 > sure they don't get out of hand) If we added the ability to ignore=20 > blocks with the mechanism I described below, we would also add a=20 > script to check for these regions after every build so that we can=20 > police it's use. > > In otherwords, we trust our developers, especially because we are=20 > watching them very very closely :) > > I think the option would be a useful addition, and if you added it you > might just want to document it as use at your own risk, e.g. "Only=20 > use this option under extreme circumstance. Make sure there is no way=20 > to refactor the code prior to ignoring it." > > Thanks again > Mark > > -----Original Message----- > From: Simon Harris [mailto:[email protected]] > Sent: Thursday, April 14, 2005 11:37 AM > To: [email protected] > Subject: Re: [simian-user] Ignoring blocks of code..? > > Mark, > > It's 1.30am here but I've been awake writing (or at least attempting=20 > 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=20 > feel it is far too easy to abuse. I do however concede that it may=20 > sometimes be necessary to use. > > Along the same lines, when someone told me about the use of=20 > #region/#endregion in C# I was a little take aback as it seemed to be=20 > 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=20 > 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=20 > were for :) > > Anyway, I guess it comes down to how much you trust your developers=20 > not to subvert the process by simply marking up the code. As the=20 > customer, I'm more than happy to do what you think is going to help=20 > 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=20 >> (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=20 >> 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=20 >> passed the appropriate markers. >> >> I am not so keen on the solution of a file containing file and line=20 >> numbers. As you say this is volatile and would need to maintained as=20 >> 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)=20 >> we > >> hope to use it as a policing tool to automatically catch the=20 >> 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=20 >> 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=20 >> you are using C#, this is already possible as #region #endregion=20 >> markers are already supported. >> >> If this doesn't work for you, or you are using some other language,=20 >> another option would be to come up with some other kind of tag to=20 >> indicate that simian should ignore it. >> >> Yet another possible solution would be have a file containing code=20 >> fragments that are consider "legal" duplicates. >> >> And one final, yet somewhat volatile, approach would be to have a=20 >> 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=20 >> generation >> - thought his doesn't sound like it's the case in your situation. Or=20 >> 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=20 >> 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,=20 >>> 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=20 >>> 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 > > > > -- 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