Skip to content

Commit

Permalink
Merge branch 'master' into specflow
Browse files Browse the repository at this point in the history
  • Loading branch information
arfon committed Apr 11, 2015
2 parents 56c3b8c + 000a42e commit 6b2bb52
Show file tree
Hide file tree
Showing 294 changed files with 42,027 additions and 826 deletions.
128 changes: 118 additions & 10 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
[submodule "vendor/grammars/Handlebars"]
path = vendor/grammars/Handlebars
url = https://github.com/daaain/Handlebars
[submodule "vendor/grammars/powershell.tmbundle"]
path = vendor/grammars/powershell.tmbundle
url = https://github.com/davidpeckham/powershell.tmbundle
[submodule "vendor/grammars/powershell"]
path = vendor/grammars/powershell
url = https://github.com/SublimeText/PowerShell
[submodule "vendor/grammars/jade-tmbundle"]
path = vendor/grammars/jade-tmbundle
url = https://github.com/davidrios/jade-tmbundle
Expand Down Expand Up @@ -249,7 +249,7 @@
url = https://github.com/shellderp/sublime-robot-plugin
[submodule "vendor/grammars/actionscript3-tmbundle"]
path = vendor/grammars/actionscript3-tmbundle
url = https://github.com/simongregory/actionscript3-tmbundle
url = https://github.com/honzabrecka/actionscript3-tmbundle
[submodule "vendor/grammars/Sublime-QML"]
path = vendor/grammars/Sublime-QML
url = https://github.com/skozlovf/Sublime-QML
Expand Down Expand Up @@ -337,6 +337,9 @@
[submodule "vendor/grammars/ini.tmbundle"]
path = vendor/grammars/ini.tmbundle
url = https://github.com/textmate/ini.tmbundle
[submodule "vendor/grammars/desktop.tmbundle"]
path = vendor/grammars/desktop.tmbundle
url = https://github.com/Mailaender/desktop.tmbundle.git
[submodule "vendor/grammars/io.tmbundle"]
path = vendor/grammars/io.tmbundle
url = https://github.com/textmate/io.tmbundle
Expand Down Expand Up @@ -394,9 +397,6 @@
[submodule "vendor/grammars/pascal.tmbundle"]
path = vendor/grammars/pascal.tmbundle
url = https://github.com/textmate/pascal.tmbundle
[submodule "vendor/grammars/perl.tmbundle"]
path = vendor/grammars/perl.tmbundle
url = https://github.com/textmate/perl.tmbundle
[submodule "vendor/grammars/php-smarty.tmbundle"]
path = vendor/grammars/php-smarty.tmbundle
url = https://github.com/textmate/php-smarty.tmbundle
Expand Down Expand Up @@ -525,9 +525,6 @@
[submodule "vendor/grammars/sublime-bsv"]
path = vendor/grammars/sublime-bsv
url = https://github.com/thotypous/sublime-bsv
[submodule "vendor/grammars/AutoHotkey"]
path = vendor/grammars/AutoHotkey
url = https://github.com/robertcollier4/AutoHotkey
[submodule "vendor/grammars/Sublime-HTTP"]
path = vendor/grammars/Sublime-HTTP
url = https://github.com/httpspec/sublime-highlighting
Expand All @@ -549,3 +546,114 @@
[submodule "vendor/grammars/turtle.tmbundle"]
path = vendor/grammars/turtle.tmbundle
url = https://github.com/peta/turtle.tmbundle
[submodule "vendor/grammars/liquid.tmbundle"]
path = vendor/grammars/liquid.tmbundle
url = https://github.com/bastilian/validcode-textmate-bundles
[submodule "vendor/grammars/ats.sublime"]
path = vendor/grammars/ats.sublime
url = https://github.com/steinwaywhw/ats-mode-sublimetext
[submodule "vendor/grammars/Modelica"]
path = vendor/grammars/Modelica
url = https://github.com/BorisChumichev/modelicaSublimeTextPackage
[submodule "vendor/grammars/sublime-apl"]
path = vendor/grammars/sublime-apl
url = https://github.com/StoneCypher/sublime-apl
[submodule "vendor/grammars/CLIPS-sublime"]
path = vendor/grammars/CLIPS-sublime
url = https://github.com/psicomante/CLIPS-sublime
[submodule "vendor/grammars/Creole"]
path = vendor/grammars/Creole
url = https://github.com/Siddley/Creole
[submodule "vendor/grammars/GDScript-sublime"]
path = vendor/grammars/GDScript-sublime
url = https://github.com/beefsack/GDScript-sublime
[submodule "vendor/grammars/sublime-golo"]
path = vendor/grammars/sublime-golo
url = https://github.com/TypeUnsafe/sublime-golo
[submodule "vendor/grammars/JSyntax"]
path = vendor/grammars/JSyntax
url = https://github.com/bcj/JSyntax
[submodule "vendor/grammars/TXL"]
path = vendor/grammars/TXL
url = https://github.com/MikeHoffert/Sublime-Text-TXL-syntax
[submodule "vendor/grammars/G-Code"]
path = vendor/grammars/G-Code
url = https://github.com/robotmaster/sublime-text-syntax-highlighting
[submodule "vendor/grammars/grace-tmbundle"]
path = vendor/grammars/grace-tmbundle
url = https://github.com/zmthy/grace-tmbundle
[submodule "vendor/grammars/sublime-text-ox"]
path = vendor/grammars/sublime-text-ox
url = https://github.com/andreashetland/sublime-text-ox
[submodule "vendor/grammars/AutoHotkey"]
path = vendor/grammars/AutoHotkey
url = https://github.com/ahkscript/SublimeAutoHotkey
[submodule "vendor/grammars/ec.tmbundle"]
path = vendor/grammars/ec.tmbundle
url = https://github.com/ecere/ec.tmbundle
[submodule "vendor/grammars/InnoSetup"]
path = vendor/grammars/InnoSetup
url = https://github.com/idleberg/InnoSetup-Sublime-Text
[submodule "vendor/grammars/gap-tmbundle"]
path = vendor/grammars/gap-tmbundle
url = https://github.com/dhowden/gap-tmbundle
[submodule "vendor/grammars/SublimePapyrus"]
path = vendor/grammars/SublimePapyrus
url = https://github.com/Kapiainen/SublimePapyrus
[submodule "vendor/grammars/sublime-spintools"]
path = vendor/grammars/sublime-spintools
url = https://github.com/bitbased/sublime-spintools
[submodule "vendor/grammars/PogoScript.tmbundle"]
path = vendor/grammars/PogoScript.tmbundle
url = https://github.com/featurist/PogoScript.tmbundle
[submodule "vendor/grammars/sublime-opal"]
path = vendor/grammars/sublime-opal
url = https://github.com/artifactz/sublime-opal
[submodule "vendor/grammars/mediawiki.tmbundle"]
path = vendor/grammars/mediawiki.tmbundle
url = https://github.com/textmate/mediawiki.tmbundle
[submodule "vendor/grammars/SublimeClarion"]
path = vendor/grammars/SublimeClarion
url = https://github.com/fushnisoft/SublimeClarion
[submodule "vendor/grammars/oracle.tmbundle"]
path = vendor/grammars/oracle.tmbundle
url = https://github.com/mulander/oracle.tmbundle.git
[submodule "vendor/grammars/BrightScript.tmbundle"]
path = vendor/grammars/BrightScript.tmbundle
url = https://github.com/cmink/BrightScript.tmbundle
[submodule "vendor/grammars/Stylus"]
path = vendor/grammars/Stylus
url = https://github.com/billymoon/Stylus
[submodule "vendor/grammars/asciidoc.tmbundle"]
path = vendor/grammars/asciidoc.tmbundle
url = https://github.com/zuckschwerdt/asciidoc.tmbundle
[submodule "vendor/grammars/sublime-text-pig-latin"]
path = vendor/grammars/sublime-text-pig-latin
url = https://github.com/goblindegook/sublime-text-pig-latin
[submodule "vendor/grammars/Lean.tmbundle"]
path = vendor/grammars/Lean.tmbundle
url = https://github.com/leanprover/Lean.tmbundle
[submodule "vendor/grammars/ampl"]
path = vendor/grammars/ampl
url = https://github.com/ampl/sublime-ampl
[submodule "vendor/grammars/openscad.tmbundle"]
path = vendor/grammars/openscad.tmbundle
url = https://github.com/tbuser/openscad.tmbundle
[submodule "vendor/grammars/sublime-varnish"]
path = vendor/grammars/sublime-varnish
url = https://github.com/brandonwamboldt/sublime-varnish
[submodule "vendor/grammars/xc.tmbundle"]
path = vendor/grammars/xc.tmbundle
url = https://github.com/graymalkin/xc.tmbundle
[submodule "vendor/grammars/perl.tmbundle"]
path = vendor/grammars/perl.tmbundle
url = https://github.com/textmate/perl.tmbundle
[submodule "vendor/grammars/sublime-netlinx"]
path = vendor/grammars/sublime-netlinx
url = https://github.com/amclain/sublime-netlinx
[submodule "vendor/grammars/Sublime-Red"]
path = vendor/grammars/Sublime-Red
url = https://github.com/Oldes/Sublime-Red
[submodule "vendor/grammars/jflex.tmbundle"]
path = vendor/grammars/jflex.tmbundle
url = https://github.com/jflex-de/jflex.tmbundle.git
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sudo: false
before_install: script/travis/before_install
rvm:
- 1.9.3
Expand Down
84 changes: 62 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,81 @@
## Contributing
# Contributing

