Skip to content
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

Fix wrong hint when status checking is running on pull request view #9886

Merged
merged 7 commits into from
Jan 22, 2020

Conversation

lunny
Copy link
Member

@lunny lunny commented Jan 20, 2020

When all required status check were running, it will display some required status check failed.

This PR will fix that. There are more states to check about the status check.

Fix #9394

@lunny lunny added this to the 1.12.0 milestone Jan 20, 2020
@lunny lunny mentioned this pull request Jan 20, 2020
routers/repo/pull.go Outdated Show resolved Hide resolved
)

// IsWorseThan returns true if this State is worse than the given State
func (css CommitStatusState) IsWorseThan(css2 CommitStatusState) bool {
Copy link
Member

Choose a reason for hiding this comment

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

IsWorseOrSameAs() maybe?

Copy link
Member Author

@lunny lunny Jan 20, 2020

Choose a reason for hiding this comment

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

Or NoBetterThan ? :)

Copy link
Member

Choose a reason for hiding this comment

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

Or NoBetterThan ? :)

NoBetterThan sounds good too. My problem was that the old name implied < but the function acts like <=.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... It looks like there is a genuine total order here. An alternative might be:

type CommitStatus int
const (
  CommitStatusPending CommitStatus = 0
  ...
)

func (c CommitStatus) String() {
   switch c {
   case CommitStatusPending:
       return "pending"
...
   }
}

Then just use normal operators for the state.

Copy link
Member Author

Choose a reason for hiding this comment

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

@zeripath I will left this other PRs to keep this PR clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

@guillep2k done.

modules/structs/commit_status.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 20, 2020
@lunny lunny force-pushed the lunny/fix_pr_status_check branch 4 times, most recently from 0f4fb39 to 4312976 Compare January 21, 2020 05:19
@codecov-io
Copy link

codecov-io commented Jan 21, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@cca13ae). Click here to learn what that means.
The diff coverage is 23.43%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #9886   +/-   ##
=========================================
  Coverage          ?   42.28%           
=========================================
  Files             ?      608           
  Lines             ?    79392           
  Branches          ?        0           
=========================================
  Hits              ?    33570           
  Misses            ?    41680           
  Partials          ?     4142
Impacted Files Coverage Δ
services/pull/commit_status.go 5.19% <0%> (ø)
routers/repo/pull.go 28.67% <0%> (ø)
models/commit_status.go 64.13% <100%> (ø)
routers/api/v1/repo/status.go 44.57% <50%> (ø)
modules/structs/commit_status.go 54.54% <54.54%> (ø)

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 cca13ae...0323362. Read the comment docs.

routers/api/v1/repo/status.go Outdated Show resolved Hide resolved
routers/api/v1/repo/status.go Outdated Show resolved Hide resolved
Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

dont mix api&struct import ...

@GiteaBot GiteaBot 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 22, 2020
@GiteaBot GiteaBot 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 22, 2020
@lunny lunny merged commit 81daf26 into go-gitea:master Jan 22, 2020
@lunny lunny deleted the lunny/fix_pr_status_check branch January 22, 2020 03:46
lunny added a commit to lunny/gitea that referenced this pull request Jan 22, 2020
…o-gitea#9886)

* Fix wrong hint when status checking is running on pull request view

* fix lint

* fix test

* fix test

* fix wrong tmpl

* fix import

* rename function name
lafriks pushed a commit that referenced this pull request Jan 22, 2020
…9886) (#9928)

* Fix wrong hint when status checking is running on pull request view

* fix lint

* fix test

* fix test

* fix wrong tmpl

* fix import

* rename function name
@6543
Copy link
Member

6543 commented Jan 22, 2020

lable: backport/done

@lunny lunny added the backport/done All backports for this PR have been created label Jan 22, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Status check on pull view is not correct.
6 participants