Example #1
0
smells = {
    "LongParameterList": {"PAR": PAR},
    "LongMethod": {"MLOC": MLOC},
    "LongScopeChaining": {"DOC": DOC},
    "LongBaseClassList": {"NBC": NBC},
    "LargeClass": {"CLOC": CLOC},
    "LongMessageChain": {"LMC": LMC},
    "ComplexLambdaExpression": {"NOC": NOC, "PAR": LPAR, "NOO": NOO},
    "LongTernaryConditionalExpression": {"NOC": TNOC, "NOL": TNOL},
    "ComplexContainerComprehension": {"NOC": CNOC, "NOFF": NOFF, "NOO": CNOO},
    "MultiplyNestedContainer": {"LEC": LEC, "DNC": DNC, "NCT": NCT},
}

metric = open("metric.txt", mode="w")

subjects = util.subDirectory(directory)
total_lines = 0
total_files = 0
for subjectName in subjects:
    metric.write("projeect:%s " % subjectName)
    sourcedir = directory + "\\" + subjectName
    lines = 0
    files = 0
    for currentFileName in util.walkDirectory(sourcedir):
        try:
            astContent = customast.parse_file(currentFileName)
        except:
            print sourcedir, currentFileName
            continue
        myast = astChecker.MyAst()
        myast.fileName = currentFileName
Example #2
0
myportion = open('result100\\portion.txt', mode='wb+')

smells = {
    'LongParameterList': [PAR],
    'LongMethod': [MLOC],
    'LongScopeChaining': [DOC],
    'LongBaseClassList': [NBC],
    'LargeClass': [CLOC],
    'LongMessageChain': [LMC],
    'LongLambdaFunction': [NOC, LPAR, NOO],
    'LongTernaryConditionalExpression': [TNOC, TNOL],
    'ComplexContainerComprehension': [CNOC, NOFF, CNOO],
    'MultiplyNestedContainer': [LEC, DNC, NCT]
}

subjects = util.subDirectory(subject_dir)

LongParameterList = csv.writer(file('result100\\LongParameterList.csv', 'wb'))
LongParameterList.writerow([
    'subject', 'file', 'lineno', 'PAR', 'experience-based', 'statistics-based',
    'tuning machine'
])
LongMethod = csv.writer(file('result100\\LongMethod.csv', 'wb'))
LongMethod.writerow([
    'subject', 'file', 'lineno', 'MLOC', 'experience-based',
    'statistics-based', 'tuning machine'
])
LongScopeChaining = csv.writer(file('result100\\LongScopeChaining.csv', 'wb'))
LongScopeChaining.writerow([
    'subject', 'file', 'lineno', 'DOC', 'experience-based', 'statistics-based',
    'tuning machine'
Example #3
0
myportion = open('result100\\portion.txt', mode='wb+')

smells = {
    'LongParameterList': [PAR],
    'LongMethod': [MLOC],
    'LongScopeChaining': [DOC],
    'LongBaseClassList': [NBC],
    'LargeClass': [CLOC],
    'LongMessageChain': [LMC],
    'LongLambdaFunction': [NOC, LPAR, NOO],
    'LongTernaryConditionalExpression': [TNOC, TNOL],
    'ComplexContainerComprehension': [CNOC, NOFF, CNOO],
    'MultiplyNestedContainer': [LEC, DNC, NCT]
}

subjects = util.subDirectory(directory)

LongParameterList = csv.writer(file('result100\\LongParameterList.csv', 'wb'))
LongParameterList.writerow([
    'subject', 'file', 'lineno', 'PAR', 'experience-based', 'statistics-based',
    'tuning machine'
])
LongMethod = csv.writer(file('result100\\LongMethod.csv', 'wb'))
LongMethod.writerow([
    'subject', 'file', 'lineno', 'MLOC', 'experience-based',
    'statistics-based', 'tuning machine'
])
LongScopeChaining = csv.writer(file('result100\\LongScopeChaining.csv', 'wb'))
LongScopeChaining.writerow([
    'subject', 'file', 'lineno', 'DOC', 'experience-based', 'statistics-based',
    'tuning machine'