PrivacyScore / privacyscanner

Privacyscanner is the new scanning backend component of a future PrivacyScore version
MIT License
20 stars 11 forks source link

Fix --skip-dependencies bug that made all other commands unusable #3

Closed maltekrupa closed 6 years ago

maltekrupa commented 6 years ago

https://github.com/PrivacyScore/privacyscanner/commit/d13bc208f7be767c77d0146c246166d7b367bf3f implemented --skip-dependencies which fails if one isn't working in the scan argument space.

(privacyscanner) $ privacyscanner print_master_config
Traceback (most recent call last):
  File "/Users/malte/.pyenv/versions/privacyscanner/bin/privacyscanner", line 11, in <module>
    load_entry_point('privacyscanner', 'console_scripts', 'privacyscanner')()
  File "/Users/malte/src/python/privacyscanner/privacyscanner/scanner.py", line 192, in main
    if args.skip_dependencies and not args.scan_modules:
AttributeError: 'Namespace' object has no attribute 'skip_dependencies'
(privacyscanner) $ privacyscanner run_workers
Traceback (most recent call last):
  File "/Users/malte/.pyenv/versions/privacyscanner/bin/privacyscanner", line 11, in <module>
    load_entry_point('privacyscanner', 'console_scripts', 'privacyscanner')()
  File "/Users/malte/src/python/privacyscanner/privacyscanner/scanner.py", line 192, in main
    if args.skip_dependencies and not args.scan_modules:
AttributeError: 'Namespace' object has no attribute 'skip_dependencies'
(privacyscanner) 1 $ privacyscanner scan
usage: privacyscanner scan [-h] [--config CONFIG] [--results RESULTS]
                           [--import-results IMPORT_RESULTS]
                           [--scans SCAN_MODULES] [--skip-dependencies]
                           [--print]
                           site
privacyscanner scan: error: the following arguments are required: site

Having a dest on the subparsers also allows to check if no argument is provided and give a reasonable error message instead of an AttributeError.