1
0
mirror of https://github.com/mum4k/termdash.git synced 2025-04-25 13:48:50 +08:00

Merge pull request #134 from mum4k/lint

Adding golint to Travis.
This commit is contained in:
Jakub Sobon 2019-02-18 02:22:40 -05:00 committed by GitHub
commit 857ff48e32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 11 deletions

View File

@ -6,10 +6,12 @@ go:
- stable
script:
- go get -t ./...
- go get -u golang.org/x/lint/golint
- go test ./...
- go test -race ./...
- go vet ./...
- diff -u <(echo -n) <(gofmt -d -s .)
- diff -u <(echo -n) <(./scripts/autogen_licences.sh .)
- diff -u <(echo -n) <(golint ./...)
after_success:
- ./scripts/coverage.sh

View File

@ -40,6 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The LineChart widget now correctly determines the Y axis scale when multiple
series are provided.
- Lint issues in the codebase, and updated Travis configuration so that golint
is executed on every run.
## [0.6.1] - 12-Feb-2019

View File

@ -86,21 +86,37 @@ var segmentNames = map[Segment]string{
const (
segmentUnknown Segment = iota
// A1 is a segment, see the diagram above.
A1
// A2 is a segment, see the diagram above.
A2
// B is a segment, see the diagram above.
B
// C is a segment, see the diagram above.
C
// D1 is a segment, see the diagram above.
D1
// D2 is a segment, see the diagram above.
D2
// E is a segment, see the diagram above.
E
// F is a segment, see the diagram above.
F
// G1 is a segment, see the diagram above.
G1
// G2 is a segment, see the diagram above.
G2
// H is a segment, see the diagram above.
H
// J is a segment, see the diagram above.
J
// K is a segment, see the diagram above.
K
// L is a segment, see the diagram above.
L
// M is a segment, see the diagram above.
M
// N is a segment, see the diagram above.
N
segmentMax // Used for validation.
@ -340,7 +356,8 @@ func (d *Display) ToggleSegment(s Segment) error {
return nil
}
// Character sets all the segments that are needed to display the provided character.
// SetCharacter sets all the segments that are needed to display the provided
// character.
// The display only supports a subset of ASCII characters, use SupportsChars()
// or Sanitize() to ensure the provided character is supported.
// Doesn't clear the display of segments set previously.
@ -435,7 +452,7 @@ func (d *Display) Draw(cvs *canvas.Canvas, opts ...Option) error {
return bc.CopyTo(cvs)
}
// Required, when given an area of cells, returns either an area of the same
// Required when given an area of cells, returns either an area of the same
// size or a smaller area that is required to draw one display.
// Returns a smaller area when the provided area didn't have the required
// aspect ratio.

View File

@ -112,18 +112,17 @@ func wantRelease(fsm *FSM, m *terminalapi.Mouse) (bool, State, stateFn) {
// Remain in the same state, since termbox reports move of mouse with
// button held down as a series of clicks, one per position.
return false, Down, wantRelease
} else {
return false, Up, wantPress
}
return false, Up, wantPress
case mouse.ButtonRelease:
if m.Position.In(fsm.area) {
// Seen both press and release, report a click.
return true, Up, wantPress
} else {
// Release the button even if the release event happened outside of the area.
return false, Up, wantPress
}
// Release the button even if the release event happened outside of the area.
return false, Up, wantPress
default:
return false, Up, wantPress
}

View File

@ -64,14 +64,14 @@ func startEndAngles(current, total, startAngle, direction int) (start, end int)
func midAndRadius(ar image.Rectangle) (image.Point, int) {
mid := image.Point{ar.Dx() / 2, ar.Dy() / 2}
if mid.X%2 != 0 {
mid.X -= 1
mid.X--
}
switch mid.Y % 4 {
case 0:
mid.Y += 1
mid.Y++
case 1:
case 2:
mid.Y -= 1
mid.Y--
case 3:
mid.Y -= 2

View File

@ -45,7 +45,7 @@ const (
// flows horizontally.
LabelOrientationHorizontal LabelOrientation = iota
// LabelOrientationvertical is an orientation where text flows vertically.
// LabelOrientationVertical is an orientation where text flows vertically.
LabelOrientationVertical
)