Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design smells with inheritance related symptoms not calculated #1

Open
bzafiris opened this issue Sep 21, 2018 · 0 comments
Open

Design smells with inheritance related symptoms not calculated #1

bzafiris opened this issue Sep 21, 2018 · 0 comments

Comments

@bzafiris
Copy link

Hello to all, thanks for sharing ptidej tools!

I am trying to use SmellDetectionCaller in order to identify design smells from exclusively from source code files in Java projects.

I have forked SmellDetectionCaller repository and analyze projects through
SmellDetectionHelper.analyseCodeLevelModelFromJavaSourceFilesEclipse()

However, code smells with inherited-related symptoms, e.g. BaseClassKnowsDerivedClass are not detected at all. For instance, the smell should have been detected in class DefaultAxisEditor

I traced SmellDetectionCaller execution and realized that some metrics (e.g. NOC, DIT) are not properly calculated, e.g. when metric calculation is invoked in sad.codesmell.detection.repository.BaseClassKnowsDerivedClass.HasChildrenDetection

public void detect(final IAbstractLevelModel anAbstractLevelModel) {
		final Set classesHasChildren = new HashSet();
		
		final Iterator iter = anAbstractLevelModel.getIteratorOnTopLevelEntities();
		while (iter.hasNext()) {
			final IEntity entity = (IEntity) iter.next();
			if (entity instanceof IClass) {
				final IClass aClass = (IClass) entity;
				final double NOC = ((IUnaryMetric) MetricsRepository.getInstance()
                                                            .getMetric("NOC")).compute(anAbstractLevelModel, aClass);
// ...

For instance NOC for DefaultAxisEditor is 0, while it should have been 2.

Is this a ICodeLevelModel configuration issue related to SmellDetectionHelper.analyseCodeLevelModelFromJavaSourceFilesEclipse or SmellDetectionHelper.analyseCodeLevelModel ?

Thank you in advance
Vassilis Zafeiris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant