Skip to content

Commit

Permalink
.coafile: Check yaml files and templates
Browse files Browse the repository at this point in the history
This entrypoint adds a .coafile for .yaml
and .jinja2 files.

Closes coala#33
  • Loading branch information
RazvanMitrica committed Nov 5, 2018
1 parent 46d4890 commit be07671
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 99 deletions.
16 changes: 16 additions & 0 deletions .coafile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Default]

[autopep8]
bears = PEP8Bear, PycodestyleBear
pycodestyle_ignore = E121, E123, E126, E226, E704,
W503, W504

default_actions = PEP8Bear: ApplyPatchAction

[jinja2]
bears = Jinja2Bear
files = **.jinja2, **.jj2

[yaml]
bears = YAMLLintBear
files = *.yml, **/*.yaml
159 changes: 80 additions & 79 deletions data/Language/CSharp.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
identifier: CSharp
full_name: C#
wikidata: Q2370
grammar_file: https://github.com/antlr/grammars-v4/tree/master/csharp/CSharpParser.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/csharp/
CSharpParser.g4
aliases:
- C Sharp
- CS
Expand All @@ -18,81 +19,81 @@ delimiters:
- verbatim
- curly_braces
keywords:
- abstract
- as
- base
- bool
- break
- byte
- case
- catch
- char
- checked
- class
- const
- continue
- decimal
- default
- delegate
- do
- double
- else
- enum
- event
- explicit
- extern
- false
- finally
- fixed
- float
- for
- foreach
- goto
- if
- implicit
- in
- int
- interface
- internal
- is
- lock
- long
- namespace
- new
- 'null'
- object
- operator
- out
- override
- params
- private
- protected
- public
- readonly
- ref
- return
- sbyte
- sealed
- short
- sizeof
- stackalloc
- static
- string
- struct
- switch
- this
- throw
- true
- try
- typeof
- uint
- ulong
- unchecked
- unsafe
- ushort
- using
- using static
- virtual
- void
- volatile
- while
- abstract
- as
- base
- bool
- break
- byte
- case
- catch
- char
- checked
- class
- const
- continue
- decimal
- default
- delegate
- do
- double
- else
- enum
- event
- explicit
- extern
- false
- finally
- fixed
- float
- for
- foreach
- goto
- if
- implicit
- in
- int
- interface
- internal
- is
- lock
- long
- namespace
- new
- 'null'
- object
- operator
- out
- override
- params
- private
- protected
- public
- readonly
- ref
- return
- sbyte
- sealed
- short
- sizeof
- stackalloc
- static
- string
- struct
- switch
- this
- throw
- true
- try
- typeof
- uint
- ulong
- unchecked
- unsafe
- ushort
- using
- using static
- virtual
- void
- volatile
- while
2 changes: 1 addition & 1 deletion data/Language/JSON.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ identifier: JSON
wikidata: Q2063
full_name: JavaScript Object Notation
grammar_file: https://github.com/antlr/grammars-v4/tree/master/json/JSON.g4
extensions:
extensions:
- json
aliases:
- json
Expand Down
4 changes: 2 additions & 2 deletions data/Language/Java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ full_name: Java
grammar_file: https://github.com/antlr/grammars-v4/blob/master/java8/Java8.g4
aliases:
- java
extensions:
extensions:
- java
delimiters:
# comment delimters:
- double_slash
- multiline_slash_star
# string delimiters:
- double_quote_slash_escape
- double_quote_slash_escape
datatypes:
- boolean_java
- byte_java
Expand Down
3 changes: 2 additions & 1 deletion data/Language/JavaScript.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
identifier: JavaScript
wikidata: Q2005
grammar_file: https://github.com/antlr/grammars-v4/tree/master/javascript/JavaScriptParser.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/javascript/
JavaScriptParser.g4
aliases:
- js
- ecmascript
Expand Down
3 changes: 2 additions & 1 deletion data/Language/Python.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
identifier: Python
wikidata: Q28865
versions: 2.7, 3.3, 3.4, 3.5, 3.6
grammar_file: https://github.com/antlr/grammars-v4/tree/master/python3/Python3.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/python3/
Python3.g4
aliases:
- py
extensions:
Expand Down
3 changes: 2 additions & 1 deletion data/Language/TinyBasic.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
identifier: TinyBasic
full_name: TinyBasic
wikidata: Q586622
grammar_file: https://github.com/antlr/grammars-v4/tree/master/tinybasic/tinybasic.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/tinybasic/
tinybasic.g4
aliases:
- TB
extensions:
Expand Down
4 changes: 2 additions & 2 deletions models/DataType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ keyword: String # Keyword that identifies the type i.e. int, str
integer-min: String # String representing minium integer or uncertain
integer-max: String # String represetinng maximum integer or uncertain
integer-signed: Boolean # Whether the datatype is signed integer or not
delimiters: Delimiter[] # If the datatype has any delimiters
literals: Keyword[] # List of literals for a datatype
delimiters: Delimiter[] # If the datatype has any delimiters
literals: Keyword[] # List of literals for a datatype
2 changes: 1 addition & 1 deletion templates/Language.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<tr>
<th>Grammar File</th>
<td>
<a href = {{language.grammar_file}}>
<a href = {{ language.grammar_file }}>
{{ m.show_grammar(language.grammar_file) }}
</a>
</td>
Expand Down
2 changes: 1 addition & 1 deletion templates/home.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ul class="thin-row-medium" id="languages-list">
{% for language in languages %}
<li><a href="{% url 'languages', language %}">{{ m.language_name(language) }}</a>
{% endfor %}
{% endfor %}{# for language in languages #}
</ul>
</body>
</html>
14 changes: 7 additions & 7 deletions templates/macros.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
{{ language.full_name }}
{% else %}
{{ language.identifier }}
{% endif %}
{% endif %}{# if language.full_name #}
{% endmacro %}

{% macro show_grammar(grammar_file) %}
{{grammar_file}}
{{ grammar_file }}
{% endmacro %}

{% macro show_list(list, separator=',') %}
{% for item in list %}
{{ item.pk | escape }}{% if not loop.last %}{{separator}} {% endif %}
{% endfor %}
{{ item.pk | escape }}{% if not loop.last %}{{ separator }} {% endif %}
{% endfor %}{# for item in list #}
{% endmacro %}

{% macro show_delimiter_list(delimiters, type) %}
Expand All @@ -25,9 +25,9 @@
<tt>{{ item.end | escape }}</tt>
{% else %}
(EOL)
{% endif %}
{% endif %}{# if item.end #}
</li>
{% endif %}
{% endfor %}
{% endif %}{# if item.type == type #}
{% endfor %}{# for item in delimiters #}
</ul>
{% endmacro %}
9 changes: 6 additions & 3 deletions views/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ path:
template: Language
context:
dynamic:
delimiter_type_comment: session.query(EnumDelimiterType).filter(EnumDelimiterType.name == 'comment').one()
delimiter_type_string: session.query(EnumDelimiterType).filter(EnumDelimiterType.name == 'string').one()
delimiter_type_block: session.query(EnumDelimiterType).filter(EnumDelimiterType.name == 'block').one()
delimiter_type_comment: session.query(EnumDelimiterType).filter
(EnumDelimiterType.name == 'comment').one()
delimiter_type_string: session.query(EnumDelimiterType).filter
(EnumDelimiterType.name == 'string').one()
delimiter_type_block: session.query(EnumDelimiterType).filter
(EnumDelimiterType.name == 'block').one()

0 comments on commit be07671

Please sign in to comment.