TSmells

From FetchWiki

Jump to: navigation, search

This page serves as a log for anything related to my [Manuel Breugelmans's] Bachelor's project at the University of Antwerp, supervised by Bart Van Rompaey. A short description (dutch) can be found here and here

Contents

[edit] Initial Release [Feb 21th]

Not as polished as I would have wanted but functional for sure, there's definitly some issues which need attention. For now tsmells includes a modified fetch [snavtofamix + cdif2rsf], in the future this relation might be reversed. Normally I'd have released two days ago [as planned] but was obstructed, not that it matters that much.

A tarball is available for download on my googlecode account.

[edit] Formal Specification [Feb 17th]

With the aid of a set based formalism for xUnit code I've written a formal specification. It's a 3 page document with a concise informal description plus mathematical definition of each test smell. While uncommon to write this at the end rather then start I still found it useful. It surely has a documentational value but also resulted in a major sematical fix! look

[edit] Duplicated Code [Feb 13th]

Detecting clones in source code is non-trivial, but with the information in an RSF model it gets a whole lot easier. Since crocopat's functional language is not fit for this I've also used some python. Six 6 steps are used:

  • Generate rsf model with Fetch
  • Expand accesses & invocations relations with method names, sourcefile and line numbers
  • dump these to file
  • read with python and sort on methods and line numbers
  • partition all methods' invocations/accesses
  • compare these partitions between methods

Obviously this aproach lacks for a full blown clone finder. However some test runs on Anastacias and Teamspirits test suite have shown that it's more then adequate. The python implementation can be dowloaded from the tsmells googlecode svn, src/DuplicatedCode.py.

[edit] Adding macros [Feb 3th]

To get features not present in RML I've decided to add macro power. This allows some modularity. First idea was to use the C preprocessor, however a big bad disclaimer in the cpp man page discourage using it for non-c(++) code. So I'll go with m4 for now. M4 has all the functionality as well, but with a less familiar syntax.

The C preprocessor is intended to be used only with C, C++, and
Objective-C source code.  In the past, it has been abused as a general
text processor.  It will choke on input which does not obey C's lexical
rules.  For example, apostrophes will be interpreted as the beginning
of character constants, and cause errors.  Also, you cannot rely on it
preserving characteristics of the input which are not significant to
C-family languages.  If a Makefile is preprocessed, all the hard tabs
will be removed, and the Makefile will not work.

[edit] Project plan continued [Feb 1th]

An initial planning for the second term can be viewed here.

Basicly:

  • Wrap up of TSmells-stat part; release at 20/02
  • Start of inception phase for the userinterface part
  • Required functionality formally agreed on 29/02
  • Detailed planning for the rest of the project

[edit] First term exams over [Jan 31th]

New year holidays and exams caused prolonged inactivity (as planned). I'll be spending time again on TSmells from now on. For starters this page was updated with some retrospective entries.

[edit] Meeting: issues + part two [Dec 19th]

A short meeting with Bart Van Rompaey was held to get some issues discussed & a general feel for requirements of the user interface part. Review the report.

[edit] General meeting [Dec 11th]

After some postponing a second project meeting with the students & supervisors was held. The general impression about the progress of TSmells seemed positive. Slides and a little screencast showing webtest can be reviewed here and here.

[edit] Repository & Ohloh [Dec 8th]

Having an external version control is usefull for sure. I decided to go with one of google's free subversion accounts, the url is tsmells.googlecode.com. In addition an entry was created on ohloh. The calculated metrics are totally off though. Due to them not recognizing RML (big surprise) and the reasonable amount of test/auxiliary data, which is code on its own.

[edit] CLI & graphical test runner [Nov 23th]

To run my input-output pieces tests, webtest was born. Using CherryPy & Cheetah, plus a couple of the outputtest functionality. Goal was to have a runner up with the least amount of effort, hence its rather hacky. Trying to use this code for some other purpose will probably cost you more then starting from scratch.



[edit] Some resources [Nov 13th]

Two articles about junit antipatterns

[edit] Mystery Guest [Nov 12th]

The past few weeks I have encountered some issues with the RSF creation, especially regarding the 'Invokes' relation. 2 which would prove usefull if fixed:

A couple of pieces tests describing these problems have been commited in the snavtofamix repository.

A smell detection script for Mystery Guest together with some tests documenting the scenarios it catches can be found here. Of interest is the Smells/MysteryGuest/src/MysteryGuest.rml file. The outputtest python scripts have been adapted somewhat and are included in there. Trying to run this will require some messing around, especially the scripts presume Crocopat, java2rsf.sh and cpp2rsf.sh to be on your $PATH.

[edit] Crocotests [Oct 21th]

RML contains no testing functionality so I've written a modest output-test framework in python. Testing smelldetection will go like this:

import outputtest, unittest

class JavaMysteryGuestTest(outputtest.OutputTest):
    def testFileAccess(self):
        expected = "expected_mystery_guest_output_here"
        self.assertOutputEqual("crocopat MysteryGuest.rml < toTest.rsf", expected)

if __name__ == '__main__':
   unittest.main()

Since the code builds on PyUnit its fairly compact (70 lines) but still powerfull enough.

Source with some unittests can be downloaded here

[edit] Background [Oct 14th]

A compilation of the various reference materials [also milestone II] is located here

[edit] Planning and Requirements [Oct 13th]

Last wednesday 10/10, a first interview to capture requirements was held. See report.

It was agreed to split the project in 2 major phases. First the raw smell detection refered to as TSmells-Stats, followed by the actual user interface referred to as Tsmell-Iface.

The full planning for the first phase, with PERT chart & risk analysis is available in html, pdf or ods.

Personal tools