43

Are there any concrete examples, in order to detect wrong languages in GitHub via Linguist attributes?

Source: https://github.com/github/linguist

  • linguist-documentation
  • linguist-language
  • linguist-vendored
Vitali
  • 547
  • 2
  • 6
  • 13
  • 2
    They can be found in the `README.md` - https://github.com/github/linguist/tree/47b109be3657fe3d5933fba6840a6ceea0f94498#overrides - Although I'd admit it's not very easy to find. – d4nyll Jan 30 '17 at 10:30

1 Answers1

70

Examples can be found in Linguist's documentation. Detecting wrong languages (which's what OP asks) can be achieved by setting linguist-language attributes in the .gitattributes file.

linguist-language

With the following attribute, Linguist detects all .rb files as being Java files.

*.rb linguist-language=Java

linguist-vendored

With the following attribute, Linguist detects files in the special-vendored-path directory (notice the mandatory trailing *) as vendored and excludes them from statistics.

special-vendored-path/* linguist-vendored

linguist-documentation

Without the following attribute, Linguist would detect the file docs/formatter.rb as documentation and exclude it from statistics.

docs/formatter.rb linguist-documentation=false

linguist-detectable

With the following attribute, Linguist counts SQL files in statistics. Without this attribute, only programming and markup languages are counted in statistics.

*.sql linguist-detectable=true
Top-Master
  • 7,611
  • 5
  • 39
  • 71
pchaigno
  • 11,313
  • 2
  • 29
  • 54