Skip to content

Commit

Permalink
split up pre-commit linting
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Jan 24, 2024
1 parent bd22979 commit caed6c5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
20 changes: 17 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,23 @@ repos:
- id: check-case-conflict
- repo: local
hooks:
- id: linter
name: linter
entry: hatch run lint:all
- id: black
name: black
entry: hatch run lint:black
language: system
types: [python]
pass_filenames: false
verbose: true
- id: flake8
name: flake8
entry: hatch run lint:flake8
language: system
types: [python]
pass_filenames: false
verbose: true
- id: mypy
name: mypy
entry: hatch run lint:mypy
language: system
types: [python]
pass_filenames: false
Expand Down
8 changes: 6 additions & 2 deletions dbt_common/clients/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,19 @@ def new_context(
# This custom override makes the assumption that the locals and shared
# parameters are not used, so enforce that.
if shared or locals:
raise Exception("The MacroFuzzTemplate.new_context() override cannot use the shared or locals parameters.")
raise Exception(
"The MacroFuzzTemplate.new_context() override cannot use the shared or locals parameters."
)

parent = ChainMap(vars, self.globals) if self.globals else vars

return self.environment.context_class(self.environment, parent, self.name, self.blocks)

def render(self, *args: Any, **kwargs: Any) -> Any:
if kwargs or len(args) != 1:
raise Exception("The MacroFuzzTemplate.render() override requires exactly one argument.")
raise Exception(
"The MacroFuzzTemplate.render() override requires exactly one argument."
)

ctx = self.new_context(args[0])

Expand Down

0 comments on commit caed6c5

Please sign in to comment.