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

New plugin architecture #885

Merged
merged 122 commits into from
Feb 7, 2018
Merged

New plugin architecture #885

merged 122 commits into from
Feb 7, 2018

Conversation

pombredanne
Copy link
Member

This is for #787 and a few more tickets.

There are a few changes on what is reported:

  • scanning a single file or empty dir will always return a value even with strtip-root
  • the root directory has a proper entry with its file info
  • the counts are correct and do not need to load the whole set of scan results in memory, using instead the lighter weight Codebase and Resources tree
  • the scan cache has been folded in the Codebase and Resource code. This will enable a simpler implementation for Allow cache location configuration  #357 and Allow cache location configuration #878

I want to close #856 in favor of this heavily updated plugin and CLI processing architecture.

@yashdsaraf and @haikoschol ping!

yashdsaraf and others added 30 commits January 17, 2018 22:59
Signed-off-by: Yash D. Saraf <yashdsaraf@gmail.com>
Signed-off-by: Saravanan G <sgoffl1603@gmail.com>
Signed-off-by: Saravanan G <sgoffl1603@gmail.com>
Signed-off-by: Haiko Schol <ext-haiko.schol@here.com>
Signed-off-by: Haiko Schol <ext-haiko.schol@here.com>
Signed-off-by: Haiko Schol <ext-haiko.schol@here.com>
Signed-off-by: Haiko Schol <ext-haiko.schol@here.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * more ScanOption to scancode.__init__.py
 * add active_scans to BasePlugin initializer
 * ensure plugins work consistently
 * try to not make ignores a special case

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * use structured namedtuple to track Scanners and CommandOptions
 * rework how default scan and selected options are handled using these
   tuples to streamline the corresponding code and the way selected
   options are reported in the scan results (at least for JSON)
 * add is_enabled method to Plugin
 * ensure the help of options is used for each option, and not a global
   help for all the options of a given plugin
 * add new plural option for each scan (such as --licenses) that maps
   exactly to the key used in the scan results. Use plural variables
   throughout to simplify the code
 * use kwargs for the main cli.scancode function for all all options and
   no longer use named arguments: args can come from any plugins and
   are not known until runtime.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * fileutils.py: remove file_iter and dir_iter as they were not really
   used/useful

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * refactor pre-scan plugins to use the same approach as all other
   plugins and not make ignoring a special case
 * cli.py and cache.py: remove the on-disk file log and use an in-memory
   list instead

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * move and other file info code such as get_file_infos and Resource to
   new resource.py module. Make infos a proper, regular scan
 * Do use content checksum for scan cache, instead use plain path
   checksum. This enabled making info a proper scan, since content
   checksums are no longer needed for cache handling.
 * remove info cache and use only one cache file per file for its
   details
 * Reorganize scan steps to make them co-located and explicit: inventory
   pre-scan, scan and post-scan are not a set of clean loops
 * move most of the CLI output in the main scancode function
 * Add name class attribute to plugins to support UI reporting

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * now return (error string or None, value or None)
 * this is cleaner than (success, value) where the value could be
   either the callble result or the error string 

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * and not a generator, so they can serialize OK without wrapping

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * This was a useless wrapper
 * Also improve imports locality and other minor refactorings

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
 * use generic get_plugins for all plugin types rather than
   a function with a unique name
 * use Resource objects throughout (except for format plugins)
 * enhance BasePlugin base class: the methods are now setup() and
   teardown() to be executed at init/exit time, process_resource() to
   process a single Resource and process_codebase() to process a whole
   Codebase

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@pombredanne
Copy link
Member Author

ok, so I am merging now. We can take it from develop for any other quirks.
@haikoschol @yashdsaraf thanks you for starting this in the first place. It took a while but I feel we are in a better place now!

@pombredanne pombredanne merged commit d5c583a into develop Feb 7, 2018
This was referenced Feb 7, 2018
sschuberth added a commit to oss-review-toolkit/ort that referenced this pull request Feb 16, 2018
This includes a massive refactoring with lots of performance
improvements. For details see

aboutcode-org/scancode-toolkit#885
sschuberth added a commit to oss-review-toolkit/ort that referenced this pull request Feb 16, 2018
This includes a massive refactoring with lots of performance
improvements. For details see

aboutcode-org/scancode-toolkit#885
@pombredanne pombredanne deleted the 787-new-plugin-architecture branch February 19, 2018 21:45
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.

5 participants