-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
submodules are only ignore if files_changed_only
is True
#76
Comments
When So the current behavior of I'm wondering if we should change |
This was not my original intention. It doesn't make sense (to me) for a linter to be concerned with external sources. That's why in the README, I noted the
I have no objections to this. I think this was the original default until we started encouraging users to have a |
I'm almost ready to draft a PR... There's a lot of changes, so the description will be wordy. I'd like to learn a bit more about pytest (& plugins) to optimize the unit tests I've written. |
I agree we should only analyze any source files and ignore submodules when No worries, take your time. I'm also learning about pytest to refactor my bad smell unit tests :( |
I might have to use a matrix in the CI to test various versions of python with various versions of clang-tools on various OSs... My new database test is failing in CI, but it passes fine locally. |
It also failed in my local environment. /home/ubuntu/.local/lib/python3.8/site-packages/requests/adapters.py:501: ConnectionError
--------------------------------------------- Captured log call ---------------------------------------------
WARNING CPP Linter:run.py:340 Could not find pcsound/pcsound.c! Did you checkout the repo?
========================================== short test summary info ==========================================
FAILED tests/lines_changed_only/test_lines_changed_only.py::test_run_clang_format_diff_only - requests.exc...
FAILED tests/lines_changed_only/test_lines_changed_only.py::test_run_clang_format_diff_adds - requests.exc...
================================= 2 failed, 22 passed in 257.41s (0:04:17) ================================= It's hang and failed from tests/ignored_paths/test_ignored_paths.py::test_not_ignored PASSED [ 83%]
tests/ignored_paths/test_ignored_paths.py::test_ignore_submodule PASSED [ 87%]
tests/lines_changed_only/test_lines_changed_only.py::test_lines_changed_only PASSED [ 91%]
tests/lines_changed_only/test_lines_changed_only.py::test_run_clang_format_diff_only |
It failed locally for you because it couldn't download the source files from the commit that I'm using in the test. The test that failed for you was the lines-changed-only test. The one that failed in CI was the database test. |
I've been playing with test coverage to see what else needs to be tested. So far I'm (locally) getting 94% coverage if I exclude any functions that directly use the REST API for thread comments: I also configured coverage.py to ignore code specific to type checking and anything related to using rich as a logging extension, thus @shenxianpeng I see you've already created a codecov token for cpp-linter/clang-tools-pip. Can you create a org secret with a new codecov token, so we can use it for multiple repos? Or does the token have to specific to a project? ps - Ensuring the best coverage has caused further improvements to the code base. |
The test coverage is already very high 👍 @2bndy5 I have created a org secret with a new codecov token and also removed codecov token for cpp-linter/clang-tools-pip, then rerun the test action of clang-tools-pip, it still works. |
…ed fixes (#81) * integrate mypy type checking into CI * resolve #75 * resolve #73 * run pylint workflow on changes to workflow file - fix a few long line warnings - add rich to the py dev reqs - add types-PyYAML to dev reqs * resolve #76 normalize submodule path separators per runner's OS * add unit tests for ignored paths also make sure the current working directory is appended to the .gitmodules path * run pytest in CI - add pytest to dev reqs - rename run-pylint.yml to run-dev-tests.yml - install cpp-linter pkg in run-dev-tests.yml workflow - upgrade actions/setup-python to v2 in run-dev-tests.yml workflow - rename step in run-dev-tests.yml workflow * resolve #74 and add unit tests for it This allows the `lines-changed-only` option to accept the following values: - false: All lines in a file are analyzed - true: All lines in the diff are analyzed (including unchanged lines) - strict: Only lines in the diff that contain additions are analyzed gitignore some test resources as they are fetched running the tests. Retain original repo structure when fetching files. This is only used when the user doesn't checkout the repo being analyzed. * improve and test CLI arg parsing * add unit test for database also fix a typo in demo.hpp variable name * switch to pre-commit; run pytest in a matrix * parametrize unit tests * fix changes to dev-test yaml * make database path absolute * use pathlib to resolve() relative paths in test * let db path be independent of repo-root w/o docker * this fails locally * show me value for RUNNER_WORKSPACE * use gh workspace if not in docker env * simplify the paths' concatenation * fix assignment of `Globals.FILES` * treat unsupport events like a push * explicitly set a env var when using docker * ammend some logic * show me some contents of folders on docker * hardcode the correct worspace dir * remove unused import * try detecting the docker env better * set the docker env var w/ a str * assume that RUNNER_WORKSPACE is abs * use only relativer path to db on docker * Revert "use only relativer path to db on docker" This reverts commit 37e3083. * better test coverage * mkdocstring doesn't support `Tuple[x, x]` type see mkdocstrings/griffe/#95 * fix workflow * revert changes to `get_line_cnt_from_cols()` * upload without codecov token?? * ensure LF used on demo src * update workflow * re-implement newer `get_line_cnt_from_cols()` * switch to pyproject.toml (setup.py is a dummy now) * resolve version exe path better * ammend make_annotations() (& its tests) * adjust for pypi releases * allow running locally & fix duplicate log cmds * use pathlib.Path to open files * rely on pathlib, update pkg name & CI workflows * `is_relative_to()` introduced in python v3.9 * `lstrip(".")` from file's extension * tidy v13 use abs path to std libs in output error * build/install wheel in test CI * oops, use correct artifact name * remove identifying info from test's event payload * make files list simpler for any event * ammend walking the repo files/folders This could probably get changed to using pathlib's glob mechanism. * replace os.walk() with pathlib's rglob() * only upload coverage report once from test CI * use OS dependent path separators for DB path * resolve #82 * ensure tidy fixit_lines end w/ a LF * workflow continue only if `latest` tag was added * include v7-9 for CI tests * fix docs about `parse_ignore_option()` Also, docs show type annotations in the function signatures * fix `TidyNotification.__repr__()` * tell CI to download clang-tools v7-9 * support older versions of clang-tidy YML output * don't try to traverse a `None` obj * add common hooks to pre-commit config * add more configs to toml This removes the need for a separate .coveragerc file pytest can be executed without args based on the config in the toml * update event triggers on dev-test CI workflow * sort requirements.txt contents * split pre-commit step into its own CI workflow update version of used (external) actions * pleasing pre-commit hooks * fix run-test.yml (trailing whitespaces) * revise README & remove .ci-ignore file * add code coverage badge to README
I noticed this on a repo I'm developing that has 4 submodules. When the CI runs
All the submodules are crawled as if they're part of the current repo's original sources.
Moving the algorithm that detects submodules from
list_source_files()
intoparse_ignored_option()
should fix this, but I have to be careful to consider if the user explicitly specifies a submodule to be not ignored.The text was updated successfully, but these errors were encountered: