Conversation
|
This PR looks good to me. If possible, can you resolve the version issue with the |
|
Another issue: When running Do we need a higher version than Go 1.22? The last |
c0a09c8 to
258e964
Compare
b026f34 to
281fe9f
Compare
|
@spenpal going to |
klesh
left a comment
There was a problem hiding this comment.
LGTM. Feel free to merge it when ready.
|
Sorry for the late reply. @klesh Is If it is, @petkostas we might need to update to Go 1.24 or downgrade |
- Updates backend to GO version 1.22 - Updates devops to GO version 1.22 - Updates mockery to version 2.43.0
- Update to v1.24
2295488 to
3dd2fa4
Compare
- Bump golangci-lint for GO v1.24
3dd2fa4 to
a9ec769
Compare
|
@spenpal Updated to |
|
@petkostas This PR looks good to me now. Thanks for your hard work! EDIT: I lied. I am unable to run EDIT 2: I asked AI to upgrade the Here is the upgraded # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
version: "2"
# https://golangci-lint.run/usage/linters/
linters:
# Start with standard linters (enabled by default)
default: standard
enable:
# Additional recommended linters for production code
- bodyclose # checks whether HTTP response body is closed
- copyloopvar # detects loop variable issues (Go 1.22+)
- errcheck # checks for unchecked errors
- errorlint # finds code that causes problems with Go 1.13+ error wrapping
- gocritic # provides diagnostics that check for bugs, performance and style
- govet # reports suspicious constructs
- ineffassign # detects unused assignments
- makezero # finds slice declarations with non-zero initial length
- misspell # finds commonly misspelled English words
- nolintlint # reports ill-formed or insufficient nolint directives
- revive # fast, configurable, extensible, flexible linter
- staticcheck # set of rules from staticcheck (includes gosimple, stylecheck)
- unconvert # removes unnecessary type conversions
- unparam # reports unused function parameters
- unused # checks for unused constants, variables, functions and types
- goheader # checks file headers match template
- importas # enforces consistent import aliases
disable:
# Disable overly strict or noisy linters
- exhaustive # too strict for most codebases
- funlen # arbitrary function length limits
- gochecknoglobals # globals are sometimes necessary
- gocognit # cognitive complexity can be subjective
- gocyclo # cyclomatic complexity can be subjective
- godox # don't want to fail on TODO/FIXME comments
- mnd # magic number detection too strict (was gomnd)
- lll # line length better handled by formatters
- nlreturn # overly opinionated about blank lines
- testpackage # not always beneficial to use _test package
- wsl # overly opinionated whitespace rules
formatters:
enable:
- gofmt # Format code with gofmt
- goimports # Organize imports
linters-settings:
goheader:
template-path: .golangci-goheader.template
goimports:
# Put local imports after 3rd-party packages
local-prefixes: github.com/apache/incubator-devlake
staticcheck:
# Enable all checks
checks: ["all"]
revive:
# Maximum number of open files at the same time
max-open-files: 2048
# Sets the default severity
severity: error
rules:
# Enable useful rules
- name: atomic
- name: blank-imports
- name: bool-literal-in-expr
- name: call-to-gc
- name: confusing-naming
- name: confusing-results
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: deep-exit
- name: defer
arguments: [["call-chain"]]
- name: dot-imports
- name: duplicated-imports
- name: empty-block
- name: empty-lines
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: get-return
- name: identical-branches
- name: import-shadowing
- name: modifies-parameter
- name: modifies-value-receiver
- name: optimize-operands-order
- name: package-comments
- name: range
- name: range-val-in-closure
- name: range-val-address
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: string-format
arguments:
- - "core.WriteError[1].Message"
- "/^([^A-Z]|$)/"
- must not start with a capital letter
- - "fmt.Errorf[0]"
- '/(^|[^\.!?])$/'
- must not end in punctuation
- - panic
- '/^[^\n]*$/'
- must not contain line breaks
- name: struct-tag
- name: superfluous-else
- name: time-equal
- name: time-naming
- name: var-declaration
- name: unconditional-recursion
- name: unexported-return
- name: unhandled-error
arguments:
- "fmt.Printf"
- "fmt.Println"
- "fmt.Fprintln"
- "res.Body.Close"
- "body.Close"
- name: unnecessary-stmt
- name: unreachable-code
- name: useless-break
- name: waitgroup-by-value
# Disable overly strict rules
- name: bare-return
disabled: true
- name: exported
disabled: true
arguments:
- "disableStutteringCheck"
- name: var-naming
disabled: true
arguments:
- [] # AllowList
- [] # DenyList
gocritic:
# Enable multiple check groups
enabled-tags:
- diagnostic
- style
- performance
- opinionated
disabled-checks:
- whyNoLint # we use nolintlint for this
- unnamedResult # conflicts with some patterns
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`
check-type-assertions: true
# Report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`
check-blank: false
# List of functions to exclude from checking
exclude-functions:
- (io.Closer).Close
- (*database/sql.Rows).Close
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors
errorf: true
# Check for plain error comparisons
comparison: true
nolintlint:
# Enable to require an explanation of nonzero length after each nolint directive
require-explanation: true
# Enable to require nolint directives to mention the specific linter being suppressed
require-specific: true
importas:
# Enforce import aliases for consistency
no-unaliased: false
# Do not allow non-required aliases
no-extra-aliases: false
issues:
# Maximum issues count per one linter. Set to 0 to disable.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable.
max-same-issues: 0
# Include issues that were excluded by default exclusion patterns
include:
- EXC0012 # revive: comment on exported items
- EXC0014 # revive: comment on exported items
exclude-rules:
# Exclude some linters from running on specific paths
- path: models/|api/|migration/|errors/|logger/
linters:
- revive
- path: plugins/([^hc].*|.[^eo].*|..[^lr].*|...[^pe].*|....[^e].*|.....[^r].*)
linters:
- revive
# Exclude test files from some checks
- path: _test\.go
linters:
- errcheck
- gocritic
- revive
# Exclude generated files
- path: ".*\\.pb\\.go$"
linters:
- all
- path: ".*\\.gen\\.go$"
linters:
- all
# Options for analysis running
run:
# The default concurrency value is the number of available CPUs
concurrency: 4
# Timeout for analysis
timeout: 5m
# Exit code when at least one issue was found
issues-exit-code: 2
# Include test files or not
tests: false
# List of build tags
build-tags: []
# Allow multiple parallel golangci-lint instances running
allow-parallel-runners: true
# Allow multiple golangci-lint instances running, but serialize writes to any files
allow-serial-runners: false
# Use go modules for dependency resolution
modules-download-mode: readonly
# Output configuration
output:
# Format: colored-line-number, line-number, json, tab, checkstyle, code-climate, html, junit-xml, github-actions
formats:
colored-line-number:
path: stdout
# Print lines of code with issue
print-issued-lines: true
# Print linter name in the end of issue text
print-linter-name: true
# Make issues output unique by line
uniq-by-line: true
# Sort results by: filepath, line and column
sort-results: true
# Show statistics per linter
show-stats: true> make lint
...
...
10711 issues:
* bodyclose: 74
* copyloopvar: 1
* errcheck: 252
* errorlint: 21
* gocritic: 205
* goimports: 353
* govet: 2
* misspell: 13
* nolintlint: 33
* revive: 9623
* staticcheck: 96
* unconvert: 4
* unparam: 34 |
|
Thanks @spenpal I will try to look into that. |
Summary
1.23Does this close any open issues?
Closes #8584