guardicore / guardicore/monkey

Update legacy code to adhere to new coding standards

Open
#2,121 0 comments 0 reactions 0 assignees View on GitHub
Code Quality Complexity: Low Impact: High Spike
Dominant language
Python
Stars
7.1k
Forks
830
PR merge metrics
No merged PRs in 30d

Description

# Spike

## Objective
A number of [coding standards](https://guardicore.atlassian.net/wiki/spaces/RES/pages/2800353435/Infection+Monkey+Development+Guidelines) have been adopted by the development team. Newer code adheres to these standards, but older or legacy code may not. Update as much legacy code as possible to adhere to the new coding standards.

## Scope
Timeboxed to 2 weeks.

Focus on the following violations:

- [Type Hints](https://guardicore.atlassian.net/wiki/spaces/RES/pages/2800353435/Infection+Monkey+Development+Guidelines+DRAFT#Type-Hinting)
- Missing type hints (especially in unnit tests)
- Use abstract instead of concrete type hints (e.g. `Iterable` or `Sequence` instead of `List`)
- [Use `Path` objects instead of strings](https://guardicore.atlassian.net/wiki/spaces/RES/pages/2800353435/Infection+Monkey+Development+Guidelines+DRAFT#File-Paths)
- [Replace HTTP magic numbers ](https://guardicore.atlassian.net/wiki/spaces/RES/pages/2800353435/Infection+Monkey+Development+Guidelines+DRAFT#HTTP-return-codes)with [`HTTPStatus` Enums](https://docs.python.org/3/library/http.html#http-status-codes).
- [Docstrings](https://guardicore.atlassian.net/wiki/spaces/RES/pages/2800353435/Infection+Monkey+Development+Guidelines+DRAFT#Docstrings-Format)
- Add docstrings where they're missing
- Update existing docstrings to use the approved format
- Use the [`OperatingSystems`](https://github.com/guardicore/monkey/blob/685c709fda3e7730fe14450bb0d4b09fcb4ba57b/monkey/common/operating_systems.py) `Enum` instead of string comparison
- Use IPv4Address instead of `str`
## Output
A set of PRs that fix as many violations of the code standards as you can find in two weeks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.