From fed2d81c440edfccd160ce09f93d60433d47af5d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 28 Mar 2025 22:22:21 +0000 Subject: [PATCH] Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- .golangci.yml | 269 +++++++++--------- Makefile | 2 +- build/lint-locale-usage/lint-locale-usage.go | 2 +- .../lint-locale-usage_test.go | 4 +- build/lint-locale/lint-locale_test.go | 40 +-- cmd/admin_auth_ldap_test.go | 12 +- cmd/doctor.go | 7 +- cmd/hook.go | 5 +- cmd/main.go | 6 +- cmd/main_test.go | 10 +- cmd/migrate_storage_test.go | 4 +- cmd/serv.go | 7 +- models/actions/forgejo_test.go | 84 +++--- models/actions/runner.go | 5 +- models/actions/runner_token_test.go | 6 +- models/activities/action_test.go | 6 +- models/activities/notification_list.go | 2 +- models/activities/notification_test.go | 12 +- models/activities/repo_activity_test.go | 8 +- models/asymkey/gpg_key_test.go | 2 +- models/asymkey/ssh_key_test.go | 10 +- models/auth/oauth2_test.go | 4 +- models/auth/session_test.go | 6 +- models/db/engine_test.go | 2 +- models/db/list_test.go | 2 +- models/dbfs/dbfs_test.go | 24 +- models/forgejo/semver/semver_test.go | 6 +- models/forgejo_migrations/v1_22/v8_test.go | 2 +- models/git/branch_test.go | 2 +- models/git/lfs_test.go | 10 +- models/git/protected_branch_list_test.go | 2 +- models/git/protected_branch_test.go | 2 +- models/issues/action_aggregator.go | 11 +- models/issues/comment_test.go | 12 +- models/issues/issue.go | 4 +- models/issues/issue_list_test.go | 18 +- models/issues/issue_project_test.go | 36 +-- models/issues/issue_test.go | 30 +- models/issues/label_test.go | 28 +- models/issues/milestone_test.go | 6 +- models/issues/pull_test.go | 4 +- models/issues/stopwatch_test.go | 2 +- models/migrations/migrations_test.go | 6 +- models/migrations/v1_15/v181_test.go | 4 +- models/migrations/v1_16/v189_test.go | 4 +- models/migrations/v1_16/v193_test.go | 4 +- models/migrations/v1_16/v210_test.go | 2 +- models/migrations/v1_19/v233_test.go | 2 +- models/migrations/v1_20/v259_test.go | 2 +- models/migrations/v1_22/v286_test.go | 4 +- models/org_team_test.go | 2 +- models/org_test.go | 2 +- models/organization/org.go | 4 +- models/organization/org_list_test.go | 2 +- models/organization/org_test.go | 22 +- models/organization/org_user_test.go | 2 +- models/organization/team_test.go | 6 +- models/perm/access/access.go | 2 +- models/project/column_test.go | 6 +- models/project/project_test.go | 4 +- models/repo/collaboration_test.go | 10 +- models/repo/pushmirror_test.go | 2 +- models/repo/repo.go | 11 +- models/repo/repo_list_test.go | 2 +- models/repo/repo_unit_test.go | 10 +- models/repo/topic_test.go | 2 +- models/repo/watch_test.go | 2 +- models/repo_test.go | 4 +- models/repo_transfer_test.go | 2 +- models/system/setting_test.go | 12 +- models/unittest/consistency.go | 10 +- models/unittest/mock_http.go | 2 +- models/user/search.go | 5 +- models/user/setting_test.go | 8 +- models/user/user.go | 2 +- models/user/user_test.go | 20 +- models/webhook/hooktask.go | 5 +- models/webhook/webhook.go | 46 +-- modules/assetfs/layered_test.go | 18 +- modules/avatar/avatar_test.go | 4 +- modules/avatar/hash_test.go | 8 +- modules/base/tool_test.go | 4 +- modules/cache/cache_test.go | 6 +- modules/cache/context_test.go | 4 +- modules/charset/ambiguous_gen_test.go | 2 +- modules/charset/charset_test.go | 2 +- modules/charset/escape_stream.go | 20 +- modules/charset/escape_test.go | 2 +- modules/container/set_test.go | 2 +- modules/csv/csv_test.go | 14 +- modules/git/command_test.go | 4 +- modules/git/commit.go | 2 +- modules/git/commit_sha256_test.go | 8 +- modules/git/commit_test.go | 16 +- modules/git/diff_test.go | 8 +- modules/git/error.go | 5 +- modules/git/log_name_status.go | 23 +- modules/git/parse_test.go | 4 +- modules/git/pushoptions/pushoptions_test.go | 6 +- modules/git/repo_attribute_test.go | 16 +- modules/git/repo_base_test.go | 8 +- modules/git/repo_branch_test.go | 12 +- modules/git/repo_commit_test.go | 8 +- modules/git/repo_language_stats.go | 2 +- modules/git/repo_language_stats_test.go | 4 +- modules/git/repo_ref.go | 7 +- modules/git/repo_stats_test.go | 2 +- modules/git/repo_tag_test.go | 102 +++---- modules/git/repo_tree.go | 4 +- modules/git/signature_test.go | 2 +- modules/git/submodule_test.go | 2 +- modules/git/tag_test.go | 20 +- modules/git/tree_test.go | 4 +- modules/git/url/url_test.go | 4 +- .../releasereopen/releasereopen_test.go | 12 +- modules/graceful/server.go | 2 +- modules/graceful/server_hooks.go | 5 +- modules/highlight/highlight_test.go | 4 +- .../code/elasticsearch/elasticsearch_test.go | 4 +- modules/indexer/code/indexer_test.go | 8 +- .../indexer/internal/bleve/metadata_test.go | 2 +- .../indexer/issues/internal/tests/tests.go | 20 +- .../issues/meilisearch/meilisearch_test.go | 12 +- modules/issue/template/template.go | 2 +- modules/issue/template/template_test.go | 2 +- modules/keying/keying_test.go | 24 +- modules/lfs/content_store.go | 4 +- modules/log/event_writer_base.go | 2 +- modules/log/flags_test.go | 14 +- modules/log/groutinelabel_test.go | 6 +- modules/log/logger_test.go | 6 +- modules/markup/common/footnote.go | 2 +- modules/markup/common/linkify.go | 5 +- modules/markup/console/console_test.go | 2 +- modules/markup/csv/csv_test.go | 2 +- modules/markup/html.go | 2 +- modules/markup/markdown/goldmark.go | 4 +- modules/markup/markdown/math/inline_parser.go | 8 +- modules/markup/markdown/meta_test.go | 4 +- modules/markup/markdown/transform_codespan.go | 2 +- modules/markup/mdstripper/mdstripper.go | 7 +- modules/markup/mdstripper/mdstripper_test.go | 4 +- modules/optional/serialization_test.go | 12 +- modules/packages/cargo/parser_test.go | 4 +- modules/process/manager_stacktraces_test.go | 48 ++-- modules/queue/base_test.go | 20 +- modules/queue/manager_test.go | 4 +- modules/queue/workerqueue_test.go | 32 +-- modules/references/references.go | 7 +- modules/references/references_test.go | 10 +- modules/regexplru/regexplru_test.go | 4 +- modules/repository/branch_test.go | 2 +- modules/repository/commits_test.go | 24 +- modules/repository/create.go | 7 +- modules/repository/create_test.go | 2 +- modules/repository/init_test.go | 6 +- modules/repository/license.go | 5 +- modules/repository/repo_test.go | 4 +- modules/setting/actions_test.go | 26 +- modules/setting/admin_test.go | 6 +- modules/setting/attachment_test.go | 22 +- modules/setting/config_env_test.go | 18 +- modules/setting/config_provider_test.go | 8 +- modules/setting/cron_test.go | 2 +- modules/setting/forgejo_storage_test.go | 4 +- modules/setting/git_test.go | 14 +- modules/setting/incoming_email_test.go | 10 +- modules/setting/lfs_test.go | 22 +- modules/setting/mailer_test.go | 8 +- modules/setting/oauth2_test.go | 2 +- modules/setting/packages_test.go | 24 +- modules/setting/repository_archive_test.go | 12 +- modules/setting/server_test.go | 2 +- modules/setting/service.go | 2 +- modules/setting/storage.go | 4 +- modules/setting/storage_test.go | 74 ++--- modules/storage/local_test.go | 2 +- modules/storage/minio.go | 4 +- modules/storage/minio_test.go | 12 +- modules/structs/repo_file.go | 8 +- modules/system/appstate_test.go | 6 +- modules/templates/htmlrenderer_test.go | 4 +- modules/templates/scopedtmpl/scopedtmpl.go | 18 +- modules/templates/util_misc.go | 5 +- modules/templates/util_render_test.go | 4 +- modules/templates/util_test.go | 2 +- modules/templates/vars/vars_test.go | 2 +- modules/timeutil/since.go | 6 +- modules/translation/i18n/i18n_test.go | 2 +- modules/translation/i18n/localestore.go | 7 +- modules/translation/translation_test.go | 28 +- modules/util/paginate_test.go | 14 +- modules/util/path.go | 5 +- modules/util/util_test.go | 4 +- modules/validation/email_test.go | 2 +- modules/web/route_test.go | 64 ++--- modules/web/routemock_test.go | 16 +- routers/api/actions/artifactsv4.go | 4 +- routers/api/packages/api.go | 5 +- routers/api/packages/chef/auth.go | 2 +- routers/api/packages/chef/chef.go | 2 +- routers/api/packages/nuget/auth.go | 2 +- routers/api/v1/api.go | 20 +- routers/api/v1/repo/branch.go | 6 +- routers/api/v1/repo/file.go | 2 +- routers/api/v1/repo/hook_test.go | 2 +- routers/api/v1/repo/issue_dependency.go | 22 +- routers/api/v1/repo/repo_test.go | 4 +- routers/api/v1/user/key.go | 7 +- routers/api/v1/user/repo.go | 2 +- routers/install/routes_test.go | 6 +- routers/private/hook_post_receive_test.go | 2 +- routers/private/hook_pre_receive.go | 7 +- routers/web/admin/admin_test.go | 2 +- routers/web/auth/auth.go | 5 +- routers/web/auth/oauth_test.go | 2 +- routers/web/org/members.go | 4 +- routers/web/repo/action_aggregator_test.go | 4 +- routers/web/repo/attachment.go | 2 +- routers/web/repo/compare.go | 13 +- routers/web/repo/editor_test.go | 2 +- routers/web/repo/githttp_test.go | 2 +- routers/web/repo/issue.go | 16 +- routers/web/repo/issue_content_history.go | 7 +- routers/web/repo/issue_label_test.go | 14 +- routers/web/repo/projects.go | 10 +- routers/web/repo/pull.go | 4 +- routers/web/repo/pull_review.go | 5 +- routers/web/repo/setting/avatar.go | 2 +- routers/web/repo/setting/settings_test.go | 22 +- routers/web/repo/wiki_test.go | 24 +- routers/web/user/home.go | 5 +- routers/web/user/home_test.go | 26 +- routers/web/user/notification.go | 5 +- routers/web/user/setting/account.go | 8 +- routers/web/user/setting/account_test.go | 2 +- routers/web/user/setting/profile.go | 2 +- routers/web/web.go | 6 +- services/actions/auth_test.go | 4 +- services/actions/cleanup_test.go | 2 +- services/attachment/attachment_test.go | 2 +- services/auth/reverseproxy_test.go | 16 +- .../auth/source/oauth2/jwtsigningkey_test.go | 16 +- services/context/api.go | 8 +- services/context/api_test.go | 2 +- services/context/context.go | 6 +- services/context/package.go | 2 +- services/context/private.go | 2 +- services/context/quota.go | 4 +- services/context/repo.go | 8 +- services/context/upload/upload.go | 7 +- services/contexttest/context_tests.go | 6 +- services/convert/git_commit_test.go | 2 +- services/convert/notification.go | 2 +- services/convert/pull_review.go | 2 +- services/convert/pull_test.go | 2 +- services/convert/release_test.go | 4 +- services/convert/user_test.go | 4 +- services/convert/utils_test.go | 8 +- services/doctor/fix16961_test.go | 4 +- services/f3/util/logger_test.go | 2 +- services/gitdiff/gitdiff.go | 2 +- services/gitdiff/highlightdiff.go | 5 +- services/gitdiff/highlightdiff_test.go | 6 +- services/issue/comments_test.go | 24 +- services/issue/issue_test.go | 4 +- services/lfs/server.go | 7 +- services/mailer/mail_issue.go | 7 +- services/mailer/mail_test.go | 4 +- services/mailer/mailer_test.go | 4 +- services/mailer/notify.go | 18 +- services/migrations/gitea_downloader_test.go | 4 +- services/migrations/gitea_uploader_test.go | 10 +- services/migrations/gitlab_test.go | 10 +- services/migrations/gogs_test.go | 6 +- services/mirror/mirror_test.go | 60 ++-- services/packages/cleanup/cleanup.go | 11 +- .../packages/cleanup/cleanup_sha256_test.go | 2 +- services/packages/container/blob_uploader.go | 2 +- services/pull/check_test.go | 2 +- services/pull/review.go | 2 +- services/release/release_test.go | 40 +-- services/repository/archiver/archiver_test.go | 6 +- services/repository/avatar_test.go | 2 +- .../repository/contributors_graph_test.go | 6 +- services/repository/files/content_test.go | 4 +- services/repository/files/diff_test.go | 4 +- services/repository/files/file_test.go | 4 +- services/repository/files/tree_test.go | 2 +- services/repository/lfs.go | 2 +- services/user/avatar_test.go | 8 +- services/user/user_test.go | 2 +- services/webhook/default_test.go | 2 +- services/webhook/deliver_test.go | 2 +- services/webhook/general.go | 14 +- services/webhook/msteams_test.go | 4 +- services/webhook/notifier_test.go | 4 +- services/wiki/wiki_test.go | 22 +- tests/integration/actions_variables_test.go | 8 +- tests/integration/admin_user_test.go | 2 +- tests/integration/api_admin_actions_test.go | 2 +- tests/integration/api_admin_test.go | 2 +- tests/integration/api_branch_test.go | 14 +- tests/integration/api_comment_test.go | 6 +- tests/integration/api_fork_test.go | 4 +- tests/integration/api_gpg_keys_test.go | 12 +- .../api_helper_for_declarative_test.go | 2 +- tests/integration/api_issue_label_test.go | 20 +- tests/integration/api_issue_milestone_test.go | 2 +- tests/integration/api_issue_stopwatch_test.go | 10 +- .../api_issue_subscription_test.go | 8 +- tests/integration/api_issue_test.go | 4 +- .../api_issue_tracked_time_test.go | 6 +- tests/integration/api_notification_test.go | 6 +- tests/integration/api_oauth2_apps_test.go | 20 +- tests/integration/api_org_actions_test.go | 2 +- tests/integration/api_org_test.go | 6 +- tests/integration/api_packages_alt_test.go | 2 +- tests/integration/api_packages_cargo_test.go | 4 +- tests/integration/api_packages_conan_test.go | 2 +- ..._packages_container_cleanup_sha256_test.go | 2 +- .../api_packages_container_test.go | 2 +- tests/integration/api_packages_nuget_test.go | 2 +- tests/integration/api_packages_rpm_test.go | 6 +- tests/integration/api_packages_test.go | 2 +- tests/integration/api_pull_review_test.go | 50 ++-- tests/integration/api_pull_test.go | 20 +- tests/integration/api_push_mirror_test.go | 12 +- .../integration/api_quota_management_test.go | 12 +- tests/integration/api_quota_use_test.go | 2 +- tests/integration/api_releases_test.go | 18 +- tests/integration/api_repo_actions_test.go | 2 +- tests/integration/api_repo_archive_test.go | 10 +- tests/integration/api_repo_branch_test.go | 26 +- .../integration/api_repo_file_create_test.go | 46 +-- .../integration/api_repo_file_delete_test.go | 4 +- .../integration/api_repo_file_update_test.go | 26 +- .../integration/api_repo_files_change_test.go | 38 +-- .../api_repo_get_contents_list_test.go | 10 +- .../integration/api_repo_get_contents_test.go | 16 +- .../integration/api_repo_git_commits_test.go | 22 +- tests/integration/api_repo_lfs_locks_test.go | 8 +- .../integration/api_repo_lfs_migrate_test.go | 2 +- tests/integration/api_repo_raw_test.go | 4 +- tests/integration/api_repo_tags_test.go | 10 +- tests/integration/api_repo_teams_test.go | 12 +- tests/integration/api_repo_test.go | 42 ++- tests/integration/api_repo_topic_test.go | 6 +- tests/integration/api_settings_test.go | 6 +- tests/integration/api_team_test.go | 8 +- tests/integration/api_team_user_test.go | 4 +- tests/integration/api_token_test.go | 2 +- tests/integration/api_twofa_test.go | 2 +- tests/integration/api_user_actions_test.go | 2 +- tests/integration/api_user_email_test.go | 6 +- tests/integration/api_user_search_test.go | 8 +- tests/integration/appearance_settings_test.go | 6 +- tests/integration/auth_ldap_test.go | 2 +- tests/integration/auth_token_test.go | 2 +- tests/integration/block_test.go | 6 +- tests/integration/cmd_forgejo_actions_test.go | 12 +- tests/integration/cmd_forgejo_f3_test.go | 8 +- .../integration/comment_roles_system_test.go | 2 +- tests/integration/comment_roles_test.go | 28 +- tests/integration/commit_status_test.go | 20 +- tests/integration/dump_restore_test.go | 16 +- tests/integration/editor_test.go | 34 +-- tests/integration/empty_repo_test.go | 2 +- tests/integration/explore_repos_test.go | 4 +- tests/integration/feed_repo_test.go | 2 +- .../forgejo_confirmation_repo_test.go | 10 +- tests/integration/git_push_test.go | 2 +- tests/integration/git_smart_http_test.go | 2 +- tests/integration/git_test.go | 8 +- tests/integration/gpg_git_test.go | 10 +- tests/integration/html_helper.go | 2 +- tests/integration/incoming_email_test.go | 4 +- tests/integration/integration_test.go | 6 +- tests/integration/issue_subscribe_test.go | 8 +- tests/integration/issue_test.go | 50 ++-- tests/integration/links_test.go | 4 +- tests/integration/markup_external_test.go | 4 +- tests/integration/migrate_test.go | 6 +- tests/integration/mirror_pull_test.go | 4 +- tests/integration/mirror_push_test.go | 2 +- tests/integration/new_org_test.go | 2 +- tests/integration/oauth_test.go | 2 +- tests/integration/opengraph_test.go | 2 +- tests/integration/org_nav_test.go | 4 +- tests/integration/org_test.go | 2 +- tests/integration/private_project_test.go | 10 +- tests/integration/project_test.go | 6 +- tests/integration/pull_compare_test.go | 2 +- tests/integration/pull_create_test.go | 8 +- tests/integration/pull_merge_test.go | 38 +-- tests/integration/pull_review_test.go | 14 +- tests/integration/pull_status_test.go | 4 +- tests/integration/pull_update_test.go | 24 +- tests/integration/quota_use_test.go | 2 +- tests/integration/release_feed_test.go | 4 +- tests/integration/release_test.go | 20 +- tests/integration/remote_test.go | 2 +- tests/integration/rename_branch_test.go | 2 +- tests/integration/repo_activity_test.go | 2 +- tests/integration/repo_collaborator_test.go | 6 +- tests/integration/repo_commits_search_test.go | 2 +- tests/integration/repo_commits_test.go | 2 +- tests/integration/repo_fork_test.go | 2 +- tests/integration/repo_generate_test.go | 4 +- .../repo_mergecommit_revert_test.go | 2 +- tests/integration/repo_migration_ui_test.go | 4 +- tests/integration/repo_search_test.go | 6 +- tests/integration/repo_settings_test.go | 2 +- tests/integration/repo_test.go | 44 +-- tests/integration/repo_topic_test.go | 6 +- tests/integration/repo_wiki_test.go | 2 +- tests/integration/repofiles_change_test.go | 50 ++-- tests/integration/runner_test.go | 4 +- tests/integration/session_test.go | 4 +- tests/integration/signin_test.go | 2 +- tests/integration/user_avatar_test.go | 2 +- tests/integration/user_dashboard_test.go | 12 +- .../integration/user_profile_activity_test.go | 10 +- tests/integration/user_redirect_test.go | 8 +- tests/integration/user_test.go | 28 +- tests/integration/wiki_test.go | 4 +- tests/integration/xss_test.go | 4 +- 427 files changed, 2043 insertions(+), 2046 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 136c0e624a..532132838d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,9 @@ +version: "2" +output: + sort-order: + - file linters: - enable-all: false - disable-all: true - fast: false + default: none enable: - bidichk - depguard @@ -9,142 +11,155 @@ linters: - errcheck - forbidigo - gocritic - - gofmt - - gofumpt - - gosimple - govet - ineffassign - nakedret - nolintlint - revive - staticcheck - - stylecheck - testifylint - - typecheck - unconvert - - unused - unparam + - unused - usetesting - wastedassign - -run: - timeout: 10m - -output: - sort-results: true - sort-order: [file] - show-stats: true - -linters-settings: - stylecheck: - checks: ["all", "-ST1005", "-ST1003"] - nakedret: - max-func-lines: 0 - gocritic: - disabled-checks: - - ifElseChain - revive: - severity: error + settings: + depguard: + rules: + main: + deny: + - pkg: encoding/json + desc: use gitea's modules/json instead of encoding/json + - pkg: github.com/unknwon/com + desc: use gitea's util and replacements + - pkg: io/ioutil + desc: use os or io instead + - pkg: golang.org/x/exp + desc: it's experimental and unreliable + - pkg: forgejo.org/modules/git/internal + desc: do not use the internal package, use AddXxx function instead + - pkg: gopkg.in/ini.v1 + desc: do not use the ini package, use gitea's config system instead + - pkg: github.com/minio/sha256-simd + desc: use crypto/sha256 instead, see https://codeberg.org/forgejo/forgejo/pulls/1528 + gocritic: + disabled-checks: + - ifElseChain + revive: + severity: error + rules: + - name: atomic + - name: bare-return + - name: blank-imports + - name: constant-logical-expr + - name: context-as-argument + - name: context-keys-type + - name: dot-imports + - name: duplicated-imports + - name: empty-lines + - name: error-naming + - name: error-return + - name: error-strings + - name: errorf + - name: exported + - name: identical-branches + - name: if-return + - name: increment-decrement + - name: indent-error-flow + - name: modifies-value-receiver + - name: package-comments + - name: range + - name: receiver-naming + - name: redefines-builtin-id + - name: string-of-int + - name: superfluous-else + - name: time-naming + - name: unconditional-recursion + - name: unexported-return + - name: unreachable-code + - name: var-declaration + - name: var-naming + - name: redefines-builtin-id + disabled: true + staticcheck: + checks: + - all + testifylint: + disable: + - go-require + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling rules: - - name: atomic - - name: bare-return - - name: blank-imports - - name: constant-logical-expr - - name: context-as-argument - - name: context-keys-type - - name: dot-imports - - name: duplicated-imports - - name: empty-lines - - name: error-naming - - name: error-return - - name: error-strings - - name: errorf - - name: exported - - name: identical-branches - - name: if-return - - name: increment-decrement - - name: indent-error-flow - - name: modifies-value-receiver - - name: package-comments - - name: range - - name: receiver-naming - - name: redefines-builtin-id - - name: string-of-int - - name: superfluous-else - - name: time-naming - - name: unconditional-recursion - - name: unexported-return - - name: unreachable-code - - name: var-declaration - - name: var-naming - - name: redefines-builtin-id - disabled: true - gofumpt: - extra-rules: true - depguard: - rules: - main: - deny: - - pkg: encoding/json - desc: use gitea's modules/json instead of encoding/json - - pkg: github.com/unknwon/com - desc: use gitea's util and replacements - - pkg: io/ioutil - desc: use os or io instead - - pkg: golang.org/x/exp - desc: it's experimental and unreliable - - pkg: forgejo.org/modules/git/internal - desc: do not use the internal package, use AddXxx function instead - - pkg: gopkg.in/ini.v1 - desc: do not use the ini package, use gitea's config system instead - - pkg: github.com/minio/sha256-simd - desc: use crypto/sha256 instead, see https://codeberg.org/forgejo/forgejo/pulls/1528 - testifylint: - disable: - - go-require - + - linters: + - nolintlint + path: models/db/sql_postgres_with_schema.go + - linters: + - dupl + - errcheck + - gocyclo + - gosec + - staticcheck + - unparam + path: _test\.go + - linters: + - dupl + - errcheck + - gocyclo + - gosec + path: models/migrations/v + - linters: + - forbidigo + path: cmd + - linters: + - dupl + text: (?i)webhook + - linters: + - gocritic + text: (?i)`ID' should not be capitalized + - linters: + - deadcode + - unused + text: (?i)swagger + - linters: + - staticcheck + text: (?i)argument x is overwritten before first use + - linters: + - gocritic + text: '(?i)commentFormatting: put a space between `//` and comment text' + - linters: + - gocritic + text: '(?i)exitAfterDefer:' + - linters: + - staticcheck + text: "(ST1005|ST1003|QF1001):" + paths: + - node_modules + - public + - web_src + - third_party$ + - builtin$ + - examples$ issues: max-issues-per-linter: 0 max-same-issues: 0 - exclude-dirs: [node_modules, public, web_src] - exclude-case-sensitive: true - exclude-rules: - - path: models/db/sql_postgres_with_schema.go - linters: - - nolintlint - - path: _test\.go - linters: - - gocyclo - - errcheck - - dupl - - gosec - - unparam - - staticcheck - - path: models/migrations/v - linters: - - gocyclo - - errcheck - - dupl - - gosec - - path: cmd - linters: - - forbidigo - - text: "webhook" - linters: - - dupl - - text: "`ID' should not be capitalized" - linters: - - gocritic - - text: "swagger" - linters: - - unused - - deadcode - - text: "argument x is overwritten before first use" - linters: - - staticcheck - - text: "commentFormatting: put a space between `//` and comment text" - linters: - - gocritic - - text: "exitAfterDefer:" - linters: - - gocritic +formatters: + enable: + - gofmt + - gofumpt + settings: + gofumpt: + extra-rules: true + exclusions: + generated: lax + paths: + - node_modules + - public + - web_src + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index 4fb06db918..5a392954ce 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ XGO_VERSION := go-1.21.x AIR_PACKAGE ?= github.com/air-verse/air@v1 # renovate: datasource=go EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.2.1 # renovate: datasource=go GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.7.0 # renovate: datasource=go -GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.7 # renovate: datasource=go +GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2 # renovate: datasource=go GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11 # renovate: datasource=go MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0 # renovate: datasource=go SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 # renovate: datasource=go diff --git a/build/lint-locale-usage/lint-locale-usage.go b/build/lint-locale-usage/lint-locale-usage.go index 8aeae26c4c..edbd086d0e 100644 --- a/build/lint-locale-usage/lint-locale-usage.go +++ b/build/lint-locale-usage/lint-locale-usage.go @@ -264,7 +264,7 @@ func (handler Handler) HandleTemplateFile(fname string, src any) error { Err: err, } } - handler.handleTemplateFileNodes(fset, tmplParsed.Tree.Root.Nodes) + handler.handleTemplateFileNodes(fset, tmplParsed.Root.Nodes) return nil } diff --git a/build/lint-locale-usage/lint-locale-usage_test.go b/build/lint-locale-usage/lint-locale-usage_test.go index e573fb196e..81ca12c6db 100644 --- a/build/lint-locale-usage/lint-locale-usage_test.go +++ b/build/lint-locale-usage/lint-locale-usage_test.go @@ -37,13 +37,13 @@ func HandleTemplateFileWrapped(t *testing.T, fname, src string) []string { func TestUsagesParser(t *testing.T) { t.Run("go, simple", func(t *testing.T) { - assert.EqualValues(t, + assert.Equal(t, []string{"what.an.example"}, HandleGoFileWrapped(t, "", "package main\nfunc Render(ctx *context.Context) string { return ctx.Tr(\"what.an.example\"); }\n")) }) t.Run("template, simple", func(t *testing.T) { - assert.EqualValues(t, + assert.Equal(t, []string{"what.an.example"}, HandleTemplateFileWrapped(t, "", "{{ ctx.Locale.Tr \"what.an.example\" }}\n")) }) diff --git a/build/lint-locale/lint-locale_test.go b/build/lint-locale/lint-locale_test.go index 791f5278bc..37407461c7 100644 --- a/build/lint-locale/lint-locale_test.go +++ b/build/lint-locale/lint-locale_test.go @@ -15,9 +15,9 @@ func TestLocalizationPolicy(t *testing.T) { t.Run("Remove tags", func(t *testing.T) { assert.Empty(t, checkLocaleContent([]byte(`hidden_comment_types_description = Comment types checked here will not be shown inside issue pages. Checking "Label" for example removes all " added/removed