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

Code Smell - God Classes #214

Open
VictorM-Coder opened this issue Nov 22, 2023 · 0 comments
Open

Code Smell - God Classes #214

VictorM-Coder opened this issue Nov 22, 2023 · 0 comments

Comments

@VictorM-Coder
Copy link

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 GodClasses in Utils and Stock classes.

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