Skip to content

tooling: Reduce 2 types of Pylance new warnings and more #873

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

Conversation

Aymen-Soussi-01
Copy link
Contributor

@Aymen-Soussi-01 Aymen-Soussi-01 commented Apr 8, 2025

Fix pylance warnings for reportMissingTypeArgument and reportUnusedVariable and some other warnings.

Also-by: Aymen Soussi [email protected]

Related to: #836

Fix pylance warnings for reportMissingTypeArgument and reportUnusedVariable and some other warnings.

Also-by: Aymen Soussi [email protected]
Copy link

github-actions bot commented Apr 8, 2025

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
2025/04/08 10:37:21 Downloading https://releases.bazel.build/7.4.0/release/bazel-7.4.0-linux-x86_64...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (47 packages loaded, 10 targets configured)

Analyzing: target //:license-check (91 packages loaded, 10 targets configured)

Analyzing: target //:license-check (97 packages loaded, 10 targets configured)

Analyzing: target //:license-check (99 packages loaded, 10 targets configured)

Analyzing: target //:license-check (131 packages loaded, 821 targets configured)

Analyzing: target //:license-check (138 packages loaded, 1103 targets configured)

Analyzing: target //:license-check (145 packages loaded, 2465 targets configured)

Analyzing: target //:license-check (145 packages loaded, 2465 targets configured)

Analyzing: target //:license-check (145 packages loaded, 2465 targets configured)

Analyzing: target //:license-check (148 packages loaded, 4487 targets configured)

INFO: Analyzed target //:license-check (150 packages loaded, 4737 targets configured).
[9 / 13] JavaToolchainCompileClasses external/rules_java~/toolchains/platformclasspath_classes; 0s processwrapper-sandbox ... (2 actions running)
[11 / 13] JavaToolchainCompileBootClasspath external/rules_java~/toolchains/platformclasspath.jar; 0s processwrapper-sandbox
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 25.477s, Critical Path: 2.43s
INFO: 13 processes: 9 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 13 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt -review -project automotive.score -repo https://github.com/eclipse-score/score -token otyhZ4eaRYK1tKLNNF-Y
[main] INFO Querying Eclipse Foundation for license data for 76 items.
[main] INFO Found 52 items.
[main] INFO Querying ClearlyDefined for license data for 25 items.
[main] INFO Found 25 items.
[main] INFO License information could not be automatically verified for the following content:
[main] INFO 
[main] INFO pypi/pypi/-/docutils/0.21.2
[main] INFO 
[main] INFO This content is either not correctly mapped by the system, or requires review.
[main] INFO A review is required for pypi/pypi/-/docutils/0.21.2.
[main] INFO A review request already exists https://gitlab.eclipse.org/eclipsefdn/emo-team/iplab/-/issues/19880 .

Copy link

github-actions bot commented Apr 8, 2025

The created documentation from the pull request is available at: docu-html

@@ -247,7 +248,7 @@ def draw_module(
structure_text += f"}} /' {need['title']} '/ \n\n"

# Add logical interfaces only to implemented interfaces
for iface, component in proc_impl_interfaces.items():
for iface, _ in proc_impl_interfaces.items():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for iface, _ in proc_impl_interfaces.items():
for iface in proc_impl_interfaces:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Please resolve.


# from score_metamodel import (
# CheckLogger,
# graph_check,
# )


def get_standards_needs(needs: list[NeedsInfoType]) -> dict:
def get_standards_needs(needs: list[dict[str, Any]]) -> dict[str, dict[str, Any]]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to somehow extend NeedsInfoType with our keys? A generic dict is extremely unspecific.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to extend it or wrap it?
Just have to be careful to not end up with 200 custom NeedsInfoTypes Dataclasses in teh end.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe one in score_metamodel/__init__.py?

https://chatgpt.com/share/67f4f048-6930-800a-8a49-b3a54cece1b4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it make more sence to do it in a seperate PR later if you agree guys as I tried to change some other files containing all_needs with NeedTypeInfo in state of list[dict[str, Any]] or other definitions but I end up getting more warnings and errors but for the file standards I already changed now with no side effects

@@ -35,7 +35,7 @@ def assert_no_warnings(self):
)
pytest.fail(f"Expected no warnings, but got:\n{warnings}")

def assert_warning(self, expected_substring: str, expect_location=True):
def assert_warning(self, expected_substring: str, expect_location: bool = True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good example where annotating every parameter is useless :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree.

@@ -67,7 +68,7 @@
needs_template_folder = "_templates"
needs_global_options = {"collapse": True}
html_static_path = ["_tooling/assets", "_assets"]
needs_string_links = {
needs_string_links: dict[str, dict[str, Any]] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this required by any of the rules we have introduced? That was not intentional.

Copy link
Contributor Author

@Aymen-Soussi-01 Aymen-Soussi-01 Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's role reportUnknownVariableType that throw this warning

Copy link
Member

@AlexanderLanin AlexanderLanin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert NeedsInfoType as discussed

@Aymen-Soussi-01 Aymen-Soussi-01 self-assigned this Apr 8, 2025
@AlexanderLanin AlexanderLanin merged commit 82dc32a into eclipse-score:main Apr 8, 2025
7 of 8 checks passed
@AlexanderLanin AlexanderLanin added the community:infrastructure General Score infrastructure topics label Apr 11, 2025
@AlexanderLanin AlexanderLanin moved this from Todo to Done in Infrastructure Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community:infrastructure General Score infrastructure topics
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants