OWASP / OWASP/Nest

Inconsistent behavior of from_github() across backend models

Open
#3,320 2 comments 0 reactions 0 assignees View on GitHub
enhancement question
Dominant language
Python
Stars
451
Forks
707
Avg merge
22h 59m
Merged PRs (30d)
91

Description

## Summary

Several backend models define a `from_github()` method, but the behavior of this method differs across files even though the name is the same.

## Examples

Some examples of how the method is currently used:

- `common.py`
`from_github(self, data)`

- `issue.py`
`from_github(self, gh_issue, *, author=None, milestone=None, repository=None)`

- `repository.py`
Uses a more complex GitHub mapping flow

- `chapter.py` / `project.py`
`from_github(self, repository)`

There are multiple such implementations across the codebase, each accepting different inputs and handling different responsibilities.

## Why this is confusing

For someone trying to understand or work on this area of the code:
- The method name suggests similar behavior, but the actual usage varies a lot
- There is no clear expectation of what `from_github()` should generally do
- Tracing GitHub data flow requires checking many different files

## Open question

Is this difference in `from_github()` behavior intentional?

If yes, would adding a short explanation or documentation about how this method is expected to be used in different models help future contributors?

This issue is mainly about clarity and understanding, not proposing a refactor.

## Are you going to work on fixing this?

- [x] Yes
- [ ] No

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.