The majority of contributions won't need to touch any Ruby code at all. The [master language list][languages] is just a YAML configuration file.
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. The majority of contributions won't need to touch any Ruby code at all.

Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`][samples] in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions.
## Adding a language

### My code is detected as the wrong language
We try only to add languages once they have some usage on GitHub. In most cases we prefer that languages be in use in hundreds of repositories before supporting them in Linguist.

This can usually be solved either by adding a new filename or file name extension to the language's entry in [`languages.yml`][languages] or adding more [samples][samples] for your language to the repository to make Linguist's classifier smarter.

### Syntax highlighting looks wrong

Assuming your code is being detected as the right language (see above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report.

You can also try to fix the bug yourself and submit a Pull Request. [This piece from TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. You can test grammars using [Lightshow](https://lightshow.githubapp.com).

Once the bug has been fixed upstream, please let us know and we'll pick it up for GitHub.

### I want to add support for the `X` programming language

Great! You'll need to:
To add support for a new language:

0. Add an entry for your language to [`languages.yml`][languages].
0. Add a grammar for your language. Please only add grammars that have a license that permits redistribution.
0. Add your grammar as a submodule: `git submodule add https://github.com/JaneSmith/MyGrammar vendor/grammars/MyGrammar`.
0. Add your grammar to [`grammars.yml`][grammars] by running `script/convert-grammars --add vendor/grammars/MyGrammar`.
0. Add samples for your language to the [samples directory][samples].
0. Add your grammar as a submodule: `git submodule add https://github.com/JaneSmith/MyGrammar vendor/grammars/MyGrammar`.
0. Add your grammar to [`grammars.yml`][grammars] by running `script/convert-grammars --add vendor/grammars/MyGrammar`.
0. Add samples for your language to the [samples directory][samples] in the correct subdirectory.
0. Open a pull request, linking to a [GitHub search result](https://github.com/search?utf8=%E2%9C%93&q=extension%3Aboot+NOT+nothack&type=Code&ref=searchresults) showing in-the-wild usage.

In addition, if your new language defines an extension that's already listed in [`languages.yml`][languages] (such as `.foo`) then sometimes a few more steps will need to be taken:

0. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`.
0. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`.
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping @arfon or @bkeepers to help with this) to ensure we're not misclassifying files.
0. If the Bayesian classifier does a bad job with the sample `.foo` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.

