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

Add golangci metalinter #26

Merged
merged 9 commits into from
May 28, 2018
Merged

Add golangci metalinter #26

merged 9 commits into from
May 28, 2018

Conversation

mewmew
Copy link
Member

@mewmew mewmew commented May 27, 2018

  • Update Travis to use golangci-lint.
  • Fix reported lint issues and clean up and refactor some code.

Fixes #25.

mewmew added 8 commits May 26, 2018 11:30
frame/utf8.go:11:2: `t1` is unused (deadcode)
	t1 = 0x00 // 0000 0000

Updates #25.
enc.go:178:35: unnecessary conversion (unconvert)
	if err := enc.bw.WriteBits(uint64(si.NSamples), 36); err != nil {
	                                 ^
enc.go:543:34: unnecessary conversion (unconvert)
	if _, err := enc.bw.Write([]byte(pic.Data)); err != nil {
	                                ^

frame/frame.go:161:17: Error return value of `md5sum.Write` is not checked (errcheck)
				md5sum.Write(buf[:1])
				            ^
frame/frame.go:165:17: Error return value of `md5sum.Write` is not checked (errcheck)
				md5sum.Write(buf[:2])
				            ^
frame/frame.go:170:17: Error return value of `md5sum.Write` is not checked (errcheck)
				md5sum.Write(buf[:])
				            ^

Updates #25.
Fix issue reported by megacheck:

cmd/go-metaflac/metaflac.go:82:2: unnecessary nil check around range (megacheck)
	if blockNums != nil {
	^

Updates #25.
…m.Write and md5 import

golangci-lint run --enable-all -e "(Error return value of .md5sum\.Write. is not checked)"
We want to keep the structures identical to spec
as they are used for parsing.
Fixes lint issue reported by gocyclo:

frame/frame.go:212:1: cyclomatic complexity 52 of func `(*Frame).parseHeader` is high (> 30) (gocyclo)
func (frame *Frame) parseHeader() error {
^

Updates #25.
Fixes lint issue reported by gocyclo:

meta/cuesheet.go:30:1: cyclomatic complexity 37 of func `(*Block).parseCueSheet` is high (> 30) (gocyclo)
func (block *Block) parseCueSheet() error {
^

Fixes #25.
@coveralls
Copy link

coveralls commented May 27, 2018

Coverage Status

Coverage increased (+0.8%) to 64.116% when pulling 8e870c4 on golangci into fcab6ed on master.

@karlek karlek merged commit fa00a54 into master May 28, 2018
@karlek
Copy link
Contributor

karlek commented May 28, 2018

The code becomes much more readable. LGTM

@mewmew mewmew deleted the golangci branch May 28, 2018 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants