troubadix 25.3.2__py3-none-any.whl → 25.3.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
troubadix/__version__.py CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  # THIS IS AN AUTOGENERATED FILE. DO NOT TOUCH!
4
4
 
5
- __version__ = "25.3.2"
5
+ __version__ = "25.3.4"
@@ -15,6 +15,7 @@
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
+ import difflib
18
19
  from typing import Iterable, List
19
20
 
20
21
  from troubadix.plugin import FilePlugin, FilesPlugin, Plugin
@@ -175,13 +176,18 @@ class StandardPlugins(Plugins):
175
176
  ) -> None:
176
177
  file_plugins = _FILE_PLUGINS
177
178
  files_plugins = _FILES_PLUGINS
179
+
178
180
  if excluded_plugins:
181
+ self._check_unknown_plugins(excluded_plugins)
182
+
179
183
  file_plugins = self._exclude_plugins(excluded_plugins, file_plugins)
180
184
  files_plugins = self._exclude_plugins(
181
185
  excluded_plugins, files_plugins
182
186
  )
183
187
 
184
188
  if included_plugins:
189
+ self._check_unknown_plugins(included_plugins)
190
+
185
191
  file_plugins = self._include_plugins(included_plugins, file_plugins)
186
192
  files_plugins = self._include_plugins(
187
193
  included_plugins, files_plugins
@@ -208,3 +214,27 @@ class StandardPlugins(Plugins):
208
214
  for plugin in plugins
209
215
  if plugin.__name__ in included or plugin.name in included
210
216
  ]
217
+
218
+ @staticmethod
219
+ def _check_unknown_plugins(selected_plugins: list[str]):
220
+ all_plugin_names = {
221
+ name
222
+ for plugin in _FILE_PLUGINS + _FILES_PLUGINS
223
+ for name in (plugin.name, plugin.__name__)
224
+ }
225
+
226
+ unknown_plugins = set(selected_plugins).difference(all_plugin_names)
227
+
228
+ if not unknown_plugins:
229
+ return
230
+
231
+ def build_message(plugin: str):
232
+ match = difflib.get_close_matches(plugin, all_plugin_names, n=1)
233
+ return (
234
+ f"'{plugin}' (Did you mean '{match[0]}'?)"
235
+ if match
236
+ else f"'{plugin}'"
237
+ )
238
+
239
+ messages = [build_message(plugin) for plugin in sorted(unknown_plugins)]
240
+ raise ValueError(f"Unknown plugins: {', '.join(messages)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: troubadix
3
- Version: 25.3.2
3
+ Version: 25.3.4
4
4
  Summary: A linting and QA check tool for NASL files
5
5
  License: GPL-3.0-or-later
6
6
  Author: Greenbone
@@ -1,5 +1,5 @@
1
1
  troubadix/__init__.py,sha256=K7sIXXDrC7YRb7BvIpdQ6ZfG_QkT0qUH_wAlHROVRfM,716
2
- troubadix/__version__.py,sha256=NXpczL-n6HJ-Vu0Fo881GIjQixjbFj-L0XhIxGGRzkw,103
2
+ troubadix/__version__.py,sha256=6B3bcxEjbrE40xqOYtLub3azpa0RnygbksMumocgszA,103
3
3
  troubadix/argparser.py,sha256=-H07Jhqh68_M4Mbjq9qJjTr3MShy_N2pxl2qHA6cfRU,7481
4
4
  troubadix/codespell/codespell.additions,sha256=NAYnQF79kdk4YhU_h8fpjAVVkqBm778aPHPPP7FEkZY,504
5
5
  troubadix/codespell/codespell.exclude,sha256=RS0PH7Px2NRg40UpreuXfnInaC4veaeeDxP1FNac4ms,147431
@@ -9,7 +9,7 @@ troubadix/helper/helper.py,sha256=GXapYLii2rLKwkX2ok31YoAdUSizBnyPjWz-aPP6HM8,31
9
9
  troubadix/helper/linguistic_exception_handler.py,sha256=Bq7ULjDdWTKUpFNTUX6XMPdD4s4v8eIjZPyqBe8VLws,6811
10
10
  troubadix/helper/patterns.py,sha256=_ifRnwHsPee9B0yRYSCsyFms4StWVWJq7I9YnQwToa8,9174
11
11
  troubadix/plugin.py,sha256=3fQPj3Qe_hgwHerlYE4hbdzYMzRU557NxJ-UwtE9mOI,3525
12
- troubadix/plugins/__init__.py,sha256=V5fHMg2qVWIYKVZJqHKpzgrQ5x87Pz5u-h-CxOx7Dls,7511
12
+ troubadix/plugins/__init__.py,sha256=v328Yxgd8dU8g69Jpe4li-HM0iaqoT9_bOxfA7hP8jU,8445
13
13
  troubadix/plugins/badwords.py,sha256=k1A1d2pdXzie87FGGXrykP2BgdZbY5QtmQItupHtNyw,4701
14
14
  troubadix/plugins/copyright_text.py,sha256=jYsLWmTbT_A78XQQxQFK-5kMMHkh3xdvlh7mEF2dZGU,3583
15
15
  troubadix/plugins/copyright_year.py,sha256=XzM9MHVzOXwNLwHpfuaWj8PUOmswr56SBVOLBdvxjd4,5478
@@ -98,8 +98,8 @@ troubadix/standalone_plugins/last_modification.py,sha256=ROzwVzzYilXJ0llVt4Lv0w8
98
98
  troubadix/standalone_plugins/no_solution.py,sha256=p_-az9Igl4GH6HnhLLYbYlWIiEP64OTQLpX-z3JAshs,8760
99
99
  troubadix/standalone_plugins/version_updated.py,sha256=6YHF0OjL5NWszQdsSh7XzlSji1e6Uaqwu_Y6m3R0mvI,4203
100
100
  troubadix/troubadix.py,sha256=5__Jz3bYSrya4aG6RCBWxqnsDepXfwXZ3v0bjCzEFi0,6039
101
- troubadix-25.3.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
102
- troubadix-25.3.2.dist-info/METADATA,sha256=hu1yigOgM8fAVT_7eEBdTa9O8oRgrJTvLdMYPyIedKU,4462
103
- troubadix-25.3.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
104
- troubadix-25.3.2.dist-info/entry_points.txt,sha256=SnhEUe4W76P-ADmO9J355gRztTyHU_PTxRewKy3-e5o,832
105
- troubadix-25.3.2.dist-info/RECORD,,
101
+ troubadix-25.3.4.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
102
+ troubadix-25.3.4.dist-info/METADATA,sha256=YiQ1TIlcRGSKXKylM9ADwcIIMTar7pp-5E2Pmp1a2sA,4462
103
+ troubadix-25.3.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
104
+ troubadix-25.3.4.dist-info/entry_points.txt,sha256=SnhEUe4W76P-ADmO9J355gRztTyHU_PTxRewKy3-e5o,832
105
+ troubadix-25.3.4.dist-info/RECORD,,