spdx / ntia-conformance-checker

Check SPDX SBOM for NTIA minimum elements
Apache License 2.0
52 stars 19 forks source link

ntia-checker --version does not give the version #150

Closed vargenau closed 1 year ago

vargenau commented 1 year ago
ntia-checker --version

does not give the version.

You have to give a fake file for it to work:

ntia-checker --version --file foobar
0.5.1
jspeed-meyers commented 1 year ago

Thanks, @vargenau, for the bug report. We'll investigate!

jspeed-meyers commented 1 year ago

The --file argument was required. Oops. PR #151 fixes this. Thank you again, @vargenau, for reporting this bug.

vargenau commented 1 year ago

Hello @jspeed-meyers

This fixes the issue, but creates another one.

You should test the presence of the --file argument if another argument is present.

If I do

ntia-checker --verbose

I now have:

Traceback (most recent call last):
  File "/opt/homebrew/bin/ntia-checker", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ntia_conformance_checker/main.py", line 58, in main
    sbom = SbomChecker(args.file, validate=not args.skip_validation)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ntia_conformance_checker/sbom_checker.py", line 22, in __init__
    self.doc = self.parse_file()
               ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ntia_conformance_checker/sbom_checker.py", line 47, in parse_file
    if not os.path.exists(self.file):
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 19, in exists
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Same with just

ntia-checker
jspeed-meyers commented 1 year ago

@vargenau, does PR #154 accomplish what you expect?