MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / FileClassifier

Class FileClassifier

src/summarycode/classify_plugin.py:56–152  ·  view source on GitHub ↗

Classify a file such as a COPYING file or a package manifest with a flag.

Source from the content-addressed store, hash-verified

54
55@post_scan_impl
56class FileClassifier(PostScanPlugin):
57 """
58 Classify a file such as a COPYING file or a package manifest with a flag.
59 """
60 resource_attributes = dict([
61 ('is_legal',
62 Boolean(help='True if this file is likely a "legal", license-related'
63 'file such as a COPYING or LICENSE file.')),
64
65 ('is_manifest',
66 Boolean(help='True if this file is likely a package manifest file such '
67 'as a Maven pom.xml or an npm package.json')),
68
69 ('is_readme',
70 Boolean(help='True if this file is likely a README file.')),
71
72 ('is_top_level',
73 Boolean(help='True if this file is "top-level" file located either at '
74 'the root of a package or in a well-known common location.')),
75
76 ('is_key_file',
77 Boolean(help='True if this file is "top-level" file and either a '
78 'legal, readme or manifest file.')),
79
80 ('is_community',
81 Boolean(help='True if this file is a community file generally used for'
82 'maintainance or participation in the FOSS project community.')),
83
84# ('is_doc',
85# Boolean(help='True if this file is likely a documentation file.')),
86#
87# ('is_test',
88# Boolean(help='True if this file is likely a test file.')),
89#
90# ('is_generated',
91# Boolean(help='True if this file is likely an automatically generated file.')),
92#
93# ('is_build',
94# Boolean(help='True if this file is likely a build script or file such as Makefile.')),
95#
96# we have an is_data attribute
97# ('is_data',
98# Boolean(help='True if this file is likely data file.')),
99
100 ])
101
102 run_order = 4
103 sort_order = 4
104
105 options = [
106 PluggableCommandLineOption(('--classify',),
107 is_flag=True, default=False,
108 help='Classify files with flags telling if the file is a legal, '
109 'or readme or test file, etc.',
110 help_group=POST_SCAN_GROUP,
111 sort_order=50,
112 )
113 ]

Callers

nothing calls this directly

Calls 2

BooleanFunction · 0.90

Tested by

no test coverage detected