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

golangci: fix invalid linter-settings configuration name #7244

Merged
merged 2 commits into from
Jan 4, 2025

Conversation

Juneezee
Copy link
Contributor

@Juneezee Juneezee commented Jan 4, 2025

Why the changes in this PR are needed?

We started using golangci-lint in PR #3465. However, the configuration name linter-settings is incorrect, which caused the configuration for the lll and misspell linters to not be applied.

opa/.golangci.yaml

Lines 140 to 145 in 3568eab

linter-settings:
lll:
line-length: 200
misspell:
locale: US

2025-01-05_01-51

The correct configuration name is linters-settings, as noted in https://golangci-lint.run/usage/configuration/#linters-settings-configuration

Due to this configuration error, we have accumulated many US spelling errors in the codebase. Some of these would cause breaking changes for existing users because they require renaming functions and error strings.

v1/topdown/cancel.go:15:2: `Cancelled` is a misspelling of `Canceled` (misspell)
	Cancelled() bool
	^
v1/topdown/cancel.go:31:18: `Cancelled` is a misspelling of `Canceled` (misspell)
func (c *cancel) Cancelled() bool {
                 ^
v1/topdown/tokens.go:957:56: `marshalling` is a misspelling of `marshaling` (misspell)
		return fmt.Errorf("failed to prepare JWT headers for marshalling: %v", err)
		                                                     ^
v1/topdown/tokens.go:967:56: `marshalling` is a misspelling of `marshaling` (misspell)
		return fmt.Errorf("failed to prepare JWT payload for marshalling: %v", err)
		                                                     ^
v1/topdown/tokens.go:977:58: `marshalling` is a misspelling of `marshaling` (misspell)
		return fmt.Errorf("failed to prepare JWT signature for marshalling: %v", err)
		                                                       ^

What are the changes in this PR?

  • Rename linter-settings to linters-settings in .golangci.yaml
  • Remove the US locale restriction from the misspell linter. This is because renaming functions and error strings are considered breaking changes

Notes to assist PR review:

Further comments:

Copy link

netlify bot commented Jan 4, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 38df330
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/67799015ca417c0008e1b3c1
😎 Deploy Preview https://deploy-preview-7244--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor Author

@Juneezee Juneezee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the misspell issues here: https://github.com/open-policy-agent/opa/actions/runs/12612660972/job/35149642609?pr=7244#step:3:56

The issues in the log are not exhaustive. Note the message in the CI log: level=info msg="[runner/max_from_linter] 89/139 issues from linter misspell were hidden, use --max-issues-per-linter"

@Juneezee Juneezee marked this pull request as ready for review January 4, 2025 18:30
@anderseknert
Copy link
Member

That's a good catch! Thank you for that 👍 Just quickly skimming the issues reported and many/most seem to be around just differences in US English vs British English. While I think we've said the docs should stick to US English, I don't think we want to enforce that in code comments. If we enable this linter properly, I think we'll want to have it accept both if possible.

@Juneezee
Copy link
Contributor Author

Juneezee commented Jan 4, 2025

That's a good catch! Thank you for that 👍 Just quickly skimming the issues reported and many/most seem to be around just differences in US English vs British English. While I think we've said the docs should stick to US English, I don't think we want to enforce that in code comments. If we enable this linter properly, I think we'll want to have it accept both if possible.

@anderseknert Hi, the misspell linter has two analysis mode: default and restricted, as noted in https://golangci-lint.run/usage/linters/#misspell

There doesn't seem to be a way to tell misspell to ignore code comments. Unless we want to use the ignore-words option or //nolint directive

@anderseknert
Copy link
Member

I didn't mean to say it should ignore comments, but that both US and UK locales should be considered OK outside of the docs.

Correct spellings using locale preferences for US or UK.
Setting locale to US will correct the British spelling of 'colour' to 'color'.
Default is to use a neutral variety of English.

From those docs though, it sounds like we can just remove the locale attribute from the config to get that. Let's try it out!

@Juneezee
Copy link
Contributor Author

Juneezee commented Jan 4, 2025

From those docs though, it sounds like we can just remove the locale attribute from the config to get that. Let's try it out!

I have already made this change in the second commit of this PR 8f329cb 😄

@anderseknert
Copy link
Member

Awesome! Why is the build green now though? Call me cynical, but I can't imagine we don't have a single typo or misspelling in any of the comments in the OPA codebase 😄

@Juneezee
Copy link
Contributor Author

Juneezee commented Jan 4, 2025

Awesome! Why is the build green now though? Call me cynical, but I can't imagine we don't have a single typo or misspelling in any of the comments in the OPA codebase 😄

😁 We really didn’t have any typos apart from the US misspellings. I added the --max-issues-per-linter 0 flag to my local make check command, and the results confirm that the only issues are related to US misspellings.

Click to show long output
docker run --rm -v /home/jun/Desktop/github/opa:/app:ro,Z -w /app golangci/golangci-lint:v1.60.1 golangci-lint run -v --max-issues-per-linter 0
level=info msg="golangci-lint has version 1.60.1 built with go1.23.0 from 3298c104 on 2024-08-14T01:15:05Z"
level=info msg="[config_reader] Config search paths: [./ /app / /root]"
level=info msg="[config_reader] Used config file .golangci.yaml"
level=info msg="[lintersdb] Active 15 linters: [copyloopvar errcheck gofmt goimports gosimple govet ineffassign mirror misspell prealloc revive staticcheck tenv unconvert unused]"
level=info msg="[loader] Go packages loading at mode 575 (exports_file|imports|name|types_sizes|compiled_files|deps|files) took 34.023132386s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 201.466128ms"
level=info msg="[linters_context/goanalysis] analyzers took 13m33.918460422s with top 10 stages: the_only_name: 5m27.784425731s, buildir: 1m54.235926025s, goimports: 13.650543681s, unused: 9.194232027s, S1038: 8.17596724s, unconvert: 6.199981342s, gofmt: 6.164080972s, fact_purity: 5.122490233s, printf: 4.594754671s, nilness: 4.451503094s"
level=info msg="[runner] Issues before processing: 1721, after processing: 139"
level=info msg="[runner] Processors filtering stat (in/out): exclude-rules: 1721/246, uniq_by_line: 143/139, max_per_file_from_linter: 139/139, severity-rules: 139/139, filename_unadjuster: 1721/1721, autogenerated_exclude: 1721/1721, diff: 139/139, max_from_linter: 139/139, skip_files: 1721/1721, exclude: 1721/1721, nolint: 246/143, max_same_issues: 139/139, fixer: 139/139, path_prefixer: 139/139, invalid_issue: 1721/1721, path_prettifier: 1721/1721, identifier_marker: 1721/1721, source_code: 139/139, path_shortener: 139/139, sort_results: 139/139, cgo: 1721/1721, skip_dirs: 1721/1721"
level=info msg="[runner] processing took 643.790616ms with stages: exclude-rules: 352.030461ms, nolint: 190.591771ms, identifier_marker: 73.697153ms, autogenerated_exclude: 12.403813ms, path_prettifier: 7.133029ms, source_code: 4.235455ms, skip_dirs: 2.936966ms, cgo: 257.854µs, invalid_issue: 216.299µs, filename_unadjuster: 102.387µs, uniq_by_line: 94.005µs, path_shortener: 51.474µs, max_per_file_from_linter: 12.781µs, max_same_issues: 4.261µs, fixer: 3.283µs, exclude: 3.282µs, diff: 2.933µs, sort_results: 2.794µs, skip_files: 2.794µs, max_from_linter: 2.792µs, path_prefixer: 2.724µs, severity-rules: 2.305µs"
level=info msg="[runner] linters took 34.547141704s with stages: goanalysis_metalinter: 33.903045184s"
features/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/server/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
ast/json/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
capabilities/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
internal/wasm/sdk/opa/errors/errors.go:28:66: `cancelled` is a misspelling of `canceled` (misspell)
	// CancelledErr is the error code returned if the evaluation is cancelled.
	                                                                ^
internal/wasm/sdk/opa/errors/errors.go:29:25: `cancelled` is a misspelling of `canceled` (misspell)
	CancelledErr string = "cancelled"
	                       ^
internal/gqlparser/ast/definition.go:18:53: `behaviour` is a misspelling of `behavior` (misspell)
// more similar than different and don't define any behaviour. I think this style of
                                                    ^
loader/extension/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
loader/filter/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
schemas/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
util/decoding/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
metrics/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
util/test/doc.go:8:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
internal/gojsonschema/jsonLoader.go:372:32: `marshalled` is a misspelling of `marshaled` (misspell)
// In case the JSON is already marshalled to interface{} use this loader
                               ^
internal/gojsonschema/jsonLoader.go:373:76: `marshalled` is a misspelling of `marshaled` (misspell)
// This is used for testing as otherwise there is no guarantee the JSON is marshalled
                                                                           ^
v1/util/graph.go:10:29: `neighbours` is a misspelling of `neighbors` (misspell)
	// Edges should return the neighbours of node "u".
	                           ^
util/doc.go:8:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
logging/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
test/cases/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/server/encoding/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
types/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/server/decoding/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
keys/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/server/metrics/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
test/authz/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
logging/test/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
ir/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
internal/prometheus/prometheus.go:56:22: `cancelled` is a misspelling of `canceled` (misspell)
			Help: "A count of cancelled requests.",
			                  ^
v1/ast/compile.go:2597:10: `behaviour` is a misspelling of `behavior` (misspell)
	// This behaviour is consistent scoping inside the body. For example:
	        ^
v1/ast/term.go:441:16: `marshalling` is a misspelling of `marshaling` (misspell)
// Specialized marshalling logic is required to include a type hint for Value.
               ^
v1/ast/compile_test.go:8916:125: `behaviour` is a misspelling of `behavior` (misspell)
		{input: "data[x][y]", expected: []*Rule{rule1, rule2d, rule2, rule3, rule5, rule5b, rule5c}, excludeHidden: true}, // old behaviour of GetRulesDynamic
		                                                                                                                          ^
v1/ast/marshal_test.go:574:12: `marshalled` is a misspelling of `marshaled` (misspell)
	// Ensure marshalled JSON includes location for any term
	          ^
v1/ast/marshal_test.go:665:17: `marshalled` is a misspelling of `marshaled` (misspell)
	// text is not marshalled to JSON so we just drop it in our examples
	               ^
v1/ast/marshal_test.go:958:65: `marshalling` is a misspelling of `marshaling` (misspell)
				// using an empty annotations object here since Annotations marshalling is tested separately
				                                                            ^
ast/location/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
ast/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/topdown/cache/cache_test.go:591:56: `cancelled` is a misspelling of `canceled` (misspell)
	// Stale entry cleanup routine stopped as context was cancelled
	                                                      ^
topdown/print/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
topdown/cache/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
resolver/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/format/format.go:132:60: `behaviour` is a misspelling of `behavior` (misspell)
	// NOTE(sr): For ref-head rules, this will be the default behaviour, since
	                                                          ^
topdown/copypropagation/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
storage/doc.go:8:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
ir/encoding/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
dependencies/doc.go:9:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
refactor/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
topdown/builtins/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
format/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
resolver/wasm/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
version/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
storage/inmem/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/loader/loader.go:131:4: `behaviour` is a misspelling of `behavior` (misspell)
// behaviour.
   ^
config/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
storage/inmem/test/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
bundle/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
loader/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
hooks/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
storage/disk/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
server/identifier/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/logs/status/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
tracing/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
features/tracing/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/rest/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/download/download.go:51:119: `behaviour` is a misspelling of `behavior` (misspell)
	config             Config                        // downloader configuration for tuning polling and other downloader behaviour
	                                                                                                                     ^
v1/download/oci_downloader.go:15:117: `behaviour` is a misspelling of `behavior` (misspell)
	config           Config                        // downloader configuration for tuning polling and other downloader behaviour
	                                                                                                                   ^
v1/topdown/cancel.go:11:37: `cancelling` is a misspelling of `canceling` (misspell)
// Cancel defines the interface for cancelling topdown queries. Cancel
                                    ^
v1/topdown/cancel.go:15:2: `Cancelled` is a misspelling of `Canceled` (misspell)
	Cancelled() bool
	^
v1/topdown/cancel.go:31:18: `Cancelled` is a misspelling of `Canceled` (misspell)
func (c *cancel) Cancelled() bool {
                 ^
v1/topdown/cidr.go:204:40: `Cancelled` is a misspelling of `Canceled` (misspell)
		if bctx.Cancel != nil && bctx.Cancel.Cancelled() {
		                                     ^
v1/topdown/errors.go:40:52: `cancelled` is a misspelling of `canceled` (misspell)
	// CancelErr indicates the evaluation process was cancelled.
	                                                  ^
v1/topdown/eval.go:366:33: `Cancelled` is a misspelling of `Canceled` (misspell)
	if e.cancel != nil && e.cancel.Cancelled() {
	                               ^
v1/topdown/eval.go:376:21: `cancelled` is a misspelling of `canceled` (misspell)
			Message: "caller cancelled query execution",
			                 ^
v1/topdown/http.go:256:47: `cancelled` is a misspelling of `canceled` (misspell)
	// Do not do this if the builtin context was cancelled and is what caused the request to stop.
	                                             ^
v1/topdown/http.go:670:20: `cancelled` is a misspelling of `canceled` (misspell)
	// the request is cancelled if evaluation is cancelled.
	                  ^
v1/topdown/numbers.go:144:40: `Cancelled` is a misspelling of `Canceled` (misspell)
		if bctx.Cancel != nil && bctx.Cancel.Cancelled() {
		                                     ^
v1/topdown/reachable.go:121:5: `initialised` is a misspelling of `initialized` (misspell)
	// initialised to the initial set of nodes we start out with.
	   ^
v1/topdown/sets.go:12:28: `favour` is a misspelling of `favor` (misspell)
// Deprecated in v0.4.2 in favour of minus/infix "-" operation.
                           ^
v1/topdown/tokens.go:957:56: `marshalling` is a misspelling of `marshaling` (misspell)
		return fmt.Errorf("failed to prepare JWT headers for marshalling: %v", err)
		                                                     ^
v1/topdown/tokens.go:967:56: `marshalling` is a misspelling of `marshaling` (misspell)
		return fmt.Errorf("failed to prepare JWT payload for marshalling: %v", err)
		                                                     ^
v1/topdown/tokens.go:977:58: `marshalling` is a misspelling of `marshaling` (misspell)
		return fmt.Errorf("failed to prepare JWT signature for marshalling: %v", err)
		                                                       ^
v1/topdown/net_test.go:123:2: `cancelled` is a misspelling of `canceled` (misspell)
	cancelled := func() (context.Context, func()) {
	^
v1/topdown/net_test.go:133:4: `cancelled` is a misspelling of `canceled` (misspell)
		"cancelled": cancelled,
		 ^
download/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
topdown/cancel.go:11:37: `cancelling` is a misspelling of `canceling` (misspell)
// Cancel defines the interface for cancelling topdown queries. Cancel
                                    ^
topdown/doc.go:12:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
topdown/errors.go:24:52: `cancelled` is a misspelling of `canceled` (misspell)
	// CancelErr indicates the evaluation process was cancelled.
	                                                  ^
v1/server/types/types.go:215:38: `modelled` is a misspelling of `modeled` (misspell)
// "explain" parameter. The trace is modelled as series of trace events that
                                     ^
v1/server/types/types.go:230:28: `modelled` is a misspelling of `modeled` (misspell)
// parameter. The trace is modelled as a human readable array of strings representing the
                           ^
internal/wasm/sdk/internal/wasm/bindings.go:130:19: `cancelled` is a misspelling of `canceled` (misspell)
	// If the ctx is cancelled (deadline expired, or manually cancelled), this will
	                 ^
internal/wasm/sdk/internal/wasm/bindings.go:150:19: `cancelled` is a misspelling of `canceled` (misspell)
	// If the ctx is cancelled, and we're evaluation this call stack:
	                 ^
internal/wasm/sdk/internal/wasm/bindings.go:157:32: `signalling` is a misspelling of `signaling` (misspell)
	// already have taken care of signalling the interrupt to the wasm
	                              ^
internal/wasm/sdk/internal/wasm/vm.go:344:5: `cancelling` is a misspelling of `canceling` (misspell)
	// cancelling the builtins that use topdown.Cancel, when the context is
	   ^
internal/wasm/sdk/internal/wasm/vm.go:345:5: `cancelled` is a misspelling of `canceled` (misspell)
	// cancelled.
	   ^
internal/wasm/sdk/internal/wasm/vm.go:385:5: `cancelling` is a misspelling of `canceling` (misspell)
	// cancelling the builtins that use topdown.Cancel, when the context is
	   ^
internal/wasm/sdk/internal/wasm/vm.go:386:5: `cancelled` is a misspelling of `canceled` (misspell)
	// cancelled.
	   ^
cover/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/rego/rego.go:2191:32: `cancelled` is a misspelling of `canceled` (misspell)
	// Cancel query if context is cancelled or deadline is reached.
	                              ^
v1/rego/rego.go:2476:32: `cancelled` is a misspelling of `canceled` (misspell)
	// Cancel query if context is cancelled or deadline is reached.
	                              ^
profiler/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
topdown/lineage/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
server/types/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
server/types/types.go:120:38: `modelled` is a misspelling of `modeled` (misspell)
// "explain" parameter. The trace is modelled as series of trace events that
                                     ^
server/types/types.go:125:28: `modelled` is a misspelling of `modeled` (misspell)
// parameter. The trace is modelled as a human readable array of strings representing the
                           ^
internal/wasm/sdk/opa/loader/http/loader.go:93:29: `cancelled` is a misspelling of `canceled` (misspell)
// successful download.  If cancelled, will return context.Cancelled.
                            ^
internal/wasm/sdk/opa/loader/http/loader.go:155:19: `cancelled` is a misspelling of `canceled` (misspell)
// the context is cancelled. No other error besides context.Canceled
                  ^
rego/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/plugins/bundle/config_test.go:145:32: `marshalling` is a misspelling of `marshaling` (misspell)
				t.Fatalf("Unexpected error marshalling config: %s", err)
				                           ^
v1/plugins/bundle/plugin_test.go:1024:53: `behaviour` is a misspelling of `behavior` (misspell)
		// NOTE(sr): These assertions reflect the current behaviour only! Not prescriptive.
		                                                  ^
v1/test/scheduler/scheduler_test.go:140:3: `prioritisation` is a misspelling of `prioritization` (misspell)
# prioritisation logic that is included by default in Kubernetes.
  ^
v1/test/scheduler/scheduler_test.go:144:15: `prioritise` is a misspelling of `prioritize` (misspell)
    weight := prioritise[node_id]
              ^
v1/test/scheduler/scheduler_test.go:382:1: `prioritise` is a misspelling of `prioritize` (misspell)
prioritise[node_id] = weight if {
^
server/writer/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
features/wasm/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/bundle/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
server/handlers/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
compile/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
tester/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
server/authorizer/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
debug/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/status/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/repl/repl_test.go:494:19: `flavours` is a misspelling of `flavors` (misspell)
// so we need two flavours of this test: v0, and v1.
                  ^
sdk/test/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
repl/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
server/doc.go:8:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/plugins/logs/plugin.go:265:72: `behaviour` is a misspelling of `behavior` (misspell)
// ReportingConfig represents configuration for the plugin's reporting behaviour.
                                                                       ^
v1/plugins/logs/plugin.go:944:47: `behaviour` is a misspelling of `behavior` (misspell)
			// can return an error. Should the default behaviour be to
			                                           ^
plugins/logs/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
plugins/logs/plugin.go:29:72: `behaviour` is a misspelling of `behavior` (misspell)
// ReportingConfig represents configuration for the plugin's reporting behaviour.
                                                                       ^
plugins/discovery/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
v1/runtime/runtime.go:165:36: `behaviour` is a misspelling of `behavior` (misspell)
	// Logging configures the logging behaviour.
	                                  ^
v1/runtime/runtime.go:268:61: `behaviour` is a misspelling of `behavior` (misspell)
// LoggingConfig stores the configuration for OPA's logging behaviour.
                                                            ^
sdk/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
cmd/internal/exec/parser_test.go:22:30: `marshalling` is a misspelling of `marshaling` (misspell)
		t.Fatalf("unexpected error marshalling valid json: %q", err.Error())
		                           ^
runtime/doc.go:8:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
runtime/runtime.go:25:61: `behaviour` is a misspelling of `behavior` (misspell)
// LoggingConfig stores the configuration for OPA's logging behaviour.
                                                            ^
test/e2e/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
test/e2e/logs/doc.go:6:27: `behaviours` is a misspelling of `behaviors` (misspell)
// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
                          ^
cmd/exec_test.go:811:15: `cancelled` is a misspelling of `canceled` (misspell)
								// we cancelled the context, so we expect that error
								      ^
level=info msg="File cache stats: 1078 entries of total size 9.0MiB"
level=info msg="Memory: 679 samples, avg is 527.4MB, max is 2422.2MB"
level=info msg="Execution took 1m8.791824337s"
make: *** [Makefile:148: check] Error 1

To make sure that misspell is working properly, I changed the word language to langauge of this line

// Wildcard represents the wildcard variable as defined in the language.

docker run --rm -v /home/jun/Desktop/github/opa:/app:ro,Z -w /app golangci/golangci-lint:v1.60.1 golangci-lint run -v --max-issues-per-linter 0
level=info msg="golangci-lint has version 1.60.1 built with go1.23.0 from 3298c104 on 2024-08-14T01:15:05Z"
level=info msg="[config_reader] Config search paths: [./ /app / /root]"
level=info msg="[config_reader] Used config file .golangci.yaml"
level=info msg="[lintersdb] Active 15 linters: [copyloopvar errcheck gofmt goimports gosimple govet ineffassign mirror misspell prealloc revive staticcheck tenv unconvert unused]"
level=info msg="[loader] Go packages loading at mode 575 (compiled_files|imports|name|deps|exports_file|files|types_sizes) took 35.22946746s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 209.458136ms"
level=info msg="[linters_context/goanalysis] analyzers took 14m44.428026964s with top 10 stages: the_only_name: 5m52.186087175s, buildir: 2m0.49724086s, goimports: 15.126773141s, unused: 8.445142685s, S1038: 8.240678271s, gofmt: 6.8956697s, fact_purity: 6.791913054s, unconvert: 6.782633517s, nilness: 5.656161004s, printf: 5.6127843s"
ast/policy.go:72:64: `langauge` is a misspelling of `language` (misspell)
// Wildcard represents the wildcard variable as defined in the langauge.
                                                               ^
level=info msg="[runner] Issues before processing: 1576, after processing: 1"
level=info msg="[runner] Processors filtering stat (in/out): sort_results: 1/1, exclude: 1576/1576, exclude-rules: 1576/101, max_same_issues: 1/1, fixer: 1/1, path_prefixer: 1/1, invalid_issue: 1576/1576, skip_files: 1576/1576, uniq_by_line: 1/1, max_per_file_from_linter: 1/1, source_code: 1/1, cgo: 1576/1576, filename_unadjuster: 1576/1576, path_prettifier: 1576/1576, skip_dirs: 1576/1576, identifier_marker: 1576/1576, severity-rules: 1/1, autogenerated_exclude: 1576/1576, nolint: 101/1, diff: 1/1, max_from_linter: 1/1, path_shortener: 1/1"
level=info msg="[runner] processing took 494.636934ms with stages: exclude-rules: 336.253664ms, identifier_marker: 71.87241ms, nolint: 60.971303ms, autogenerated_exclude: 13.471546ms, path_prettifier: 8.119888ms, skip_dirs: 3.280654ms, cgo: 255.059µs, invalid_issue: 229.988µs, filename_unadjuster: 97.288µs, source_code: 44.697µs, uniq_by_line: 5.727µs, max_same_issues: 4.61µs, exclude: 3.352µs, path_shortener: 3.352µs, sort_results: 3.283µs, severity-rules: 2.933µs, max_per_file_from_linter: 2.933µs, skip_files: 2.864µs, path_prefixer: 2.864µs, max_from_linter: 2.863µs, fixer: 2.863µs, diff: 2.793µs"
level=info msg="[runner] linters took 36.018057079s with stages: goanalysis_metalinter: 35.523122339s"
level=info msg="File cache stats: 964 entries of total size 7.6MiB"
level=info msg="Memory: 707 samples, avg is 519.1MB, max is 2380.9MB"
level=info msg="Execution took 1m11.473225593s"
make: *** [Makefile:148: check] Error 1

And misspell reported the typo issue.

@anderseknert
Copy link
Member

Not saying it's on you to fix it, and we should probably merge this anyway — fixing an obvious error in the config is a good thing no matter how you look at it. But just to provide the first example I could find:

// should be interpretted as undefined:

From here. This should be "interpreted" with a single t in both locales, shouldn't it? There must be hundreds if not thousands of issues with spelling in our comments 😅 And I don't particularly like the idea of a typo i a comment failing a build... but that leaves the question about what this linter actually does, if it actually does anything. But oh well, it's an approve from me, and perhaps others have more knowledge to share here.

@Juneezee
Copy link
Contributor Author

Juneezee commented Jan 4, 2025

Not saying it's on you to fix it, and we should probably merge this anyway — fixing an obvious error in the config is a good thing no matter how you look at it. But just to provide the first example I could find:

// should be interpretted as undefined:

From here. This should be "interpreted" with a single t in both locales, shouldn't it? There must be hundreds if not thousands of issues with spelling in our comments 😅 And I don't particularly like the idea of a typo i a comment failing a build... but that leaves the question about what this linter actually does, if it actually does anything. But oh well, it's an approve from me, and perhaps others have more knowledge to share here.

🥹 Yep, I jumped to a conclusion too fast. misspell is only capable of performing a dictionary check, so interpretted won’t be reported if it’s not in the dictionary (golangci/golangci-lint#1597).

I ran a full typo check on the codebase using GoLand. The inspection was much more thorough than misspell, but it also flagged many false positives.

2025-01-05_03-24

@anderseknert
Copy link
Member

Good to learn for us all! And certainly not something that should block an obvious fix like this. So let's get this in, and we can consider what a dictionary like that should look like, if we even want one. I remember @msorens having made contributions to automate spellchecking in the past, so tagging him for advice 🙂 Merging this as soon as the build passes though.

@anderseknert anderseknert enabled auto-merge (squash) January 4, 2025 19:50
@anderseknert anderseknert merged commit 79ce575 into open-policy-agent:main Jan 4, 2025
28 checks passed
@Juneezee Juneezee deleted the golangci branch January 5, 2025 08:21
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.

2 participants