Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: double-quote-string-fixer

- repo: https://github.com/pycqa/isort
rev: 5.11.5
rev: 8.0.1
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 7.3.0
hooks:
- id: flake8

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 26.3.1
hooks:
- id: black
args: ["--skip-string-normalization"]
Expand All @@ -33,7 +33,7 @@ repos:
additional_dependencies: ["types-PyYAML"]

- repo: https://github.com/espressif/check-copyright/
rev: v1.0.1
rev: v1.1.2
hooks:
- id: check-copyright
args: ['--config', '.copyright-config.yaml']
12 changes: 4 additions & 8 deletions sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,29 @@ def main():
formatter.set_options('--style=mozilla --mode=c')

# Original source to format
source = textwrap.dedent(
'''
source = textwrap.dedent('''
int main(int argc, char** argv) {
if (argc == 0) {
return 1;
}
return 0;
}
'''
).strip()
''').strip()

# Format!
result: str = formatter.format(source)
print(result)

# This should be the result
expected = textwrap.dedent(
'''
expected = textwrap.dedent('''
int main(int argc, char** argv)
{
if (argc == 0) {
return 1;
}
return 0;
}
'''
).strip()
''').strip()
assert result == expected


Expand Down
6 changes: 2 additions & 4 deletions test/test_files_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def test_iter_rules(tmp_path: pathlib.Path):
all_files = sorted(str(p.relative_to(base)) for p in tmp_path.glob('**/*.c'))
assert len(all_files) == 4

rules_str = textwrap.dedent(
"""
rules_str = textwrap.dedent("""
DEFAULT:
options: "--opt1 --opt2=foo"
check: true
Expand All @@ -98,8 +97,7 @@ def test_iter_rules(tmp_path: pathlib.Path):
include:
- "/**/sub2/"
options: "--opt7 --opt8=ffs"
"""
)
""")
rules_file = tmp_path / 'rules'
rules_file.write_text(rules_str)

Expand Down