Skip to content

Allow disabling of check with in code comments #13

Description

@scags9876

Great tool by the way! It has enabled me to write better code by pointing places where things can be dry'd up.

It would be nice to disable output for certain places in code where I know there is duplication, but I've chosen to keep the duplication in place. Sometimes there are reasons for this.

I'm thinking something akin to a linting comment to disable duplication checking:

// dupl-disable
            Context("when specifying parameter set 1", func() {
                BeforeEach(func() {
                    request, _ = http.NewRequest("GET", "/?paramA=20&paramB=40", nil)
                })
                It("should reflect the desired parameters", func() {
                    server.GET("/", func(c *gin.Context) {
                        paramSet1, _ := getParamSet1(c)
                        Expect(paramSet1.A).To(Equal(20))
                        Expect(paramSet1.B).To(Equal(40))
                    })
                    server.ServeHTTP(recorder, request)
                })
            })
// dupl-enable

...

// dupl-disable
                Context("when specifying parameter set 2", func() {
                    BeforeEach(func() {
                        request, _ = http.NewRequest("GET", "/?paramX=5000&paramY=10000", nil)
                    })
                    It("will reflect the desired parameters", func() {
                        server.GET("/", func(c *gin.Context) {
                            paramSet2, _ := getParamSet2(c)
                            Expect(paramSet2.X).To(Equal(5000))
                            Expect(paramSet2.Y).To(Equal(10000))
                        })
                        server.ServeHTTP(recorder, request)
                    })
                })
// dupl-enable

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions