File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737JAVASCRIPT_PACKAGE_JSON = "package.json"
3838JMEX_NITPICK_MINIMUM_VERSION = jmespath .compile ("nitpick.minimum_version" )
3939JMEX_NITPICK_STYLES_INCLUDE = jmespath .compile ("nitpick.styles.include" )
40+ MAKEFILE = "Makefile"
4041MERGED_STYLE_TOML = "merged-style.toml"
4142NITPICK_STYLE_TOML = "nitpick-style.toml"
4243PRE_COMMIT_CONFIG_YAML = ".pre-commit-config.yaml"
6061
6162# These depend on some constants above, so they can't be sorted automatically
6263ROOT_PYTHON_FILES = ("app.py" , "wsgi.py" , "autoapp.py" , PYTHON_MANAGE_PY )
63- ROOT_FILES = (
64+ ROOT_FILES_DIRS = (
6465 # keep-sorted start
6566 * ROOT_PYTHON_FILES ,
6667 DOT_NITPICK_TOML ,
68+ GIT_DIR ,
69+ GIT_IGNORE ,
6770 GOLANG_MOD ,
6871 GOLANG_SUM ,
6972 JAVASCRIPT_PACKAGE_JSON ,
73+ MAKEFILE ,
7074 NITPICK_STYLE_TOML ,
7175 PRE_COMMIT_CONFIG_YAML ,
7276 PYTHON_PIPFILE_STAR ,
Original file line number Diff line number Diff line change 3535 PROJECT_NAME ,
3636 PYTHON_MANAGE_PY ,
3737 PYTHON_PYPROJECT_TOML ,
38- ROOT_FILES ,
38+ ROOT_FILES_DIRS ,
3939 ROOT_PYTHON_FILES ,
4040)
4141from nitpick .exceptions import QuitComplainingError
@@ -173,7 +173,7 @@ def echo(self, message: str):
173173def confirm_project_root (dir_ : PathOrStr | None = None ) -> Path :
174174 """Confirm this is the root dir of the project (the one that has one of the ``ROOT_FILES``)."""
175175 possible_root_dir = Path (dir_ or Path .cwd ()).resolve ()
176- root_files = glob_files (possible_root_dir , ROOT_FILES )
176+ root_files = glob_files (possible_root_dir , ROOT_FILES_DIRS )
177177 logger .debug (f"Root files found: { root_files } " )
178178
179179 if root_files :
Original file line number Diff line number Diff line change 88from nitpick .constants import (
99 CONFIG_RUN_NITPICK_INIT_OR_CONFIGURE_STYLE_MANUALLY ,
1010 DOT_NITPICK_TOML ,
11+ GIT_DIR ,
12+ GIT_IGNORE ,
1113 GOLANG_MOD ,
1214 GOLANG_SUM ,
1315 JAVASCRIPT_PACKAGE_JSON ,
16+ MAKEFILE ,
1417 NITPICK_STYLE_TOML ,
1518 PRE_COMMIT_CONFIG_YAML ,
1619 PYTHON_MANAGE_PY ,
@@ -195,22 +198,27 @@ def test_has_multiple_config_files(tmp_path, caplog):
195198@pytest .mark .parametrize (
196199 "root_file" ,
197200 [
198- DOT_NITPICK_TOML ,
199- PRE_COMMIT_CONFIG_YAML ,
200- PYTHON_PYPROJECT_TOML ,
201- PYTHON_SETUP_PY ,
202- PYTHON_SETUP_CFG ,
203- "requirements.txt" ,
204- "requirements_dev.txt" ,
201+ # keep-sorted start
202+ "Cargo.lock" ,
203+ "Cargo.toml" ,
205204 "Pipfile" ,
206205 "Pipfile.lock" ,
207- PYTHON_TOX_INI ,
208- JAVASCRIPT_PACKAGE_JSON ,
209- "Cargo.toml" ,
210- "Cargo.lock" ,
206+ "requirements.txt" ,
207+ "requirements_dev.txt" ,
208+ DOT_NITPICK_TOML ,
209+ GIT_DIR ,
210+ GIT_IGNORE ,
211211 GOLANG_MOD ,
212212 GOLANG_SUM ,
213+ JAVASCRIPT_PACKAGE_JSON ,
214+ MAKEFILE ,
213215 NITPICK_STYLE_TOML ,
216+ PRE_COMMIT_CONFIG_YAML ,
217+ PYTHON_PYPROJECT_TOML ,
218+ PYTHON_SETUP_CFG ,
219+ PYTHON_SETUP_PY ,
220+ PYTHON_TOX_INI ,
221+ # keep-sorted end
214222 ],
215223)
216224def test_use_current_dir_dont_climb_dirs_to_find_project_root (tmp_path , root_file ):
You can’t perform that action at this time.
0 commit comments