sstrickx / yahoofinance-api

Java Client API for Yahoo Finance
MIT License
504 stars 221 forks source link

Code Smell - God Classes #214

Open VictorM-Coder opened 10 months ago

VictorM-Coder commented 10 months ago

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:

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.