ComplianceAsCode / content

Security automation content in SCAP, Bash, Ansible, and other formats
https://complianceascode.readthedocs.io/en/latest/
Other
2.22k stars 698 forks source link

Documentation for ssg library #12606

Closed marcusburghardt closed 3 days ago

marcusburghardt commented 1 week ago

Description:

This PR consists of several commits, one commit for each file in ssg folder (without considering sub-folders), where Docstrings are included in functions and classes. I have opted by the Google format since it has a good compatibility with tools and a good readability.

During this work, I reviewed about 365 functions and 40 classes to make sure the Docstring was aligned to the code. In most of the cases complete Docstring was created, in some cases it was just formatted to be consistent with Google format and in other cases I had to update the content.

In some really simple functions I opted to not include a Docstring because the function was self-explained. It was also included Docstrings for internal functions when I considered them important to better understand when and how they were used.

I tried to keep the Docstrings as generic as possible but also inclined to the context of the project since some functions without context would be difficult to understand.

Finally, I skipped all files/scripts used to build the content, which start with build_*.py and the content_diff.py file.

Rationale:

Once the PR is merged, the Docstrings should also improve our documentation in https://complianceascode.readthedocs.io/en/latest/modules/ssg.html, making it easier for the community to consume and contribute to the ssg library.

Review Hints:

Be prepared for a time-consuming task, but I would say that it was great to improve my understanding about the SSG library. The work also gave me many insights about what could be improved, but this is definitely out of scope here.

No code was changed, so no risk is expected from this PR. In some isolated cases I removed comments from functions because they were incorporated in Docstrings, so duplication was not necessary. But in general ensured no code changes.

github-actions[bot] commented 1 week ago

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment Open in Gitpod

Oracle Linux 8 Environment Open in Gitpod

vojtapolasek commented 6 days ago

One more thing which could but does not need to be part of this PR is updating of style guide adding a bullet point that new functions should be documented.

marcusburghardt commented 6 days ago

One more thing which could but does not need to be part of this PR is updating of style guide adding a bullet point that new functions should be documented.

I plan to create a separate PR for this.

codeclimate[bot] commented 6 days ago

Code Climate has analyzed commit 2c71e1e4 and detected 92 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 4
Duplication 10
Style 78

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 60.9% (0.0% change).

View more on Code Climate.

marcusburghardt commented 4 days ago

/packit test

vojtapolasek commented 3 days ago

/packit retest-failed