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

validator using pypi's rocrate #38

Merged
merged 3 commits into from
Nov 3, 2023
Merged

Conversation

SteffenBrinckmann
Copy link
Collaborator

No description provided.

@SteffenBrinckmann SteffenBrinckmann marked this pull request as draft October 31, 2023 14:45
@SteffenBrinckmann SteffenBrinckmann marked this pull request as ready for review October 31, 2023 14:47
@SteffenBrinckmann
Copy link
Collaborator Author

SteffenBrinckmann commented Oct 31, 2023

@NicolasCARPi Ok, this works:

  • everything is parsed and the content is listed
  • Pasta.eln fails, and the test fails (in the old version as you can see in details)
  • everything is contained within one file (concise)

The current version of the PASTA.eln file should not fail the validator

from rocrate.model.entity import Entity
from rocrate.model.contextentity import ContextEntity

success = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of tracking exit code with success var, simply do a sys.exit(1) in the except block, and otherwise a sys.exit(0) for the happy path.

from rocrate.model.contextentity import ContextEntity

success = 0
for root, _, files in os.walk(".", topdown=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest using the more modern Pathlib instead of os.

success = 0
for root, _, files in os.walk(".", topdown=False):
for name in files:
if not name.endswith('.eln'):
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of checking with a not and skipping, why not check for a positive condition and execute code, there is no need for else condition anyway.

Copy link

Choose a reason for hiding this comment

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

or directly search the *.eln files with path.glob(...) method

if not name.endswith('.eln'):
continue
fileName = os.path.join(root, name)
print(f'\n\nTry to parse: {fileName}')
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd write: "Trying to parse" instead of "Try to parse"

@SteffenBrinckmann SteffenBrinckmann merged commit 8b9c223 into master Nov 3, 2023
1 check failed
@SteffenBrinckmann SteffenBrinckmann deleted the sb_github_actions branch November 3, 2023 20:13
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