Skip to content

General refactor of the cmd package #3328

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

Merged
merged 5 commits into from
Jan 12, 2018
Merged

General refactor of the cmd package #3328

merged 5 commits into from
Jan 12, 2018

Conversation

thehowl
Copy link
Contributor

@thehowl thehowl commented Jan 8, 2018

Mostly some refactoring and removing of spaghetti code - nothing major.

@codecov-io
Copy link

codecov-io commented Jan 8, 2018

Codecov Report

Merging #3328 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3328      +/-   ##
==========================================
+ Coverage   35.05%   35.06%   +<.01%     
==========================================
  Files         280      281       +1     
  Lines       40565    40559       -6     
==========================================
  Hits        14221    14221              
+ Misses      24241    24235       -6     
  Partials     2103     2103
Impacted Files Coverage Δ
cmd/hook.go 0% <ø> (ø) ⬆️
cmd/admin.go 0% <0%> (ø) ⬆️
cmd/web.go 0% <0%> (ø) ⬆️
cmd/cert.go 0% <0%> (ø) ⬆️
cmd/dump.go 0% <0%> (ø) ⬆️
cmd/cmd.go 0% <0%> (ø)
models/repo.go 43.37% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 079273e...5ab4396. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 8, 2018
Copy link
Member

@strk strk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, other than the ctx->c rename

}

var priv interface{}
var err error
switch ctx.String("ecdsa-curve") {
switch c.String("ecdsa-curve") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename of ctx to c just makes the code less readable, please change back

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would generally agree, however the entire package refers to c *cli.Context instead of ctx *cli.Context. Shall I change everything to use ctx?

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 8, 2018
cmd/admin.go Outdated
return fmt.Errorf("Password is not specified")
} else if !c.IsSet("email") {
return fmt.Errorf("Email is not specified")
if err := argsSet(c, "username", "password"); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is breaking change and also (name -> username) and also is missing email check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wooops, looks like I forgot to edit after copypasting - nice catch! (good thing there are code reviews 😌)

@lafriks lafriks added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Jan 8, 2018
@lafriks lafriks added this to the 1.4.0 milestone Jan 8, 2018
@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 8, 2018
Copy link
Member

@bkcsoft bkcsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise Good

cmd/admin.go Outdated

// argsSet checks that all the required arguments are set. args is a list of
// arguments that must be set in the passed Context.
func argsSet(c *cli.Context, args ...string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move these two functions into cmd/common.go or similar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@lafriks
Copy link
Member

lafriks commented Jan 10, 2018

@bkcsoft needs your approval

@bkcsoft bkcsoft merged commit 2b52f77 into go-gitea:master Jan 12, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants