mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Merge remote-tracking branch 'refs/remotes/github/master'
Conflicts: .gitmodules grammars.yml
This commit is contained in:
48
samples/HTML+Django/nunjucks.njk
Normal file
48
samples/HTML+Django/nunjucks.njk
Normal file
@@ -0,0 +1,48 @@
|
||||
{% from "forms.html" import label as description %}
|
||||
|
||||
|
||||
{% macro field(name, value='', type='text') %}
|
||||
<div class="field">
|
||||
<input type="{{ type }}" name="{{ name }}"
|
||||
value="{{ value | escape }}" />
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
<html>
|
||||
<head>
|
||||
{% extends "head.html" %}
|
||||
</head>
|
||||
<body>
|
||||
{% if horse %}
|
||||
Chuck Norris once kicked a horse in the chin. Its descendants are known today as Giraffes.
|
||||
{% elif optimus %}
|
||||
Chuck Norris once urinated in a semi truck's gas tank as a joke....that truck is now known as Optimus Prime.
|
||||
{% else %}
|
||||
Chuck Norris threw a grenade and killed 50 people, then the grenade exploded.
|
||||
{% endif %}
|
||||
|
||||
{% block left %}
|
||||
This is the left side!
|
||||
{% endblock %}
|
||||
|
||||
{% block right %}
|
||||
This is the right side!
|
||||
{% endblock %}
|
||||
|
||||
{{ description('Username') }}
|
||||
{{ field('user') }}
|
||||
{{ field('pass', type='password') }}
|
||||
|
||||
<h1>Posts</h1>
|
||||
<ul>
|
||||
{% for item in items %}
|
||||
<li>{{ item.title }}</li>
|
||||
{% else %}
|
||||
<li>This would display if the 'item' collection were empty</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{# Don't escape foo #}
|
||||
{{ foo | safe }}
|
||||
</body>
|
||||
</html>
|
||||
6
samples/JSON5/filenames/.babelrc
Normal file
6
samples/JSON5/filenames/.babelrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"presets": [
|
||||
"es2015",
|
||||
"es2016"
|
||||
]
|
||||
}
|
||||
93
samples/PHP/ThriftGenerated.php
Normal file
93
samples/PHP/ThriftGenerated.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
namespace github\com;
|
||||
|
||||
/**
|
||||
* Autogenerated by Thrift Compiler (0.9.3)
|
||||
*
|
||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
* @generated
|
||||
*/
|
||||
use Thrift\Base\TBase;
|
||||
use Thrift\Type\TType;
|
||||
use Thrift\Type\TMessageType;
|
||||
use Thrift\Exception\TException;
|
||||
use Thrift\Exception\TProtocolException;
|
||||
use Thrift\Protocol\TProtocol;
|
||||
use Thrift\Protocol\TBinaryProtocolAccelerated;
|
||||
use Thrift\Exception\TApplicationException;
|
||||
|
||||
|
||||
class PullRequest {
|
||||
static $_TSPEC;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $title = null;
|
||||
|
||||
public function __construct($vals=null) {
|
||||
if (!isset(self::$_TSPEC)) {
|
||||
self::$_TSPEC = array(
|
||||
1 => array(
|
||||
'var' => 'title',
|
||||
'type' => TType::STRING,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (is_array($vals)) {
|
||||
if (isset($vals['title'])) {
|
||||
$this->title = $vals['title'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return 'PullRequest';
|
||||
}
|
||||
|
||||
public function read($input)
|
||||
{
|
||||
$xfer = 0;
|
||||
$fname = null;
|
||||
$ftype = 0;
|
||||
$fid = 0;
|
||||
$xfer += $input->readStructBegin($fname);
|
||||
while (true)
|
||||
{
|
||||
$xfer += $input->readFieldBegin($fname, $ftype, $fid);
|
||||
if ($ftype == TType::STOP) {
|
||||
break;
|
||||
}
|
||||
switch ($fid)
|
||||
{
|
||||
case 1:
|
||||
if ($ftype == TType::STRING) {
|
||||
$xfer += $input->readString($this->title);
|
||||
} else {
|
||||
$xfer += $input->skip($ftype);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$xfer += $input->skip($ftype);
|
||||
break;
|
||||
}
|
||||
$xfer += $input->readFieldEnd();
|
||||
}
|
||||
$xfer += $input->readStructEnd();
|
||||
return $xfer;
|
||||
}
|
||||
|
||||
public function write($output) {
|
||||
$xfer = 0;
|
||||
$xfer += $output->writeStructBegin('PullRequest');
|
||||
if ($this->title !== null) {
|
||||
$xfer += $output->writeFieldBegin('title', TType::STRING, 1);
|
||||
$xfer += $output->writeString($this->title);
|
||||
$xfer += $output->writeFieldEnd();
|
||||
}
|
||||
$xfer += $output->writeFieldStop();
|
||||
$xfer += $output->writeStructEnd();
|
||||
return $xfer;
|
||||
}
|
||||
|
||||
}
|
||||
75
samples/Ruby/filenames/Dangerfile
Normal file
75
samples/Ruby/filenames/Dangerfile
Normal file
@@ -0,0 +1,75 @@
|
||||
# Sometimes its a README fix, or something like that - which isn't relevant for
|
||||
# including in a CHANGELOG for example
|
||||
# From https://github.com/danger/danger/blob/master/Dangerfile
|
||||
|
||||
has_app_changes = !git.modified_files.grep(/lib/).empty?
|
||||
has_test_changes = !git.modified_files.grep(/spec/).empty?
|
||||
is_version_bump = git.modified_files.sort == ["CHANGELOG.md", "lib/danger/version.rb"].sort
|
||||
|
||||
if has_app_changes && !has_test_changes && !is_version_bump
|
||||
warn("Tests were not updated", sticky: false)
|
||||
end
|
||||
|
||||
# Thanks other people!
|
||||
message(":tada:") if is_version_bump && github.pr_author != "orta"
|
||||
|
||||
# Make a note about contributors not in the organization
|
||||
unless github.api.organization_member?('danger', github.pr_author)
|
||||
message "@#{github.pr_author} is not a contributor yet, would you like to join the Danger org?"
|
||||
|
||||
# Pay extra attention if they modify the gemspec
|
||||
if git.modified_files.include?("*.gemspec")
|
||||
warn "External contributor has edited the Gemspec"
|
||||
end
|
||||
end
|
||||
|
||||
# Mainly to encourage writing up some reasoning about the PR, rather than
|
||||
# just leaving a title
|
||||
if github.pr_body.length < 5
|
||||
fail "Please provide a summary in the Pull Request description"
|
||||
end
|
||||
|
||||
# Let people say that this isn't worth a CHANGELOG entry in the PR if they choose
|
||||
declared_trivial = (github.pr_title + github.pr_body).include?("#trivial") || !has_app_changes
|
||||
|
||||
if !git.modified_files.include?("CHANGELOG.md") && !declared_trivial
|
||||
fail("Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/danger/danger/blob/master/CHANGELOG.md).", sticky: false)
|
||||
end
|
||||
|
||||
# Docs are critical, so let's re-run the docs part of the specs and show any issues:
|
||||
core_plugins_docs = `bundle exec danger plugins lint lib/danger/danger_core/plugins/*.rb --warnings-as-errors`
|
||||
|
||||
# If it failed, fail the build, and include markdown with the output error.
|
||||
unless $?.success?
|
||||
# We want to strip ANSI colors for our markdown, and make paths relative
|
||||
colourless_error = core_plugins_docs.gsub(/\e\[(\d+)(;\d+)*m/, "")
|
||||
markdown("### Core Docs Errors \n\n#{colourless_error}")
|
||||
fail("Failing due to documentation issues, see below.", sticky: false)
|
||||
end
|
||||
|
||||
# Oddly enough, it's quite possible to do some testing of Danger, inside Danger
|
||||
# So, you can ignore these, if you're looking at the Dangerfile to get ideas.
|
||||
#
|
||||
# If these are all empty something has gone wrong, better to raise it in a comment
|
||||
if git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty?
|
||||
fail "This PR has no changes at all, this is likely an issue during development."
|
||||
end
|
||||
|
||||
# This comes from `./danger_plugins/protect_files.rb` which is automatically parsed by Danger
|
||||
files.protect_files(path: "danger.gemspec", message: ".gemspec modified", fail_build: false)
|
||||
|
||||
# Ensure that our core plugins all have 100% documentation
|
||||
core_plugins = Dir.glob("lib/danger/danger_core/plugins/*.rb")
|
||||
core_lint_output = `bundle exec yard stats #{core_plugins.join ' '} --list-undoc --tag tags`
|
||||
|
||||
if !core_lint_output.include?("100.00%")
|
||||
fail "The core plugins are not at 100% doc'd - see below:", sticky: false
|
||||
markdown "```\n#{core_lint_output}```"
|
||||
elsif core_lint_output.include? "warning"
|
||||
warn "The core plugins are have yard warnings - see below", sticky: false
|
||||
markdown "```\n#{core_lint_output}```"
|
||||
end
|
||||
|
||||
junit.parse "junit-results.xml"
|
||||
junit.headers = [:file, :name]
|
||||
junit.report
|
||||
Reference in New Issue
Block a user