diff --git a/.golangci.yml b/.golangci.yml index 2b4c948..8c2d951 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,48 +1,88 @@ -run: - timeout: 5m - modules-download-mode: readonly - -linters-settings: - gofmt: - simplify: true - goimports: - local-prefixes: github.com/mattermost/mattermost-plugin-bridge-xmpp - govet: - check-shadowing: true - enable-all: true - disable: - - fieldalignment - misspell: - locale: US +version: "2" linters: - disable-all: true enable: - bodyclose - errcheck - gocritic - - gofmt - - goimports - gosec - - gosimple - - govet - ineffassign - misspell - nakedret - revive - - staticcheck - - stylecheck + - staticcheck # Now includes gosimple and stylecheck - typecheck - unconvert - unused - whitespace + - govet # Ensure this is included + + settings: + errcheck: + # Add any errcheck settings here + exclude-functions: + - io.Copy(*bytes.Buffer) + + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + + gosec: + # Add gosec settings + excludes: + - G104 # Errors unhandled + + staticcheck: + # Configure staticcheck (includes gosimple/stylecheck checks) + checks: ["all"] + + revive: + # Add revive rules + rules: + - name: exported + disabled: false + + exclusions: + presets: + - comments + - std-error-handling + - common-false-positives + + rules: + - path: '_test\.go' + linters: + - errcheck + - gosec + +formatters: + enable: + - gofmt + - goimports + + settings: + gofmt: + simplify: true + + goimports: + local-prefixes: + - github.com/mattermost/mattermost-plugin-bridge-xmpp + +output: + formats: + text: + path: stdout + colors: true + print-linter-name: true + +run: + timeout: 5m + tests: true issues: - exclude-rules: - - path: server/configuration.go - linters: - - unused - - path: _test\.go - linters: - - bodyclose - - scopelint # https://github.com/kyoh86/scopelint/issues/4 + max-issues-per-linter: 0 + max-same-issues: 0 + fix: false diff --git a/build/test.mk b/build/test.mk index e7691a2..16261da 100644 --- a/build/test.mk +++ b/build/test.mk @@ -2,11 +2,13 @@ # Testing and Quality Assurance # ==================================================================================== +GOLANGCI_LINT_BINARY = ./build/bin/golangci-lint +GOTESTSUM_BINARY = ./build/bin/gotestsum + ## Install go tools install-go-tools: - @echo Installing go tools - $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0 - $(GO) install gotest.tools/gotestsum@v1.7.0 + @echo "Installing development tools..." + @pluginctl tools install --bin-dir ./build/bin ## Runs eslint and golangci-lint .PHONY: check-style @@ -24,14 +26,14 @@ endif ifneq ($(HAS_SERVER),) @echo Running golangci-lint $(GO) vet ./... - $(GOBIN)/golangci-lint run ./... + $(GOLANGCI_LINT_BINARY) run ./... endif ## Runs any lints and unit tests defined for the server and webapp, if they exist. .PHONY: test test: apply webapp/node_modules install-go-tools ifneq ($(HAS_SERVER),) - $(GOBIN)/gotestsum -- -v ./... + $(GOTESTSUM_BINARY) -- -v ./... endif ifneq ($(HAS_WEBAPP),) cd webapp && $(NPM) run test; @@ -42,7 +44,7 @@ endif .PHONY: test-ci test-ci: apply webapp/node_modules install-go-tools ifneq ($(HAS_SERVER),) - $(GOBIN)/gotestsum --format standard-verbose --junitfile report.xml -- ./... + $(GOTESTSUM_BINARY) --format standard-verbose --junitfile report.xml -- ./... endif ifneq ($(HAS_WEBAPP),) cd webapp && $(NPM) run test; diff --git a/plugin.json b/plugin.json index a7f0e11..4a1f690 100644 --- a/plugin.json +++ b/plugin.json @@ -29,28 +29,40 @@ "display_name": "XMPP Server URL", "type": "text", "help_text": "The URL of the XMPP server to connect to (e.g., xmpp.example.com:5222)", - "placeholder": "xmpp.example.com:5222" + "placeholder": "xmpp.example.com:5222", + "default": null, + "hosting": "", + "secret": false }, { "key": "XMPPUsername", "display_name": "XMPP Username", "type": "text", "help_text": "The username for authenticating with the XMPP server", - "placeholder": "bridge@xmpp.example.com" + "placeholder": "bridge@xmpp.example.com", + "default": null, + "hosting": "", + "secret": false }, { "key": "XMPPPassword", "display_name": "XMPP Password", "type": "text", - "secret": true, - "help_text": "The password for authenticating with the XMPP server" + "help_text": "The password for authenticating with the XMPP server", + "placeholder": "", + "default": null, + "hosting": "", + "secret": true }, { "key": "EnableSync", "display_name": "Enable Message Synchronization", "type": "bool", "help_text": "When enabled, messages will be synchronized between Mattermost and XMPP", - "default": false + "placeholder": "", + "default": false, + "hosting": "", + "secret": false }, { "key": "XMPPUsernamePrefix", @@ -58,7 +70,9 @@ "type": "text", "help_text": "Prefix for XMPP users in Mattermost (e.g., 'xmpp' creates usernames like 'xmpp:user@domain')", "placeholder": "xmpp", - "default": "xmpp" + "default": "xmpp", + "hosting": "", + "secret": false }, { "key": "XMPPResource", @@ -66,20 +80,26 @@ "type": "text", "help_text": "XMPP resource identifier for the bridge client", "placeholder": "mattermost-bridge", - "default": "mattermost-bridge" + "default": "mattermost-bridge", + "hosting": "", + "secret": false }, { "key": "XMPPInsecureSkipVerify", "display_name": "Skip TLS Certificate Verification", "type": "bool", "help_text": "Skip TLS certificate verification for XMPP connections (use only for testing/development)", - "default": false + "placeholder": "", + "default": false, + "hosting": "", + "secret": false } - ] + ], + "sections": null }, "props": { "pluginctl": { - "version": "v0.1.1" + "version": "v0.1.2" } } -} +} \ No newline at end of file