{"id":18029359,"url":"https://github.com/nunnatsa/ginkgolinter","last_synced_at":"2025-04-06T18:14:53.853Z","repository":{"id":43208268,"uuid":"511127705","full_name":"nunnatsa/ginkgolinter","owner":"nunnatsa","description":"golang linter for ginkgo and gomega","archived":false,"fork":false,"pushed_at":"2024-09-16T07:45:50.000Z","size":3444,"stargazers_count":25,"open_issues_count":5,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-17T08:33:02.124Z","etag":null,"topics":["ginkgo","go","golang","gomega","linter","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nunnatsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-06T12:26:53.000Z","updated_at":"2024-09-16T07:44:48.000Z","dependencies_parsed_at":"2023-02-19T00:31:12.076Z","dependency_job_id":"eadaa394-e1e8-4d60-85c0-26b7dd5403de","html_url":"https://github.com/nunnatsa/ginkgolinter","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunnatsa%2Fginkgolinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunnatsa%2Fginkgolinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunnatsa%2Fginkgolinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nunnatsa%2Fginkgolinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nunnatsa","download_url":"https://codeload.github.com/nunnatsa/ginkgolinter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247526763,"owners_count":20953143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ginkgo","go","golang","gomega","linter","testing"],"created_at":"2024-10-30T09:08:57.475Z","updated_at":"2025-04-06T18:14:53.775Z","avatar_url":"https://github.com/nunnatsa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/nunnatsa/ginkgolinter)](https://goreportcard.com/report/github.com/nunnatsa/ginkgolinter)\n[![Coverage Status](https://coveralls.io/repos/github/nunnatsa/ginkgolinter/badge.svg?branch=main)](https://coveralls.io/github/nunnatsa/ginkgolinter?branch=main)\n![Build Status](https://github.com/nunnatsa/ginkgolinter/workflows/CI/badge.svg)\n[![License](https://img.shields.io/github/license/nunnatsa/ginkgolinter)](/LICENSE)\n[![Release](https://img.shields.io/github/release/nunnatsa/ginkgolinter.svg)](https://github.com/nunnatsa/ginkgolinter/releases/latest)\n[![GitHub Releases Stats of ginkgolinter](https://img.shields.io/github/downloads/nunnatsa/ginkgolinter/total.svg?logo=github)](https://somsubhra.github.io/github-release-stats/?username=nunnatsa\u0026repository=ginkgolinter)\n\n# ginkgo-linter\n[ginkgo](https://onsi.github.io/ginkgo/) is a popular testing framework and [gomega](https://onsi.github.io/gomega/) is its assertion package.\n\nThis is a golang linter to enforce some standards while using the ginkgo and gomega packages.\n\n## Install the CLI\nDownload the right executable from the latest release, according to your OS.\n\nAnother option is to use go:\n```shell\ngo install github.com/nunnatsa/ginkgolinter/cmd/ginkgolinter@latest\n```\nThen add the new executable to your PATH.\n\n## usage\n```shell\nginkgolinter [-fix] ./...\n```\n\nUse the `-fix` flag to apply the fix suggestions to the source code.\n\n### Use ginkgolinter with golangci-lint\nThe ginkgolinter is now part of the popular [golangci-lint](https://golangci-lint.run/), starting from version `v1.51.1`.\n\nIt is not enabled by default, though. There are two ways to run ginkgolinter with golangci-lint:\n\n* From command line:\n  ```shell\n  golangci-lint run -E ginkgolinter ./...\n  ```\n* From configuration:\n  \n  Add ginkgolinter to the enabled linters list in .golangci.reference.yml file in your project. For more details, see\n  the [golangci-lint documentation](https://golangci-lint.run/usage/configuration/); e.g.\n   ```yaml\n   linters:\n     enable:\n       - ginkgolinter\n   ```\n## Linter Rules\nThe linter checks the ginkgo and gomega assertions in golang test code. Gomega may be used together with ginkgo tests, \nFor example:\n```go\nIt(\"should test something\", func() { // It is ginkgo test case function\n\tExpect(\"abcd\").To(HaveLen(4), \"the string should have a length of 4\") // Expect is the gomega assertion\n})\n```\nor within a classic golang test code, like this:\n```go\nfunc TestWithGomega(t *testing.T) {\n\tg := NewWithT(t)\n\tg.Expect(\"abcd\").To(HaveLen(4), \"the string should have a length of 4\")\n}\n```\n\nIn some cases, the gomega will be passed as a variable to function by ginkgo, for example:\n```go\nEventually(func(g Gomega) error {\n\tg.Expect(\"abcd\").To(HaveLen(4), \"the string should have a length of 4\")\n\treturn nil\n}).Should(Succeed())\n```\n\nThe linter checks the `Expect`, `ExpectWithOffset` and the `Ω` \"actual\" functions, with the `Should`, `ShouldNot`, `To`, `ToNot` and `NotTo` assertion functions.\n\nIt also supports the embedded `Not()` matcher\n\nSome checks find actual bugs, and some are more for style.\n\n### Using a function call in async assertion [BUG]\nThis rule finds an actual bug in tests, where asserting a function call in an async function; e.g. `Eventually`. For\nexample:\n```go\nfunc slowInt(int val) int {\n\ttime.Sleep(time.Second)\n\treturn val\n}\n\n...\n\nIt(\"should test that slowInt returns 42, eventually\", func() {\n\tEventually(slowInt(42)).WithPolling(time.Millisecond * 100).WithTimeout(time.Second * 2).Equal(42)\n})\n```\nThe problem with the above code is that it **should** poll - call the function - until it returns 42, but what actually\nhappens is that first the function is called, and we pass `42` to `Eventually` - not the function. This is not what we\ntried to do here.\n\nThe linter will suggest replacing this code by:\n```go\nIt(\"should test that slowInt returns 42, eventually\", func() {\n\tEventually(slowInt).WithArguments(42).WithPolling(time.Millisecond * 100).WithTimeout(time.Second * 2).Equal(42)\n})\n```\n\nThe linter suggested replacing the function call by the function name.\n\nIf function arguments are used, the linter will add the `WithArguments()` method to pass them.\n\nPlease notice that `WithArguments()` is only supported from gomenga v1.22.0.\n\nWhen using an older version of gomega, change the code manually. For example:\n\n```go\nIt(\"should test that slowInt returns 42, eventually\", func() {\n\tEventually(func() int {\n\t\tslowint(42)\t\t\n\t}).WithPolling(time.Millisecond * 100).WithTimeout(time.Second * 2).Equal(42)\n})\n```\n\n### Comparing a pointer with a value [BUG]\nThe linter warns when comparing a pointer with a value.\nThese comparisons are always wrong and will always fail.\n\nIn case of a positive assertion (`To()` or `Should()`), the test will just fail.\n\nBut the main concern is for false positive tests, when using a negative assertion (`NotTo()`, `ToNot()`, `ShouldNot()`,\n`Should(Not())` etc.); e.g.\n```go\nnum := 5\n...\npNum := \u0026num\n...\nExpect(pNum).ShouldNot(Equal(6))\n```\nThis assertion will pass, but for the wrong reasons: pNum is not equal 6, not because num == 5, but because pNum is\na pointer, while `6` is an `int`.\n\nIn the case above, the linter will suggest `Expect(pNum).ShouldNot(HaveValue(Equal(6)))`\n\nThis is also right for additional matchers: `BeTrue()` and `BeFalse()`, `BeIdenticalTo()`, `BeEquivalentTo()`\nand `BeNumerically`.\n\n### Missing Assertion Method [BUG]\nThe linter warns when calling an \"actual\" method (e.g. `Expect()`, `Eventually()` etc.), without an assertion method (e.g\n`Should()`, `NotTo()` etc.)\n\nFor example:\n```go\n// no assertion for the result\nEventually(doSomething).WithTimeout(time.Seconds * 5).WithPolling(time.Milliseconds * 100)\n```\n\nThe linter will not suggest a fix for this warning.\n\nThis rule cannot be suppressed.\n\n### Focus Container / Focus individual spec found [BUG]\nThis rule finds ginkgo focus containers, or the `Focus` individual spec in the code.\n\nginkgo supports the `FDescribe`, `FContext`, `FWhen`, `FIt`, `FDescribeTable` and `FEntry`\ncontainers to allow the developer to focus\non a specific test or set of tests during test development or debug.\n\nFor example:\n```go\nvar _ = Describe(\"checking something\", func() {\n    FIt(\"this test is the only one that will run\", func(){\n        ...\n    })\n})\n```\nAlternatively, the `Focus` individual spec may be used for the same purpose, e.g.\n```go\nvar _ = Describe(\"checking something\", Focus, func() {\n    It(\"this test is the only one that will run\", func(){\n        ...\n    })\n})\n```\n\nThese container, or the `Focus` spec, must not be part of the final source code, and should only be used locally by the \ndeveloper.\n\n***This rule is disabled by default***. Use the `--forbid-focus-container` command line flag to enable it.  \n\n### Comparing values from different types [BUG]\n\nThe `Equal` and the `BeIdentical` matchers also check the type, not only the value.\n    \nThe following code will fail in runtime:    \n```go\nx := 5 // x is int\nExpect(x).Should(Equal(uint(5)) // x and uint(5) are with different\n```\nWhen using negative checks, it's even worse, because we get a false positive:\n```\nx := 5\nExpect(x).ShouldNot(Equal(uint(5))\n```\n\nThe linter suggests two options to solve this warning: either compare with the same type, e.g. \nusing casting, or use the `BeEquivalentTo` matcher.\n\nThe linter can't guess what is the best solution in each case, and so it won't auto-fix this warning.\n\nTo suppress this warning entirely, use the `--suppress-type-compare-assertion` command line parameter. \n\nTo suppress a specific file or line, use the `// ginkgo-linter:ignore-type-compare-warning` comment (see [below](#suppress-warning-from-the-code))\n\n### Wrong Usage of the `MatchError` gomega Matcher [BUG]\nThe `MatchError` gomega matcher asserts an error value (and if it's not nil).\nThere are four valid formats for using this Matcher:\n* error value; e.g. `Expect(err).To(MatchError(anotherErr))`\n* string, to be equal to the output of the `Error()` method; e.g. `Expect(err).To(MatchError(\"Not Found\"))`\n* A gomega matcher that asserts strings; e.g. `Expect(err).To(MatchError(ContainSubstring(\"Found\")))`\n* [from v0.29.0] a function that receive a single error parameter and returns a single boolean value. \n  In this format, an additional single string parameter, with the function description, is also required; e.g.\n  `Expect(err).To(MatchError(isNotFound, \"is the error is a not found error\"))`\n\nThese four format are checked on runtime, but sometimes it's too late. ginkgolinter performs a static analysis and so it\nwill find these issues on build time.\n\nginkgolinter checks the following:\n* Is the first parameter is one of the four options above.\n* That there are no additional parameters passed to the matcher; e.g.\n  `MatchError(isNotFoundFunc, \"a valid description\" , \"not used string\")`. In this case, the matcher won't fail on run \n  time, but the additional parameters are not in use and ignored.   \n* If the first parameter is a function with the format of `func(error)bool`, ginkgolinter makes sure that the second \n  parameter exists and its type is string.\n\n### Async timing interval: timeout is shorter than polling interval [BUG]\n***Note***: Only applied when the `suppress-async-assertion` flag is **not set** *and* the `validate-async-intervals` \nflag **is** set.\n\n***Note***: This rule work with best-effort approach. It can't find many cases, like const defined not in the same\npackage, or when using variables.\n\nThe timeout and polling intervals may be passed as optional arguments to the `Eventually` or `Consistently` functions, or\nusing the `WithTimeout` or , `Within` methods (timeout), and `WithPolling` or `ProbeEvery` methods (polling).\n\nThis rule checks if the async (`Eventually` or `Consistently`) timeout duration, is not shorter than the polling interval.\n\nFor example:\n   ```go\n   Eventually(aFunc).WithTimeout(500 * time.Millisecond).WithPolling(10 * time.Second).Should(Succeed())\n   ```\n\nThis will probably happen when using the old format:\n   ```go\n   Eventually(aFunc, 500 * time.Millisecond /*timeout*/, 10 * time.Second /*polling*/).Should(Succeed())\n   ```\n\n### Prevent Wrong Actual Values with the Succeed() matcher [Bug]\nThe `Succeed()` matcher only accepts a single error value. this rule validates that. \n\nFor example:\n   ```go\n   Expect(42).To(Succeed())\n   ```\n\nBut mostly, we want to avoid using this matcher with functions that return multiple values, even if their last \nreturned value is an error, because this is not supported:\n   ```go\n   Expect(os.Open(\"myFile.txt\")).To(Succeed())\n   ```\n\nIn async assertions (like `Eventually()`), the `Succeed()` matcher may also been used with functions that accept \na Gomega object as their first parameter, and returns nothing, e.g. this is a valid usage of `Eventually`\n  ```go\n  Eventually(func(g Gomega){\n\t  g.Expect(true).To(BeTrue())\n  }).WithTimeout(10 * time.Millisecond).WithPolling(time.Millisecond).Should(Succeed())\n  ```\n\n***Note***: This rule **does not** support auto-fix.\n\n### Avoid Spec Pollution: Don't Initialize Variables in Container Nodes [BUG/STYLE]:\n***Note***: Only applied when the `--forbid-spec-pollution` flag is set (disabled by default).\n\nAccording to [ginkgo documentation](https://onsi.github.io/ginkgo/#avoid-spec-pollution-dont-initialize-variables-in-container-nodes), \nno variable should be assigned within a container node (`Describe`, `Context`, `When` or their `F`, `P` or `X` forms)\n  \nFor example:\n```go\nvar _ = Describe(\"description\", func(){\n    var x = 10\n    ...\n})\n```\n\nInstead, use `BeforeEach()`; e.g.\n```go\nvar _ = Describe(\"description\", func (){\n    var x int\n\t\n    BeforeEach(func (){\n        x = 10\n    })\n    ...\n})\n```\n\n### Wrong Length Assertion [STYLE]\nThe linter finds assertion of the golang built-in `len` function, with all kind of matchers, while there are already \ngomega matchers for these usecases; We want to assert the item, rather than its length.\n\nThere are several wrong patterns:\n```go\nExpect(len(x)).To(Equal(0)) // should be: Expect(x).To(BeEmpty())\nExpect(len(x)).To(BeZero()) // should be: Expect(x).To(BeEmpty())\nExpect(len(x)).To(BeNumeric(\"\u003e\", 0)) // should be: Expect(x).ToNot(BeEmpty())\nExpect(len(x)).To(BeNumeric(\"\u003e=\", 1)) // should be: Expect(x).ToNot(BeEmpty())\nExpect(len(x)).To(BeNumeric(\"==\", 0)) // should be: Expect(x).To(BeEmpty())\nExpect(len(x)).To(BeNumeric(\"!=\", 0)) // should be: Expect(x).ToNot(BeEmpty())\n\nExpect(len(x)).To(Equal(1)) // should be: Expect(x).To(HaveLen(1))\nExpect(len(x)).To(BeNumeric(\"==\", 2)) // should be: Expect(x).To(HaveLen(2))\nExpect(len(x)).To(BeNumeric(\"!=\", 3)) // should be: Expect(x).ToNot(HaveLen(3))\n```\n\nIt also supports the embedded `Not()` matcher; e.g.\n\n`Ω(len(x)).Should(Not(Equal(4)))` =\u003e `Ω(x).ShouldNot(HaveLen(4))`\n\nOr even (double negative):\n\n`Ω(len(x)).To(Not(BeNumeric(\"\u003e\", 0)))` =\u003e `Ω(x).To(BeEmpty())`\n\nThe output of the linter,when finding issues, looks like this:\n```\n./testdata/src/a/a.go:14:5: ginkgo-linter: wrong length assertion; consider using `Expect(\"abcd\").Should(HaveLen(4))` instead\n./testdata/src/a/a.go:18:5: ginkgo-linter: wrong length assertion; consider using `Expect(\"\").Should(BeEmpty())` instead\n./testdata/src/a/a.go:22:5: ginkgo-linter: wrong length assertion; consider using `Expect(\"\").Should(BeEmpty())` instead\n```\n\n### Wrong Cap Assertion [STYLE]\nThe linter finds assertion of the golang built-in `cap` function, with all kind of matchers, while there are already\ngomega matchers for these usecases; We want to assert the item, rather than its cap.\n\nThere are several wrong patterns:\n```go\nExpect(cap(x)).To(Equal(0)) // should be: Expect(x).To(HaveCap(0))\nExpect(cap(x)).To(BeZero()) // should be: Expect(x).To(HaveCap(0))\nExpect(cap(x)).To(BeNumeric(\"\u003e\", 0)) // should be: Expect(x).ToNot(HaveCap(0))\nExpect(cap(x)).To(BeNumeric(\"==\", 2)) // should be: Expect(x).To(HaveCap(2))\nExpect(cap(x)).To(BeNumeric(\"!=\", 3)) // should be: Expect(x).ToNot(HaveCap(3))\n```\n\n#### use the `HaveLen(0)` matcher.  [STYLE]\nThe linter will also warn about the `HaveLen(0)` matcher, and will suggest to replace it with `BeEmpty()`\n\n### Wrong `nil` Assertion [STYLE]\nThe linter finds assertion of the comparison to nil, with all kind of matchers, instead of using the existing `BeNil()` \nmatcher; We want to assert the item, rather than a comparison result.\n\nThere are several wrong patterns:\n\n```go\nExpect(x == nil).To(Equal(true)) // should be: Expect(x).To(BeNil())\nExpect(nil == x).To(Equal(true)) // should be: Expect(x).To(BeNil())\nExpect(x != nil).To(Equal(true)) // should be: Expect(x).ToNot(BeNil())\nExpect(nil != nil).To(Equal(true)) // should be: Expect(x).ToNot(BeNil())\n\nExpect(x == nil).To(BeTrue()) // should be: Expect(x).To(BeNil())\nExpect(x == nil).To(BeFalse()) // should be: Expect(x).ToNot(BeNil())\n```\nIt also supports the embedded `Not()` matcher; e.g.\n\n`Ω(x == nil).Should(Not(BeTrue()))` =\u003e `Ω(x).ShouldNot(BeNil())`\n\nOr even (double negative):\n\n`Ω(x != nil).Should(Not(BeTrue()))` =\u003e `Ω(x).Should(BeNil())`\n\n### Wrong boolean Assertion [STYLE]\nThe linter finds assertion using the `Equal` method, with the values of to `true` or `false`, instead\nof using the existing `BeTrue()` or `BeFalse()` matcher.\n\nThere are several wrong patterns:\n\n```go\nExpect(x).To(Equal(true)) // should be: Expect(x).To(BeTrue())\nExpect(x).To(Equal(false)) // should be: Expect(x).To(BeFalse())\n```\nIt also supports the embedded `Not()` matcher; e.g.\n\n`Ω(x).Should(Not(Equal(True)))` =\u003e `Ω(x).ShouldNot(BeTrue())`\n\n### Wrong Error Assertion [STYLE]\nThe linter finds assertion of errors compared with nil, or to be equal nil, or to be nil. The linter suggests to use `Succeed` for functions or `HaveOccurred` for error values..\n\nThere are several wrong patterns:\n\n```go\nExpect(err).To(BeNil()) // should be: Expect(err).ToNot(HaveOccurred())\nExpect(err == nil).To(Equal(true)) // should be: Expect(err).ToNot(HaveOccurred())\nExpect(err == nil).To(BeFalse()) // should be: Expect(err).To(HaveOccurred())\nExpect(err != nil).To(BeTrue()) // should be: Expect(err).To(HaveOccurred())\nExpect(funcReturnsError()).To(BeNil()) // should be: Expect(funcReturnsError()).To(Succeed())\n\nand so on\n```\nIt also supports the embedded `Not()` matcher; e.g.\n\n`Ω(err == nil).Should(Not(BeTrue()))` =\u003e `Ω(x).Should(HaveOccurred())`\n\n### Wrong Comparison Assertion [STYLE]\nThe linter finds assertion of boolean comparisons, which are already supported by existing gomega matchers. \n\nThe linter assumes that when compared something to literals or constants, these values should be used for the assertion,\nand it will do its best to suggest the right assertion expression accordingly. \n\nThere are several wrong patterns:\n```go\nvar x = 10\nvar s = \"abcd\"\n\n...\n\nExpect(x == 10).Should(BeTrue()) // should be Expect(x).Should(Equal(10))\nExpect(10 == x).Should(BeTrue()) // should be Expect(x).Should(Equal(10))\nExpect(x != 5).Should(Equal(true)) // should be Expect(x).ShouldNot(Equal(5))\nExpect(x != 0).Should(Equal(true)) // should be Expect(x).ShouldNot(BeZero())\n\nExpect(s != \"abcd\").Should(BeFalse()) // should be Expect(s).Should(Equal(\"abcd\"))\nExpect(\"abcd\" != s).Should(BeFalse()) // should be Expect(s).Should(Equal(\"abcd\"))\n```\nOr non-equal comparisons:\n```go\nExpect(x \u003e 10).To(BeTrue()) // ==\u003e Expect(x).To(BeNumerically(\"\u003e\", 10))\nExpect(x \u003e= 15).To(BeTrue()) // ==\u003e Expect(x).To(BeNumerically(\"\u003e=\", 15))\nExpect(3 \u003e y).To(BeTrue()) // ==\u003e Expect(y).To(BeNumerically(\"\u003c\", 3))\n// and so on ...\n```\n\nThis check included a limited support in constant values. For example:\n```go\nconst c1 = 5\n\n...\n\nExpect(x1 == c1).Should(BeTrue()) // ==\u003e Expect(x1).Should(Equal(c1))\nExpect(c1 == x1).Should(BeTrue()) // ==\u003e Expect(x1).Should(Equal(c1))\n```\n\n### Don't Allow Using `Expect` with `Should` or `ShouldNot` [STYLE]\nThis optional rule forces the usage of the `Expect` method only with the `To`, `ToNot` or `NotTo` \nassertion methods; e.g.\n```go\nExpect(\"abc\").Should(HaveLen(3)) // =\u003e Expect(\"abc\").To(HaveLen(3))\nExpect(\"abc\").ShouldNot(BeEmpty()) // =\u003e Expect(\"abc\").ToNot(BeEmpty())\n```\nThis rule support auto fixing.\n\n***This rule is disabled by default***. Use the `--force-expect-to` command line flag to enable it.\n\n### Async timing interval: multiple timeout or polling intervals [STYLE]\n***Note***: Only applied when the `suppress-async-assertion` flag is **not set** *and* the `validate-async-intervals`\nflag **is** set.\n\nThe timeout and polling intervals may be passed as optional arguments to the `Eventually` or `Consistently` functions, or\nusing the `WithTimeout` or , `Within` methods (timeout), and `WithPolling` or `ProbeEvery` methods (polling).\n\nThe linter checks that there is up to one polling argument and up to one timeout argument. \n\nFor example:\n\n```go\n// both WithTimeout() and Within()\nEventually(aFunc).WithTimeout(time.Second * 10).Within(time.Second * 10).WithPolling(time.Millisecond * 500).Should(BeTrue())\n// both polling argument, and WithPolling() method\nEventually(aFunc, time.Second*10, time.Millisecond * 500).WithPolling(time.Millisecond * 500).Should(BeTrue())\n```\n\n### Async timing interval: non-time.Duration intervals [STYLE]\n***Note***: Only applied when the `suppress-async-assertion` flag is **not set** *and* the `validate-async-intervals`\nflag **is** set.\n\ngomega supports a few formats for timeout and polling intervals, when using the old format (the last two parameters of Eventually and Consistently):\n* a `time.Duration` value\n* any kind of numeric value (int(8/16/32/64), uint(8/16/32/64) or float(32/64), as the number of seconds.\n* duration string like `\"12s\"`\n\nThe linter triggers a warning for any duration value that is not of the `time.Duration` type, assuming that this is\nthe desired type, given the type of the argument of the newer \"WithTimeout\", \"WithPolling\", \"Within\" and \"ProbeEvery\"\nmethods.\n\nFor example:\n   ```go\n   Eventually(func() bool { return true }, \"1s\").Should(BeTrue())\n   Eventually(context.Background(), func() bool { return true }, time.Second*60, float64(2)).Should(BeTrue())\n   ```\n\nThis rule offers a limited auto fix: for integer values, or integer consts, the linter will suggest multiply the\nvalue with `time.Second`; e.g.\n```go\nconst polling = 1\nEventually(aFunc, 5, polling)\n```\nwill be changed to:\n```go\nEventually(aFunc, time.Second*5, time.Second*polling)\n```\n\n### Correct usage of the `Succeed()` and the `HaveOccurred()` matchers\nThis rule enforces using the `Success()` matcher only for functions, and the `HaveOccurred()` matcher only for error\nvalues.\n\nFor example:\n  ```go\n  Expect(err).To(Succeed())\n  ```\nwill trigger a warning with a suggestion to replace the mather to\n  ```go\n  Expect(err).ToNot(HaveOccurred())\n  ```\n\nand vice versa:\n  ```go\n  Expect(myErrorFunc()).ToNot(HaveOccurred())\n  ```\nwill trigger a warning with a suggestion to replace the mather to\n  ```go\n  Expect(myErrorFunc()).To(Succeed())\n  ```\n***This rule is disabled by default***. Use the `--force-succeed` command line flag to enable it.\n\n***Note***: This rule **does** support auto-fix, when the `--fix` command line parameter is used.\n\n## Suppress the linter\n### Suppress warning from command line\n* Use the `--suppress-len-assertion` flag to suppress the wrong length and cap assertions warning\n* Use the `--suppress-nil-assertion` flag to suppress the wrong nil assertion warning\n* Use the `--suppress-err-assertion` flag to suppress the wrong error assertion warning\n* Use the `--suppress-compare-assertion` flag to suppress the wrong comparison assertion warning\n* Use the `--suppress-async-assertion` flag to suppress the function call in async assertion warning\n* Use the `--forbid-focus-container` flag to activate the focused container assertion (deactivated by default)\n* Use the `--suppress-type-compare-assertion` to suppress the type compare assertion warning\n* Use the `--allow-havelen-0` flag to avoid warnings about `HaveLen(0)`; Note: this parameter is only supported from\n  command line, and not from a comment.\n\n### Suppress warning from the code\nTo suppress the wrong length and cap assertions warning, add a comment with (only)\n\n`ginkgo-linter:ignore-len-assert-warning`. \n\nTo suppress the wrong nil assertion warning, add a comment with (only)\n\n`ginkgo-linter:ignore-nil-assert-warning`. \n\nTo suppress the wrong error assertion warning, add a comment with (only)\n\n`ginkgo-linter:ignore-err-assert-warning`. \n\nTo suppress the wrong comparison assertion warning, add a comment with (only)\n\n`ginkgo-linter:ignore-compare-assert-warning`. \n\nTo suppress the wrong async assertion warning, add a comment with (only)\n\n`ginkgo-linter:ignore-async-assert-warning`. \n\nTo suppress the focus container warning, add a comment with (only)\n\n`ginkgo-linter:ignore-focus-container-warning`\n\nTo suppress the different type comparison, add a comment with (only)\n\n`ginkgo-linter:ignore-type-compare-warning`\n\nNotice that this comment will not work for an anonymous variable container like\n```go\n// ginkgo-linter:ignore-focus-container-warning (not working!!)\nvar _ = FDescribe(...)\n```\nIn this case, use the file comment (see below).\n\nThere are two options to use these comments:\n1. If the comment is at the top of the file, suppress the warning for the whole file; e.g.:\n   ```go\n   package mypackage\n   \n   // ginkgo-linter:ignore-len-assert-warning\n   \n   import (\n       . \"github.com/onsi/ginkgo/v2\"\n       . \"github.com/onsi/gomega\"\n   )\n   \n   var _ = Describe(\"my test\", func() {\n        It(\"should do something\", func() {\n            Expect(len(\"abc\")).Should(Equal(3)) // nothing in this file will trigger the warning\n        })\n   })\n   ```\n   \n2. If the comment is before a wrong length check expression, the warning is suppressed for this expression only; for example:\n   ```golang\n   It(\"should test something\", func() {\n       // ginkgo-linter:ignore-nil-assert-warning\n       Expect(x == nil).Should(BeTrue()) // this line will not trigger the warning\n       Expect(x == nil).Should(BeTrue()) // this line will trigger the warning\n   }\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnunnatsa%2Fginkgolinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnunnatsa%2Fginkgolinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnunnatsa%2Fginkgolinter/lists"}