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 xccdf_policy_remediate.c #2145

Open
jan-cerny opened this issue Aug 2, 2024 · 0 comments
Open

Refactor xccdf_policy_remediate.c #2145

jan-cerny opened this issue Aug 2, 2024 · 0 comments

Comments

@jan-cerny
Copy link
Member

Description of Problem:

The file src/XCCDF_POLICY/xccdf_policy_remediate.c demonstrates a lot of negative practices:

  • the file has 1892 lines
  • functions are very long and have high cognitive complexity
  • code is duplicated sometimes
  • the logic for results-oriented and profile-oriented fixes is combined together
  • some functions have a lot of parameters

We propose to refactor this file and split it into multiple modules. You can extract functions and extract common code. Also, some code is valuable for the other modules and therefore could be moved to the common directory.

OpenSCAP Version:

Current upstream main branch as of 2024-08-02 as of HEAD 66b58f1.

Operating System & Version:

All

Steps to Reproduce:

  1. Open src/XCCDF_POLICY/xccdf_policy_remediate.c
  2. Examine the code

Actual Results:

See the Description of Problem section.

Expected Results:

The items mentioned in the Description of Problem section are addressed.

Additional Information / Debugging Steps:

no

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

No branches or pull requests

2 participants