How to add files to be recognised

Searchcode Server includes a database which can be modified to identify file types by extension or by explicit file name. The file is ./include/classifier/database.json and must be a valid JSON file.

The fields that are used are the following,

language
Friendly name for the matched type. This is what will be displayed through the search interface.
extensions
Array of extensions to use for matching. Files with no period in the name will have the whole name treated as the extension. Always use lower case.
keywords
Array of common keywords for the language. If an extension matches multiple language types a count of which keywords are most common in each file are used to determine which language it is. Always use lower case.

To add an explicit file name matcher you could add following entry to the file.


{
    "language": "Jenkins Buildfile",
    "extensions": [
      "jenkinsfile"
    ],
    "keywords": []
}

which would mark any file named "jenkinsfile" ignoring case as being of the language/type "Jenkins File".

To mark files by extension you could use an entry like the following.


{
    "language": "HTML",
    "extensions": [
      "htm",
      "html"
    ],
    "keywords": ["nbsp", "class", "span", "font", "href", "html", "name", "title", "the", "bgcolor"]
}

Which could mark any file with the extension of html or html as being HTML.

Productivity through code search.

Try searchcode server for Free