Skip to content

Code Smell - Duplicated Code and ExcessiveClassLength  #220

@VictorM-Coder

Description

@VictorM-Coder

Code Smells Issues

During an analysis of the project code with PMD, a series of code smells were identified that can be addressed to enhance the code quality.

Ruleset

For detecting code smells in the project, the team focused on the following code smells as indicated by the professor:

  • Excessive Parameter List
  • Excessive Class Length
  • Excessive Method Length
  • God Class
  • Data Class

XML

<?xml version="1.0"?>
<ruleset name="Custom ruleset"
         xmlns="<http://pmd.sourceforge.net/ruleset/2.0.0>"
         xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"
         xsi:schemaLocation="<http://pmd.sourceforge.net/ruleset/2.0.0>
  <http://pmd.sourceforge.net/ruleset_2_0_0.xsd>">
    <description>
        This ruleset checks my code for bad stuff.
    </description>
    <rule ref="category/java/design.xml/ExcessiveParameterList">
        <properties>
            <property name="minimum" value="4" />
        </properties>
    </rule>
    <rule ref="category/java/design.xml/ExcessiveClassLength">
        <properties>
            <property name="minimum" value="100" />
        </properties>
    </rule>
    <rule ref="category/java/design.xml/ExcessiveMethodLength">
        <properties>
            <property name="minimum" value="20" />
        </properties>
    </rule>
    <rule ref="category/java/design.xml/GodClass" />
    <rule ref="category/java/design.xml/DataClass" />
</ruleset>

Results

Notion

Solution

For this issue, I propose resolving the ExcessiveClassLength and duplicatedCode in some classes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions