Abirdcfly / dupword

A linter that checks for duplicate words in the source code (usually miswritten)
MIT License
13 stars 5 forks source link

Ignore duplicate words in example test output #41

Closed matthewhughes934 closed 1 month ago

matthewhughes934 commented 1 month ago

It's common that output is repeated in these examples, e.g.[1], so add an exception for these in test files when detecting duplicates.

Even though the docs[2] only mention "// Output:" and "// Unordered output:" the lower case version of these also seems supported (see again[1]).

[1] https://go.googlesource.com/go/+/f38d42f2c4c6ad0d7cbdad5e1417cac3be2a5dcb/src/bytes/example_test.go#58 [2] https://pkg.go.dev/testing#hdr-Examples

Issue: https://github.com/Abirdcfly/dupword/issues/20

Abirdcfly commented 1 month ago

Thanks @matthewhughes934!

mitar commented 1 month ago

Awesome! Can you please also add // Example output: to the list of allowed prefixes? I am using that when having a non-deterministic output from the example (then you cannot run it, but it is still useful to show what the output looks like).