Gitea version (or commit ref): 0b718e0d7b0fe4eb11121700df6c476e0f6b7e6a
The setting module has the following problems and bad code smells:
I'm willing to work on this in the next few weeks if the maintainers are ok with that. I'd like to get feedback on which points to fix and which ones to leave as they are.
@devil418 Please try that.
Please feel free to work on that. Also it is better to submit multiple small PR than single large as that helps to get it merged faster as it is easier to review.
I would start by breaking out all structs
to it's own file (like modules/setting/ssh.go
) with their own Parse
function that gets called.
Kind of like this:
// ssh.go
func (s *SSH) Parse(section *ini.Section) error { ... }
// setting.go
// func NewContext...
ssh := SSH{}
if err := ssh.Parse(); err != nil { ... }
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Like @bkcsoft 's idea, don't close.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Most helpful comment
I would start by breaking out all
structs
to it's own file (likemodules/setting/ssh.go
) with their ownParse
function that gets called.Kind of like this: