-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Does not allow variable assignments in container nodes. See here for more details: https://onsi.github.io/ginkgo/#avoid-spec-pollution-dont-initialize-variables-in-container-nodes This rule is disabled by default. use the `--forbid-spec-pollution=true` flag to enable it. For example, this code will trigger a warning: ```go var _ = Describe("description", func(){ var x = 10 ... }) ``` Instead, use `BeforeEach()`; e.g. ```go var _ = Describe("description", func (){ var x int BeforeEach(func (){ x = 10 }) ... }) ```
- Loading branch information
Showing
12 changed files
with
470 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package vars_in_containers | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = FDescribe("When's", func() { // want `ginkgo-linter: Focus container found. This is used only for local debug and should not be part of the actual source code. Consider to replace with "Describe"` | ||
FWhen("test FWhen", func() { // want `Focus container found. This is used only for local debug and should not be part of the actual source code. Consider to replace with "When"` | ||
var x = 1 // want `use BeforeEach\(\) to assign variable x` | ||
It("use x", func() { | ||
Expect(x).To(Equal(1)) | ||
}) | ||
}) | ||
}) | ||
|
||
var _ = FWhen("Context's", func() { // want `ginkgo-linter: Focus container found. This is used only for local debug and should not be part of the actual source code. Consider to replace with "When"` | ||
FContext("test FContext", func() { // want `Focus container found. This is used only for local debug and should not be part of the actual source code. Consider to replace with "Context"` | ||
var x = 1 // want `use BeforeEach\(\) to assign variable x` | ||
It("use x", func() { | ||
Expect(x).To(Equal(1)) | ||
}) | ||
}) | ||
}) | ||
|
||
var _ = FContext("Describe's", func() { // want `ginkgo-linter: Focus container found. This is used only for local debug and should not be part of the actual source code. Consider to replace with "Context"` | ||
FDescribe("test FDescribe", func() { // want `Focus container found. This is used only for local debug and should not be part of the actual source code. Consider to replace with "Describe"` | ||
var x = 1 // want `use BeforeEach\(\) to assign variable x` | ||
It("use x", func() { | ||
Expect(x).To(Equal(1)) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.