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

Refactor generating histograms based on attributes in CifEnsemble #53

Open
bobleesj opened this issue Oct 27, 2024 · 0 comments
Open

Refactor generating histograms based on attributes in CifEnsemble #53

bobleesj opened this issue Oct 27, 2024 · 0 comments

Comments

@bobleesj
Copy link
Owner

Problem

 # FIXME: refactor this section to maintain DRY principle
    
    def generate_structure_histogram(self, display=False, output_dir=None):
        plot_histogram(
            "structure",
            self.structure_stats,
            self.dir_path,
            display,
            output_dir,
        )

    def generate_formula_histogram(self, display=False, output_dir=None):
        plot_histogram(
            "formula",
            self.formula_stats,
            self.dir_path,
            display,
            output_dir,
        )

    def generate_tag_histogram(self, display=False, output_dir=None):
        plot_histogram(
            "tag",
            self.tag_stats,
            self.dir_path,
            display,
            output_dir,
        )

Although the code was designed to provide a simple function for each task, writing docstrings for each function has become difficult to maintain and update. This redundancy poses a challenge for code maintenance.

Proposed solution

Pass a variable or use an enum to modularize the code, reducing repetition and improving maintainability.

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