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

Mypy hook #1123

Closed
wants to merge 62 commits into from
Closed

Mypy hook #1123

wants to merge 62 commits into from

Conversation

jstucke
Copy link
Collaborator

@jstucke jstucke commented Sep 1, 2023

  • added mypy pre-commit hook
  • added mypy config
  • fixed all issues in the code base or at least added ignore comments where it wasn't possible

jstucke added 30 commits August 2, 2023 16:54
@jstucke jstucke requested a review from maringuu September 1, 2023 09:05
@jstucke jstucke self-assigned this Sep 1, 2023
Copy link
Collaborator

@maringuu maringuu left a comment

Choose a reason for hiding this comment

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

Overall lgtm but still some questions.

"""Analyze a file.
May return None if nothing was found.

:param file_handle: :py:class:`io.FileIO` instance of the file to be analyzed
:param virtual_file_path: The virtual file paths, see :py:class:`~objects.file.FileObject`
:param analyses: A dictionary of dependent analysis

:return: The analysis if anything was found.
:return: The analysis results (if there are any).
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: why use parentheses?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In general? 😅

I don't know, if you want I can remove them. I originally just wanted to specify that analysis results are returned.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant that what is written in the parentheses is useful information and reads better without the parantheses.

src/analysis/plugin/plugin.py Outdated Show resolved Hide resolved
@@ -145,7 +149,7 @@ def get_analysis(self, file_handle: io.FileIO, virtual_file_path: dict, analyses
'system_version': self.metadata.system_version,
'summary': summary,
'tags': tags_dict,
'result': result.dict() if result else None,
'result': result.dict() if isinstance(result, BaseModel) else None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think during the time I wasn't sure if the plugin always returns a BaseModel or if it can be a dict if no schema is specified. I think as it is now, the schema is mandatory and the plugin always returns a BaseModel, right?

Copy link
Collaborator

@maringuu maringuu Sep 18, 2023

Choose a reason for hiding this comment

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

right?

Exactly!

src/helperFunctions/plugin.py Outdated Show resolved Hide resolved
src/helperFunctions/types.py Show resolved Hide resolved
src/test/unit/compare/compare_plugin_test_class.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@maringuu maringuu left a comment

Choose a reason for hiding this comment

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

I had a brief look at everything but didn't look in depth.
I hope I found any actual code changes and reviewed them.
For the typing changes I'm happy when mypy is.

src/scheduler/analysis/scheduler.py Show resolved Hide resolved
from multiprocessing import Value
from helperFunctions.types import MpValue, MpArray

pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo?

maringuu pushed a commit to maringuu/FACT_core that referenced this pull request Oct 12, 2023
maringuu pushed a commit that referenced this pull request Oct 18, 2023
maringuu pushed a commit that referenced this pull request Oct 18, 2023
@dorpvom
Copy link
Collaborator

dorpvom commented Nov 25, 2024

We decided to split this up into smaller PRs to make each one reviewable

@dorpvom dorpvom closed this Nov 25, 2024
@maringuu maringuu mentioned this pull request Nov 27, 2024
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

Successfully merging this pull request may close these issues.

3 participants