Conversation
…es which git / VS Code are marking as in conflict. Annoyingly, this seems to have introduced a bug as well.
…esolving clashes. But looking at it, I really can't fathom out 'how'
…n't edited this file...
t00sa
left a comment
There was a problem hiding this comment.
Seems reasonable. I've made a few comments in-line.
Although this isn't in the scope of the present PR, have you considered moving the command line code, i.e. everything from L611 to the end of the file, out into a __main__.py file? This would allow you to do something like python -m script_umdp3_checker - assuming that the clone of SimSys_Scripts is in your python path - to run the checker as a command while still keeping it as a separate library.
| file_extensions: Set[str] = set(), | ||
| check_functions: Dict[str, Callable] = {}, | ||
| changed_files: List[Path] = [], |
There was a problem hiding this comment.
Initialising mutable types in function signatures is generally to be avoided because it results in the value being implicitly saved between calls. It is generally safer to set them to None and initialise them within the function, e.g.
def from_full_list(cls, name, file_extensions=None):
file_extensions = file_extensions or set([])The code seems to have used this method in places, so I'm not sure why it hasn't been used here
| return self.name | ||
| @staticmethod | ||
| def filter_files( | ||
| files: List[Path], file_extensions: Set[str] = set() |
There was a problem hiding this comment.
Default mutable instance in a function signature?
| name: str, | ||
| commands: List[List[str]], | ||
| all_files: List[Path], | ||
| file_extensions: Set[str] = set(), |
There was a problem hiding this comment.
Default mutable instance in a function signature?
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
|
Having been forced to think about the intention on those function arguments (Default mutable instance in a function signature ?), I've made most of them required. |
PR Summary
Sci/Tech Reviewer: @t00sa
Code Reviewer: @ericaneininger
The Abstract class and 2 real classes setup was a bit clunky.
I thought I could merge the two into one real class, but after trying that it transpires I needed a subclass to overwrite the behaviour of the
checkmethod for external runners.Whilst I'm still struggling at times with the Linters VS Code deploys on the desktop, this change seems to have "re-discovered" a bunch of lines that are too long, in a file I'd not touched. There was a messed up "merge of main" which I presume caused this, but I'm just baffled.
Code Quality Checklist
Testing
It has been run on itself, in 'Python' mode, with no errors
In it's default 'Fortran' Mode :
It has been run on a 'um' branch with no failures.
It has been run on a um branch with VAF (Value Added Failures), where it identified the requisite failures.
It has been run on um/main , where it had a whale of a time identifying 874 files (out of 2406) with errors in them.
pytest has been run on the repository, no errors reported.
Security Considerations
AI Assistance and Attribution
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review