Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions analyzer/linux/modules/packages/xdg_open.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python

from lib.core.packages import Package


class Xdg_open(Package):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The class name Xdg_open does not follow PEP 8 naming conventions for classes (CapWords). While the current loader logic in lib/core/packages.py uses .capitalize() on the filename, which results in Xdg_open, it would be better to update the loader to handle snake_case to PascalCase conversion properly so that standard naming can be used. If the loader cannot be changed, this is acceptable but inconsistent with Python standards.

References
  1. Class names should normally use the CapWords convention as per PEP 8. (link)

"""Start file with xdg-open"""

summary = "Run via xdg-open"
description = "Generic package that uses xdg-open to run sample"

def prepare(self):
self.args = [self.target] + self.args
self.target = "/usr/bin/xdg-open"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding the path to /usr/bin/xdg-open might fail on distributions where it is located elsewhere (e.g., /bin/xdg-open). It is generally safer to rely on the system PATH or use a utility to locate the binary.

Suggested change
self.target = "/usr/bin/xdg-open"
self.target = "xdg-open"

Loading