• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nunnatsa / ginkgolinter
84%
main: 88%

Build:
Build:
LAST BUILD BRANCH: dependabot/go_modules/golang.org/x/tools-0.38.0
DEFAULT BRANCH: main
Repo Added 17 Jul 2022 06:45AM UTC
Token d9ik705i5Md7LA6J92R9w7EJjDCvwAne4 regen
Build 344 Last
Files 56
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH matcherror
branch: matcherror
CHANGE BRANCH
x
Reset
Sync Branches
  • matcherror
  • Add-Enhancement-Suggestion-template
  • add-badges
  • add-bug-report-template
  • add-contrib-guide
  • add-is
  • add-linter-cover
  • add-pr-template
  • add-revive-linter
  • add-rules
  • add-to-readme
  • allow-multi-edit
  • allow-underscore
  • automation-improvements
  • bug-fix
  • bug-fixes
  • bump-dependencies
  • bump-deps
  • bump-deps-testdata
  • bump-go-1.21
  • bump-go-1.22
  • bump-go-to-1.24
  • bump-golangci-lint
  • bump-lint
  • bump-tools-v0.28.0
  • bump-typeparams
  • bump-x-tools
  • bump_golang.org/x/tools_to_v0.31.0
  • cap-equal
  • check-wrong-bool-asert
  • chor-update-deps
  • cleanup
  • code-improvements
  • compare-len
  • compare-types
  • cont-refactoring
  • dependabot/go_modules/github.com/go-toolsmith/astcopy-1.1.0
  • dependabot/go_modules/golang.org/x/tools-0.10.0
  • dependabot/go_modules/golang.org/x/tools-0.11.0
  • dependabot/go_modules/golang.org/x/tools-0.11.1
  • dependabot/go_modules/golang.org/x/tools-0.12.0
  • dependabot/go_modules/golang.org/x/tools-0.13.0
  • dependabot/go_modules/golang.org/x/tools-0.14.0
  • dependabot/go_modules/golang.org/x/tools-0.15.0
  • dependabot/go_modules/golang.org/x/tools-0.16.0
  • dependabot/go_modules/golang.org/x/tools-0.16.1
  • dependabot/go_modules/golang.org/x/tools-0.17.0
  • dependabot/go_modules/golang.org/x/tools-0.18.0
  • dependabot/go_modules/golang.org/x/tools-0.19.0
  • dependabot/go_modules/golang.org/x/tools-0.20.0
  • dependabot/go_modules/golang.org/x/tools-0.21.0
  • dependabot/go_modules/golang.org/x/tools-0.22.0
  • dependabot/go_modules/golang.org/x/tools-0.23.0
  • dependabot/go_modules/golang.org/x/tools-0.24.0
  • dependabot/go_modules/golang.org/x/tools-0.26.0
  • dependabot/go_modules/golang.org/x/tools-0.27.0
  • dependabot/go_modules/golang.org/x/tools-0.28.0
  • dependabot/go_modules/golang.org/x/tools-0.29.0
  • dependabot/go_modules/golang.org/x/tools-0.31.0
  • dependabot/go_modules/golang.org/x/tools-0.32.0
  • dependabot/go_modules/golang.org/x/tools-0.33.0
  • dependabot/go_modules/golang.org/x/tools-0.35.0
  • dependabot/go_modules/golang.org/x/tools-0.36.0
  • dependabot/go_modules/golang.org/x/tools-0.38.0
  • dependabot/go_modules/golang.org/x/tools-0.6.0
  • dependabot/go_modules/golang.org/x/tools-0.7.0
  • dependabot/go_modules/golang.org/x/tools-0.8.0
  • dependabot/go_modules/golang.org/x/tools-0.9.1
  • dependabot/go_modules/golang.org/x/tools-0.9.3
  • doc-improve
  • docs-fix-typos
  • double-neg
  • enable-dependabot
  • error-async
  • eventually-func
  • fake-pr
  • feat/constructor-config
  • fix-100
  • fix-115
  • fix-124
  • fix-171
  • fix-190
  • fix-211
  • fix-82
  • fix-91
  • fix-badges
  • fix-bug
  • fix-comp-type-rule
  • fix-false-positive
  • fix-issue-88
  • fix-name
  • fix-pointer-bug
  • fix-pr-template
  • fix-sanity
  • fix/go-mod
  • fix/unalias
  • focus-spec
  • force-expect-to
  • ginkgohandler-unit
  • git-ignore-bin
  • gitignore
  • global-expect
  • go-downgrade-1.20
  • go1.20
  • go119
  • golangci-lint
  • gomega-only
  • havelen0
  • helper-methods
  • improve-gomega-detection
  • improve-tests
  • internal
  • main
  • more-bins
  • nav/enforce-correct-succeed-usage
  • new-bool-check
  • no-assertion-rule
  • nogo-support
  • optional_description_rule
  • patch-1
  • pointer-val
  • prevent-focus
  • readme-opening
  • refactor
  • refactor-ginkgo-handler
  • refactor/fix-typos
  • simplify-error-msg
  • small-refactor
  • smaller-files
  • sprintf-msg
  • succeed-rule
  • support-hold-label
  • test-pr
  • testscript
  • timing
  • tiny-cleanup
  • tiny-fix
  • to-and-not
  • update-CONTRIBUTING
  • update-dependencies
  • update-deps
  • var-unit-tests
  • vars-in-containers
  • version

