Skip to content

Commit

Permalink
make generated config files more lintable
Browse files Browse the repository at this point in the history
c, load_config are injected into the file namespace,
but linters don't know that

avoids `c is undefined` errors on every config line

uses `# noqa` to avoid lint on the `c = load_config()`  line itself
  • Loading branch information
minrk committed Jun 17, 2022
1 parent c329e11 commit fc38bf4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions traitlets/config/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ def generate_config_file(self, classes=None):
"""generate default config file from Configurables"""
lines = ["# Configuration file for %s." % self.name]
lines.append("")
lines.append("c = get_config() # noqa")
lines.append("")
classes = self.classes if classes is None else classes
config_classes = list(self._classes_with_config_traits(classes))
for cls in config_classes:
Expand Down

0 comments on commit fc38bf4

Please sign in to comment.