ignore .gitignore

This commit is contained in:
Waylon Walker 2023-03-13 10:08:14 -05:00
parent 72672d6709
commit 6950680ee9
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
3 changed files with 15 additions and 5 deletions

3
.gitignore vendored
View file

@ -496,6 +496,9 @@ poetry.toml
# ruff # ruff
.ruff_cache/ .ruff_cache/
# LSP config files
pyrightconfig.json
### SublimeText ### ### SublimeText ###
# Cache files for Sublime Text # Cache files for Sublime Text
*.tmlanguage.cache *.tmlanguage.cache

View file

@ -1,6 +1,7 @@
from pathlib import Path from pathlib import Path
import more_itertools import more_itertools
import pathspec
import typer import typer
from pyflybygen.cli.common import verbose_callback from pyflybygen.cli.common import verbose_callback
@ -49,9 +50,14 @@ def main(
help="show the log messages", help="show the log messages",
), ),
) -> None: ) -> None:
imports = more_itertools.flatten(
[get_imports(p.read_text()) for p in Path(".").glob("**/*.py")] lines = []
) if Path(".gitignore").exists():
lines.extend(Path(".gitignore").read_text().splitlines())
spec = pathspec.PathSpec.from_lines("gitwildmatch", lines)
files = Path(".").glob("**/*.py")
files = [file for file in files if not spec.match_file(str(file))]
imports = more_itertools.flatten([get_imports(p.read_text()) for p in files])
print("\n".join(set(imports))) print("\n".join(set(imports)))

View file

@ -30,8 +30,7 @@ dependencies = [
"anyconfig", "anyconfig",
"tree_sitter_languages", "tree_sitter_languages",
'more_itertools', 'more_itertools',
'coverage', 'pathspec',
'coverage-rich',
] ]
dynamic = ["version"] dynamic = ["version"]
@ -58,6 +57,8 @@ dependencies = [
"pytest-rich", "pytest-rich",
"ruff", "ruff",
"black", "black",
'coverage',
'coverage-rich',
] ]
[tool.hatch.envs.default.scripts] [tool.hatch.envs.default.scripts]
test = "coverage run -m pytest" test = "coverage run -m pytest"