09 Nov 2023 12:07PM UTC coverage: 84.444% (+0.5%) from 83.908%
6811556342

Pull #118

github

nunnatsa
New rule(s): Wrong Usage of the `MatchError` gomega Matcher

The `MatchError` gomega matcher asserts an error value (and if it's not nil).

There are four valid formats for using this Matcher:
* error value; e.g. `Expect(err).To(MatchError(anotherErr))`
* string, to be equal to the output of the `Error()` method; e.g. `Expect(err).To(MatchError("Not Found"))`
* A gomega matcher that asserts strings; e.g. `Expect(err).To(MatchError(ContainSubstring("Found")))`
* [from v0.29.0] a function that receive a single error parameter and returns a single boolean value.
  In this format, an additional single string parameter, with the function description, is also required; e.g.
  `Expect(err).To(MatchError(isNotFound, "is the error is a not found error"))`

These four format are checked on runtime, but sometimes it's too late. ginkgolinter performs a static analysis and so it
will find these issues on build time.

ginkgolinter checks the following:
* Is the first parameter is one of the four options above.
* That there are no additional parameters passed to the matcher; e.g.
  `MatchError(isNotFoundFunc, "a valid description" , "not used string")`. In this case, the matcher won't fail on run
  time, but the additional parameters are not in use and ignored.
* If the first parameter is a function with the format of `func(error)bool`, ginkgolinter makes sure that the second
  parameter exists and its type is string.
Pull Request #118: New rule(s): Wrong Usage of the `MatchError` gomega Matcher

89 of 96 new or added lines in 2 files covered. (92.71%)

1102 of 1305 relevant lines covered (84.44%)

767.75 hits per line

Relevant lines Covered
Build:
Build:
1305 RELEVANT LINES 1102 COVERED LINES
767.75 HITS PER LINE
Source Files on matcherror
  • Tree
  • List 6
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
6811556342 matcherror New rule(s): Wrong Usage of the `MatchError` gomega Matcher The `MatchError` gomega matcher asserts an error value (and if it's not nil). There are four valid formats for using this Matcher: * error value; e.g. `Expect(err).To(MatchError(another... Pull #118 09 Nov 2023 12:11PM UTC nunnatsa github
84.44
See All Builds (344)

Badge your Repo: ginkgolinter

We detected this repo isn’t badged! Grab the embed code to the right, add it to your repo to show off your code coverage, and when the badge is live hit the refresh button to remove this message.

Could not find badge in README.

Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

Refresh
  • Settings
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc