Skip to content
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

[1.8.0 and above] prospector failed to lint on a specific python file #667

Open
peterzhuamazon opened this issue Sep 6, 2024 · 2 comments

Comments

@peterzhuamazon
Copy link

peterzhuamazon commented Sep 6, 2024

When using prospector 1.7.0 and lint this file:
https://github.com/opensearch-project/opensearch-build/blob/76a1313c10ecfeb3ee628605ef09cd5c8c526e1a/tests/tests_report_workflow/test_test_report_runner.py

The lint is successful with several issues reported:

prospector --profile ~/.prospector.yaml ./test_report_runner.py
Check Information
=================
         Started: 2024-09-06 19:20:31.653364
        Finished: 2024-09-06 19:20:33.568268
      Time Taken: 1.91 seconds
       Formatter: grouped
        Profiles: ~/.prospector.yaml, no_doc_warnings, no_test_warnings, strictness_high, strictness_veryhigh, no_member_warnings
      Strictness: from profile
  Libraries Used:
       Tools Run: dodgy, mccabe, mypy, profile-validator, pycodestyle, pyflakes, pylint
  Messages Found: 30

However, ever since 1.8.0 version this particular file cannot be lint:

prospector --profile ~/.prospector.yaml ./test_report_runner.py
Check Information
=================
         Started: 2024-09-06 19:20:17.020712
        Finished: 2024-09-06 19:20:17.128526
      Time Taken: 0.11 seconds
       Formatter: grouped
        Profiles: ~/.prospector.yaml, no_doc_warnings, no_test_warnings, strictness_high, strictness_veryhigh, no_member_warnings
      Strictness: from profile
  Libraries Used:
       Tools Run: dodgy, mccabe, mypy, profile-validator, pycodestyle, pyflakes, pylint
  Messages Found: 0

I am so confused of why this is happening, you can clone the repo with that commit I listed above, and try to run the prospector command. Everything seems fail and only pyright (if you enable) would act normally.

Here is profile:


strictness: high
doc-warnings: false
test-warnings: false
autodetect: true
member-warnings: false

pylint:
  disable:
    - W1203
    - W4902
    - R0914
    - C0301
    - C0103
    - W1514

pycodestyle:
  disable:
    - E501

mypy:
  run: true

Thanks.

@lucasarruda-ciandt
Copy link

I'm on 1.12.0 and the same issue is happening here. It seems all my test files are being ignored (it was not before though). Already tried --test-warnings, no success.

@sbrunner
Copy link
Member

sbrunner commented Nov 9, 2024

I just tested and I got the following result:

************* Module src.report_workflow.test_report_runner
src/report_workflow/test_report_runner.py:15: [import-error(pylint), None] Unable to import 'validators'
src/report_workflow/test_report_runner.py:24: [too-many-instance-attributes(pylint), TestReportRunner] Too many instance attributes (15/7)
src/report_workflow/test_report_runner.py:90: [unnecessary-comprehension(pylint), TestReportRunner.component_entry] Unnecessary use of a comprehension, use list(test_component.__to_dict__().get(self.test_type)['test-configs']) instead.
src/report_workflow/test_report_runner.py:145: [no-else-return(pylint), generate_component_yml_ref] Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
src/report_workflow/test_report_runner.py:161: [too-many-arguments(pylint), get_os_cluster_logs] Too many arguments (6/5)
src/report_workflow/test_report_runner.py:161: [too-many-positional-arguments(pylint), get_os_cluster_logs] Too many positional arguments (6/5)
************* Module src.manifests.manifest
src/manifests/manifest.py:15: [error(mypy), None] Library stubs not installed for "yaml"  [import-untyped]
************* Module src.report_workflow.test_report_runner
src/report_workflow/test_report_runner.py:16: [error(mypy), None] Library stubs not installed for "yaml"  [import-untyped]
src/report_workflow/test_report_runner.py:16: [note(mypy), None] Hint: "python3 -m pip install types-PyYAML"
src/report_workflow/test_report_runner.py:16: [note(mypy), None] (or run "mypy --install-types" to install all missing stub packages)
src/report_workflow/test_report_runner.py:16: [note(mypy), None] See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

Then I don't understand this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants