Skip to content

Commit

Permalink
upgrade linter and linter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelk committed Jun 12, 2024
1 parent c20120c commit a0f31ee
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
43 changes: 19 additions & 24 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ linters:
- gofmt # checks whether code was gofmt-ed
- goimports # Check import statements are formatted according to the 'goimport' command
- gosimple # Linter for Go source code that specializes in simplifying a code
- gosmopolitan # Report certain i18n/l10n anti-patterns in your Go codebase
- govet # reports suspicious constructs, such as Printf calls with wrong arguments
- grouper # An analyzer to analyze expression groups
- ineffassign # Detects when assignments to existing variables are not used
- intrange # is a linter to find places where for loops could make use of an integer range
- ireturn # Accept Interfaces, Return Concrete Types
- maintidx # measures the maintainability index of each function
- makezero # Finds slice declarations with non-zero initial length
- mirror # reports wrong mirror patterns of bytes/strings usage
Expand Down Expand Up @@ -63,38 +65,31 @@ linters:
- wrapcheck # Checks that errors returned from external packages are wrapped

linters-settings:
stylecheck:
# ST1001: should not use dot imports
checks: [ "all", "-ST1001" ]
cyclop:
max-complexity: 15
godot:
period: false
nestif:
min-complexity: 8
revive:
rules:
- name: dot-imports
disabled: true
- name: exported
disabled: true
- name: var-naming
disabled: true

stylecheck:
# ST1001: should not use dot imports
checks: [ "all", "-ST1001" ]
whitespace:
multi-if: true # Enforces newlines (or comments) after every multi-line if statement
multi-func: true # Enforces newlines (or comments) after every multi-line function signature

issues:
exclude-use-default: false
exclude-rules:
- linters:
- err113
text: "do not define dynamic errors"
- linters:
- revive
text: "dot-imports: should not use dot imports"
- linters:
- revive
text: "var-naming: don't use underscores in Go names"
- linters:
- revive
text: "var-naming: don't use ALL_CAPS in Go names"
- linters:
- revive
text: "exported: comment on exported const"
- linters:
- revive
text: "exported: exported const"
- linters:
- godot
text: "Comment should end in a period"
- linters:
- whitespace
text: "unnecessary leading newline"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOLANGCI_VERSION = v1.59.0
GOLANGCI_VERSION = v1.59.1

help: ## show help, shown by default if no target is specified
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand Down
2 changes: 2 additions & 0 deletions internal/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (dis *Disasm) processJumpDestinations() {
// is inside the second or third byte of an instruction.
if (offsetInfo.IsType(program.CodeOffset) || offsetInfo.IsType(program.CodeAsData)) &&
len(offsetInfo.OpcodeBytes) == 0 {

dis.handleJumpIntoInstruction(address)
}

Expand Down Expand Up @@ -93,6 +94,7 @@ func (dis *Disasm) handleDisambiguousInstructions(address uint16, offsetInfo *of
if instruction.Name != m6502.Nop.Name &&
instruction.Name != m6502.Sbc.Name &&
!dis.noUnofficialInstruction {

return false
}

Expand Down
1 change: 1 addition & 0 deletions internal/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func (dis *Disasm) processData() {
if offsetInfo.IsType(program.CodeOffset) ||
offsetInfo.IsType(program.DataOffset) ||
offsetInfo.IsType(program.FunctionReference) {

continue
}

Expand Down

0 comments on commit a0f31ee

Please sign in to comment.