Remember, the goal here is to try and avoid false positives!

We try only to add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request. In most cases we prefer that languages already be in use in hundreds of repositories before supporting them in Linguist.
## Fixing a misclassified language

Most languages are detected by their file extension defined in [languages.yml][languages]. For disambiguating between files with common extensions, linguist applies some [heuristics](/lib/linguist/heuristics.rb) and a [statistical classifier](lib/linguist/classifier.rb). This process can help differentiate between, for example, `.h` files which could be either C, C++, or Obj-C.

Misclassifications can often be solved by either adding a new filename or extension for the language or adding more [samples][samples] to make the classifier smarter.

## Fixing syntax highlighting

Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. Every language in [languages.yml][languages] is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting.

Assuming your code is being detected as the right language, in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report.

You can also try to fix the bug yourself and submit a Pull Request. [TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. You can test grammars using [Lightshow](https://github-lightshow.herokuapp.com).

Once the bug has been fixed upstream, we'll pick it up for GitHub in the next release of Linguist.

## Testing

For development you are going to want to checkout out the source. To get it, clone the repo and run [Bundler](http://gembundler.com/) to install its dependencies.

git clone https://github.com/github/linguist.git
cd linguist/
script/bootstrap

To run the tests:

bundle exec rake test

Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away.

Here's our current build status: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist)

## Releasing

If you are the current maintainer of this gem:

0. Create a branch for the release: `git checkout -b cut-release-vxx.xx.xx`
0. Make sure your local dependencies are up to date: `script/bootstrap`
0. If grammar submodules have not been updated recently, update them: `git submodule update --remote && git commit -a`
0. Ensure that samples are updated: `bundle exec rake samples`
0. Ensure that tests are green: `bundle exec rake test`
0. Bump gem version in `lib/linguist/version.rb`, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985).
0. Make a PR to github/linguist, [like this](https://github.com/github/linguist/pull/1238).
0. Build a local gem: `bundle exec rake build_gem`
0. Test the gem:
0. Bump the Gemfile and Gemfile.lock versions for an app which relies on this gem
0. Install the new gem locally
0. Test behavior locally, branch deploy, whatever needs to happen
0. Merge github/linguist PR
0. Tag and push: `git tag vx.xx.xx; git push --tags`
0. Push to rubygems.org -- `gem push github-linguist-3.0.0.gem`

[grammars]: /grammars.yml
[languages]: /lib/linguist/languages.yml
[samples]: /samples
[new-issue]: https://github.com/github/linguist/issues/new
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011-2014 GitHub, Inc.
Copyright (c) 2011-2015 GitHub, Inc.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
Loading

0 comments on commit 6b2bb52

Please sign in to comment.