Permalink
Browse files

InfoMapping: Add mappings for editorconfig

Adds mappings for Info classes to setting names for
the information kinds extracted by  ``EditorconfigInfoExtractor``.
These mappings will be used to autofill the setting values while
generating sections with quickstart.

Related to #131
  • Loading branch information...
satwikkansal committed Jul 13, 2017
1 parent 1950044 commit 54629969935a522f8dadcafee2443d02e2ac420f
Showing with 40 additions and 0 deletions.
  1. +40 −0 coala_quickstart/generation/InfoMapping.py
@@ -0,0 +1,40 @@
from coala_quickstart.info_extraction.InfoScope import InfoScope
from coala_quickstart.info_extraction.Information import (
IndentStyleInfo, IndentSizeInfo, TrailingWhitespaceInfo, FinalNewlineInfo)
INFO_SETTING_MAPS = {
"use_spaces": [
{
"scope": InfoScope(
level="global",
allowed_sources=[".editorconfig"]),
"info_kind": IndentStyleInfo,
"mapper_function": (
lambda x: "True" if x.value == "space" else "False")
}],
"indent_size": [
{
"scope": InfoScope(
level="global",
allowed_sources=[".editorconfig"]),
"info_kind": IndentSizeInfo,
"mapper_function": lambda x: x.value
}],
"allow_trailing_whitespace": [
{
"scope": InfoScope(
level="global",
allowed_sources=[".editorconfig"]),
"info_kind": TrailingWhitespaceInfo,
"mapper_function": lambda x: str(x.value)
}],
"enforce_newline_at_EOF": [
{
"scope": InfoScope(
level="global",
allowed_sources=[".editorconfig"]),
"info_kind": FinalNewlineInfo,
"mapper_function": lambda x: str(x.value)
}],
}

0 comments on commit 5462996

Please sign in to comment.