@@ -9,120 +9,138 @@ Yash D. Saraf `yashdsaraf@gmail.com <mailto:yashdsaraf@gmail.com>`_
99----
1010
1111This project's purpose was to create a decoupled plugin architecture for
12- `ScanCode <https://github.com/nexB/scancode-toolkit >`_ such that it can handle plugins at different
13- stages of a scan and can be coupled at runtime. These stages were,
12+ `ScanCode <https://github.com/nexB/scancode-toolkit >`_ such that it can
13+ handle plugins at different stages of a scan and can be coupled at runtime.
14+ These stages were,
1415
15161. `Format <https://github.com/nexB/scancode-toolkit/issues/639 >`_ :
1617---------------------------------------------------------------------
1718
18- In this stage, the plugins are supposed to run **after ** the scanning is done and `` post-scan ``
19- plugins are called. These plugins could be used for:
19+ In this stage, the plugins are supposed to run **after ** the scanning is
20+ done and `` post-scan `` plugins are called. These plugins could be used for:
2021
2122
22- - **converting the scanned output to the given format (say csv, json, etc.) **
23+ - **converting the scanned output to the given format (say csv, json,
24+ etc.) **
2325
2426**HOWTO **
2527
26- Here, a plugin needs to add an entry in the ``scancode_output_writers `` entry point in the following
27- format : ``'<format> = <module>:<function>' ``.
28+ Here, a plugin needs to add an entry in the ``scancode_output_writers ``
29+ entry point in the following format : ``'<format> = <module>:<function>' ``.
2830
2931
30- - ``<format> `` is the format name which will be used as the command line option name
31- (e.g ``csv `` or ``json `` ).
32- - ``<module> `` is a python module which implements the ``output `` hook specification.
33- - ``<function> `` is the function to which the scan output will be passed if this plugin is called.
32+ - ``<format> `` is the format name which will be used as the command line
33+ option name (e.g ``csv `` or ``json `` ).
34+ - ``<module> `` is a python module which implements the ``output `` hook
35+ specification.
36+ - ``<function> `` is the function to which the scan output will be passed if
37+ this plugin is called.
3438
35- The ``<format> `` name will be automatically added to the ``--format `` command line option and
36- (if called) the scanned data will be passed to the plugin.
39+ The ``<format> `` name will be automatically added to the ``--format ``
40+ command line option and (if called) the scanned data will be passed to the
41+ plugin.
3742
38432. `Post-scan <https://github.com/nexB/scancode-toolkit/issues/704 >`_ :
3944------------------------------------------------------------------------
4045
41- In this stage, the plugins are supposed to run **after ** the scanning is done. Some uses for these
42- plugins were:
46+ In this stage, the plugins are supposed to run **after ** the scanning is
47+ done. Some uses for these plugins were:
4348
4449
4550- **summarization of scan outputs **
4651
47- e.g A post-scan plugin for marking ``is_source `` to true for directories with ~90% of source
48- files.
52+ e.g A post-scan plugin for marking ``is_source `` to true for
53+ directories with ~90% of source files.
4954
5055- **simplification of scan outputs **
5156
52- e.g The ``--only-findings `` option to return files or directories with findings for the
53- requested scans. Files and directories without findings are omitted (not considering basic file
54- information as findings)).
57+ e.g The ``--only-findings `` option to return files or directories with
58+ findings for the requested scans. Files and directories without
59+ findings are omitted (not considering basic file information as
60+ findings)).
5561
5662This option already existed, I just ported it to a post-scan plugin.
5763
5864**HOWTO **
5965
60- Here, a plugin needs to add an entry in the ``scancode_post_scan `` entry point in the following
61- format ``'<name> = <module>:<function>' ``
66+ Here, a plugin needs to add an entry in the ``scancode_post_scan `` entry
67+ point in the following format ``'<name> = <module>:<function>' ``
6268
6369- ``<name> `` is the command line option name (e.g **only-findings **).
64- - ``<module> `` is a python module which implements the ``post_scan `` hook specification.
65- - ``<function> `` is the function to which the scanned files will be passed if this plugin is called
70+ - ``<module> `` is a python module which implements the ``post_scan `` hook
71+ specification.
72+ - ``<function> `` is the function to which the scanned files will be passed
73+ if this plugin is called
6674
67- The command line option for this plugin will be automatically created using the ``<function> `` 's
68- doctring as its help text and (if called) the scanned files will be passed to the plugin.
75+ The command line option for this plugin will be automatically created using
76+ the ``<function> `` 's doctring as its help text and (if called) the scanned
77+ files will be passed to the plugin.
6978
70793. `Pre-scan <https://github.com/nexB/scancode-toolkit/issues/719 >`_ :
7180-----------------------------------------------------------------------
7281
73- In this stage, the plugins are supposed to run **before ** the scan starts. So the potential uses
74- for these types of plugins were to:
82+ In this stage, the plugins are supposed to run **before ** the scan starts.
83+ So the potential uses for these types of plugins were to:
7584
7685- **ignore files based on a given pattern (glob) **
7786- **ignore files based on their info i.e size, type etc. **
7887- **extract archives before scanning **
7988
8089**HOWTO **
8190
82- Here, a plugin needs to add an entry in the ``scancode_pre_scan `` entry point in the following
83- format : ``'<name> = <module>:<class>' ``
91+ Here, a plugin needs to add an entry in the ``scancode_pre_scan `` entry
92+ point in the following format : ``'<name> = <module>:<class>' ``
8493
8594
8695* ``<name> `` is the command line option name (e.g **ignore ** ).
87- * ``<module> `` is a python module which implements the ``pre_scan `` hook specification.
88- * ``<class> `` is the class which is instantiated and its appropriate method is invoked if this
89- plugin is called. This needs to extend the ``plugincode.pre_scan.PreScanPlugin `` class.
90-
91- The command line option for this plugin will be automatically created using the ``<class> `` 's
92- doctring as its help text. Since there isn't a single spot where ``pre-scan `` plugins can be
93- plugged in, more methods to ``PreScanPlugin `` class can be added which can represent different
94- hooks, say to add or delete a scan there might be a method called ``process_scan ``.
95-
96- If a plugin's option is passed by the user, then the ``<class> `` is instantiated with the user
97- input and its appropriate aforementioned methods are called.
96+ * ``<module> `` is a python module which implements the ``pre_scan `` hook
97+ specification.
98+ * ``<class> `` is the class which is instantiated and its appropriate method
99+ is invoked if this plugin is called. This needs to extend the
100+ ``plugincode.pre_scan.PreScanPlugin `` class.
101+
102+ The command line option for this plugin will be automatically created using
103+ the ``<class> `` 's doctring as its help text. Since there isn't a single
104+ spot where ``pre-scan `` plugins can be plugged in, more methods to
105+ ``PreScanPlugin `` class can be added which can represent different hooks,
106+ say to add or delete a scan there might be a method called
107+ ``process_scan ``.
108+
109+ If a plugin's option is passed by the user, then the ``<class> `` is
110+ instantiated with the user input and its appropriate aforementioned methods
111+ are called.
98112
991134. Scan (proper):
100114-----------------
101115
102- In this stage, the plugins are supposed to run **before ** the scan starts and **after ** the
103- ``pre-scan `` plugins are called. These plugins would have been used for
116+ In this stage, the plugins are supposed to run **before ** the scan starts
117+ and **after ** the ``pre-scan `` plugins are called. These plugins would have
118+ been used for
104119
105120- **adding or deleting scans **
106121- **adding dependency scans (whose data could be used in other scans) **
107122
108- No development has been done for this stage, but it will be quite similar to ``pre-scan ``.
123+ No development has been done for this stage, but it will be quite similar
124+ to ``pre-scan ``.
109125
1101265. Other work:
111127--------------
112128
113- `Group cli options in cli help <https://github.com/nexB/scancode-toolkit/issues/709 >`_
129+ `Group cli options in cli help
130+ <https://github.com/nexB/scancode-toolkit/issues/709> `_
114131
115- Here, the goal was to add command line options to pre-defined groups such that they are displayed
116- in their respective groups when ``scancode -h `` or `` scancode --help `` is called. This helped to
117- better visually represent the command line options and determine more easily what context they
118- belong to.
132+ Here, the goal was to add command line options to pre-defined groups such
133+ that they are displayed in their respective groups when ``scancode -h `` or
134+ `` scancode --help `` is called. This helped to better visually represent the
135+ command line options and determine more easily what context they belong to.
119136
120- `Add a Resource class to hold all scanned info < https://github.com/nexB/scancode-toolkit/issues/738 >`_
121- * ``Ongoing `` *
137+ `Add a Resource class to hold all scanned info
138+ <https://github.com/nexB/scancode-toolkit/issues/738> `_ * ``Ongoing `` *
122139
123- Here, the goal was to create a ``Resource `` class, such that it holds all the scanned data for a
124- resource (i.e a file or a directory). This class would go on to eventually encapsulate the caching
125- logic entirely. For now, it just holds the ``info `` and ``path `` of a resource.
140+ Here, the goal was to create a ``Resource `` class, such that it holds all
141+ the scanned data for a resource (i.e a file or a directory). This class
142+ would go on to eventually encapsulate the caching logic entirely. For now,
143+ it just holds the ``info `` and ``path `` of a resource.
126144
1271456. What's left?
128146---------------
@@ -132,4 +150,5 @@ logic entirely. For now, it just holds the ``info`` and ``path`` of a resource.
132150- More complex post-scan plugins
133151- Support plugins written in languages other than python
134152
135- **Additionally, all my commits can be found ** `here <https://github.com/nexB/scancode-toolkit/commits/develop?author=yashdsaraf >`_.
153+ **Additionally, all my commits can be found ** `here
154+ <https://github.com/nexB/scancode-toolkit/commits/develop?author=yashdsaraf> `_.
0 commit comments