# Buggy code
def __init__(self, configs=None, overrides=None):
    self._overrides = overrides  # We only store this for child configs
    defaults = ConfigLoader.get_global().load_default_config_file()
    self._configs = nested_combine(
        defaults, configs or {"core": {}}, {"core": overrides or {}}
    )
    # Some configs require special treatment
    self._configs["core"]["color"] = False if self._configs["core"]["nocolor"] else None
    # Whitelists and blacklists
    if self._configs["core"]["rules"]:
        self._configs["core"]["rule_whitelist"] = self._configs["core"]["rules"].split(
            ","
        )
    else:
        self._configs["core"]["rule_whitelist"] = None
    if self._configs["core"]["exclude_rules"]:
        self._configs["core"]["rule_blacklist"] = self._configs["core"][
            "exclude_rules"
        ].split(",")
    else:
        self._configs["core"]["rule_blacklist"] = None
    # Configure Recursion
    if self._configs["core"]["recurse"] == 0:
        self._configs["core"]["recurse"] = True
    # Dialect and Template selection
    self._configs["core"]["dialect_obj"] = dialect_selector(
        self._configs["core"]["dialect"]
    )
    self._configs["core"]["templater_obj"] = templater_selector(
        self._configs["core"]["templater"]
    )


# Traceback (KeyError)
$ sqlfluff version
Traceback (most recent call last):
File "/usr/local/pyenv/versions/3.7.3/bin/sqlfluff", line 11, in <module>
load_entry_point('sqlfluff==0.2.1', 'console_scripts', 'sqlfluff')()
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/sqlfluff/cli/commands.py", line 82, in version
c = get_config(**kwargs)
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/sqlfluff/cli/commands.py", line 55, in get_config
return FluffConfig.from_root(overrides=overrides)
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/sqlfluff/config.py", line 283, in from_root
return cls(configs=c, overrides=overrides)
File "/usr/local/pyenv/versions/3.7.3/lib/python3.7/site-packages/sqlfluff/config.py", line 263, in __init__
if self._configs['core']['rules']:
KeyError: 'rules'

# Fixed code
def __init__(self, configs=None, overrides=None):
    self._overrides = overrides  # We only store this for child configs
    defaults = ConfigLoader.get_global().load_default_config_file()
    self._configs = nested_combine(
        defaults, configs or {"core": {}}, {"core": overrides or {}}
    )
    # Some configs require special treatment
    self._configs["core"]["color"] = (
        False if self._configs["core"].get("nocolor", False) else None
    )
    # Whitelists and blacklists
    if self._configs["core"].get("rules", None):
        self._configs["core"]["rule_whitelist"] = self._configs["core"]["rules"].split(
            ","
        )
    else:
        self._configs["core"]["rule_whitelist"] = None
    if self._configs["core"].get("exclude_rules", None):
        self._configs["core"]["rule_blacklist"] = self._configs["core"][
            "exclude_rules"
        ].split(",")
    else:
        self._configs["core"]["rule_blacklist"] = None
    # Configure Recursion
    if self._configs["core"].get("recurse", 0) == 0:
        self._configs["core"]["recurse"] = True
    # Dialect and Template selection
    self._configs["core"]["dialect_obj"] = dialect_selector(
        self._configs["core"]["dialect"]
    )
    self._configs["core"]["templater_obj"] = templater_selector(
        self._configs["core"]["templater"]
    )