Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis update adds automatic API domain list updating with secure fetching and decryption, updates API domain constants and version, renames and refactors directory rule parsing and path construction methods, unifies file path determination across plugins, adds zip encryption support, removes an obsolete plugin, improves directory deletion safety, updates plugin listings, and bumps the module version. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as JmApiClient
participant Postman
participant CryptoTool
participant Logger
Client->>Client: after_init()
alt FLAG_API_CLIENT_AUTO_UPDATE_DOMAIN is True
Client->>Client: acquire client_update_domain_lock
Client->>Postman: GET API_URL_DOMAIN_SERVER
Postman-->>Client: encrypted_response
Client->>CryptoTool: decode_resp_data(encrypted_response, API_DOMAIN_SERVER_SECRET)
CryptoTool-->>Client: decrypted_json
alt decrypted_json contains "Server"
Client->>Client: update domain_list and global DOMAIN_API_LIST
Client->>Logger: log success
else
Client->>Logger: log error (invalid response)
end
Client->>Client: set FLAG_API_CLIENT_AUTO_UPDATE_DOMAIN_DONE = True
Client->>Client: release client_update_domain_lock
end
sequenceDiagram
participant Plugin as JmOptionPlugin (or subclass)
participant DirRule
participant FileSystem
Plugin->>DirRule: apply_rule_to_path(album, photo, only_album_rules)
DirRule-->>Plugin: constructed directory path
Plugin->>DirRule: apply_rule_to_filename(album, photo, rule)
DirRule-->>Plugin: constructed filename
Plugin->>Plugin: decide_filepath(...) with dir_rule_dict or base_dir + filename_rule + suffix
Plugin->>FileSystem: ensure directory exists, combine path components
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/jmcomic/jm_config.py(2 hunks)src/jmcomic/jm_option.py(4 hunks)src/jmcomic/jm_plugin.py(10 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/jmcomic/jm_option.py (1)
src/jmcomic/jm_entity.py (1)
JmAlbumDetail(454-566)
src/jmcomic/jm_plugin.py (3)
usage/workflow_download.py (1)
decide_filepath(89-107)src/jmcomic/jm_entity.py (2)
JmAlbumDetail(454-566)JmPhotoDetail(292-451)src/jmcomic/jm_option.py (3)
DirRule(60-168)apply_rule_to_path(78-95)apply_rule_to_filename(164-168)
🪛 Ruff (0.11.9)
src/jmcomic/jm_option.py
75-75: JmAlbumDetail may be undefined, or defined from star imports
(F405)
95-95: fix_filepath may be undefined, or defined from star imports
(F405)
src/jmcomic/jm_plugin.py
78-78: os may be undefined, or defined from star imports
(F405)
111-111: Optional may be undefined, or defined from star imports
(F405)
111-111: JmAlbumDetail may be undefined, or defined from star imports
(F405)
112-112: Optional may be undefined, or defined from star imports
(F405)
112-112: JmPhotoDetail may be undefined, or defined from star imports
(F405)
113-113: Optional may be undefined, or defined from star imports
(F405)
114-114: Optional may be undefined, or defined from star imports
(F405)
126-126: DirRule may be undefined, or defined from star imports
(F405)
128-128: os may be undefined, or defined from star imports
(F405)
130-130: os may be undefined, or defined from star imports
(F405)
131-131: os may be undefined, or defined from star imports
(F405)
131-131: DirRule may be undefined, or defined from star imports
(F405)
131-131: fix_suffix may be undefined, or defined from star imports
(F405)
133-133: mkdir_if_not_exists may be undefined, or defined from star imports
(F405)
🪛 Pylint (3.3.7)
src/jmcomic/jm_option.py
[error] 95-95: Undefined variable 'fix_filepath'
(E0602)
src/jmcomic/jm_plugin.py
[error] 78-78: Undefined variable 'os'
(E0602)
[refactor] 110-110: Too many arguments (7/5)
(R0913)
[refactor] 110-110: Too many positional arguments (7/5)
(R0917)
[error] 111-111: Undefined variable 'Optional'
(E0602)
[error] 112-112: Undefined variable 'Optional'
(E0602)
[error] 113-113: Undefined variable 'Optional'
(E0602)
[error] 114-114: Undefined variable 'Optional'
(E0602)
[error] 128-128: Undefined variable 'os'
(E0602)
[error] 130-130: Undefined variable 'os'
(E0602)
[error] 131-131: Undefined variable 'os'
(E0602)
[error] 131-131: Undefined variable 'fix_suffix'
(E0602)
[error] 133-133: Undefined variable 'mkdir_if_not_exists'
(E0602)
[refactor] 339-339: Redefining argument with the local name 'photo'
(R1704)
🔇 Additional comments (10)
src/jmcomic/jm_config.py (1)
383-383: LGTM! Simplified browser impersonation configuration.The change from
'chrome110'to'chrome'improves maintainability by avoiding version-specific browser impersonation. This makes the configuration more flexible and less likely to break with browser updates.Also applies to: 419-419
src/jmcomic/jm_option.py (4)
73-73: Good refactoring: Method renamed for clarity.The renaming from
_build_path_from_rulestoapply_rule_to_pathimproves API clarity and follows Python conventions by removing the underscore prefix for what appears to be a public method.Also applies to: 76-76, 78-78
137-151: Improved rule parsing logic.The rewritten
split_rule_dslmethod now:
- Supports both '/' and '_' as delimiters, providing more flexibility
- Properly trims whitespace from each rule element
- Ensures the base directory rule is always the first element
This makes the directory rule parsing more robust and user-friendly.
164-164: Clear and descriptive method naming.The renaming from
apply_rule_directlytoapply_rule_to_filenameclearly indicates the method's purpose of applying rules specifically to filenames, improving code readability.Also applies to: 168-168
95-95:Details
✅ Verification successful
Verify fix_filepath import and parameter change.
The
fix_filepathfunction is called without theis_dirparameter that was previously passed. Ensure this change is compatible with the function's signature.
🏁 Script executed:
#!/bin/bash # Description: Verify fix_filepath function definition and usage # Search for fix_filepath definition ast-grep --pattern 'def fix_filepath($$$)' # Search for other usages of fix_filepath to ensure consistency rg -A 2 'fix_filepath\(' --type pyLength of output: 459
🏁 Script executed:
#!/bin/bash # Display the import statements and top of the file to verify where fix_filepath comes from head -n 30 src/jmcomic/jm_option.pyLength of output: 836
No issues with fix_filepath import or usage
The call tofix_filepath('/'.join(path_ls))is valid—fix_filepathis brought in via thefrom .jm_client_impl import *at the top ofjm_option.py, and its signature injm_client_impl.pydefinesis_dir: bool = False, so omitting the second argument is safe.🧰 Tools
🪛 Ruff (0.11.9)
95-95:
fix_filepathmay be undefined, or defined from star imports(F405)
🪛 Pylint (3.3.7)
[error] 95-95: Undefined variable 'fix_filepath'
(E0602)
src/jmcomic/jm_plugin.py (5)
78-80: Excellent safety enhancement for directory deletion.The added check prevents deletion of directories containing files not created by the current download, protecting user data. The informative log message helps users understand why deletion was skipped.
🧰 Tools
🪛 Ruff (0.11.9)
78-78:
osmay be undefined, or defined from star imports(F405)
🪛 Pylint (3.3.7)
[error] 78-78: Undefined variable 'os'
(E0602)
318-318: Consistent integration with new filepath determination.The
ZipPluginnow uses the unifieddecide_filepathmethod and supports thedir_ruleparameter, providing users with more flexible output path configuration options.Also applies to: 335-335, 340-340
679-679: Improved error handling and consistent filepath management.The plugin now:
- Supports flexible output paths via
dir_ruleparameter- Uses the unified
decide_filepathmethod- Provides clear error logging when no images are found
These changes improve user experience and debugging.
Also applies to: 695-695, 721-723
740-740: Consistent updates and proper filter handling.Good changes:
- Added
dir_ruleparameter for flexible output paths- Uses unified
decide_filepathmethod- Converts filter to list, which is necessary for multiple iterations or length checks
Also applies to: 755-755, 774-774
670-729:Details
❓ Verification inconclusive
Verify ConvertJpgToPdfPlugin removal rationale.
The AI summary mentions that
ConvertJpgToPdfPluginwas removed. SinceImg2pdfPluginprovides PDF conversion functionality, please confirm that all use cases of the removed plugin are covered.
🏁 Script executed:
#!/bin/bash # Description: Check for any remaining references to ConvertJpgToPdfPlugin # Search for any references to the removed plugin rg -i 'ConvertJpgToPdfPlugin' --type py # Search for any jpg2pdf or jpg_to_pdf references that might need attention rg -i 'jpg.*pdf|jpeg.*pdf' --type pyLength of output: 78
No lingering references to ConvertJpgToPdfPlugin found.
A repository-wide search for
ConvertJpgToPdfPluginand relatedjpg→pdfpatterns returned no matches, so the old class appears fully removed. Please manually confirm that Img2pdfPlugin provides all functionality previously offered by the removed plugin (e.g., page ordering, metadata preservation, custom filename rules) to ensure complete coverage.🧰 Tools
🪛 Ruff (0.11.9)
674-674:
JmPhotoDetailmay be undefined, or defined from star imports(F405)
675-675:
JmAlbumDetailmay be undefined, or defined from star imports(F405)
684-684:
jm_logmay be undefined, or defined from star imports(F405)
687-687:
img2pdfimported but unused; consider usingimportlib.util.find_specto test for availability(F401)
705-705:
JmAlbumDetailmay be undefined, or defined from star imports(F405)
705-705:
JmPhotoDetailmay be undefined, or defined from star imports(F405)
716-716:
files_of_dirmay be undefined, or defined from star imports(F405)
🪛 Pylint (3.3.7)
[refactor] 673-673: Too many arguments (8/5)
(R0913)
[refactor] 673-673: Too many positional arguments (8/5)
(R0917)
[error] 716-716: Undefined variable 'files_of_dir'
(E0602)
| # noinspection PyMethodMayBeStatic | ||
| def decide_filepath(self, | ||
| album: Optional[JmAlbumDetail], | ||
| photo: Optional[JmPhotoDetail], | ||
| filename_rule: str, suffix: str, base_dir: Optional[str], | ||
| dir_rule_dict: Optional[dict] | ||
| ): | ||
| """ | ||
| 根据规则计算一个文件的全路径 | ||
|
|
||
| 参数 dir_rule_dict 优先级最高, | ||
| 如果 dir_rule_dict 不为空,优先用 dir_rule_dict | ||
| 否则使用 base_dir + filename_rule + suffix | ||
| """ | ||
| filepath: str | ||
| base_dir: str | ||
| if dir_rule_dict is not None: | ||
| dir_rule = DirRule(**dir_rule_dict) | ||
| filepath = dir_rule.apply_rule_to_path(album, photo) | ||
| base_dir = os.path.dirname(filepath) | ||
| else: | ||
| base_dir = base_dir or os.getcwd() | ||
| filepath = os.path.join(base_dir, DirRule.apply_rule_to_filename(album, photo, filename_rule) + fix_suffix(suffix)) | ||
|
|
||
| mkdir_if_not_exists(base_dir) | ||
| return filepath | ||
|
|
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Well-designed filepath determination method.
The decide_filepath method provides a flexible interface for determining file paths, supporting both:
- Directory rule dictionaries for complex path generation
- Simple base directory + filename rule + suffix for basic cases
This unifies path generation logic across plugins.
🏁 Script executed:
#!/bin/bash
# Description: Verify the imports and usage of undefined symbols
# Check if DirRule is properly imported
rg -B 5 'class DirRule' --type py
# Check if fix_suffix is defined or imported
ast-grep --pattern 'def fix_suffix($$$)'
# Check if mkdir_if_not_exists is defined or imported
ast-grep --pattern 'def mkdir_if_not_exists($$$)'Length of output: 375
Missing imports for utility functions
The decide_filepath implementation refers to fix_suffix and mkdir_if_not_exists, but neither is defined in this module nor imported. Please add the appropriate imports at the top of src/jmcomic/jm_plugin.py. For example:
--- a/src/jmcomic/jm_plugin.py
+++ b/src/jmcomic/jm_plugin.py
@@
-from .jm_option import DirRule
+from .jm_option import DirRule
+from jmcomic.utils import fix_suffix, mkdir_if_not_exists- Ensure the import path (
jmcomic.utils) matches where these functions are actually defined. - Verify that both
fix_suffixandmkdir_if_not_existsare available in the referenced module.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # noinspection PyMethodMayBeStatic | |
| def decide_filepath(self, | |
| album: Optional[JmAlbumDetail], | |
| photo: Optional[JmPhotoDetail], | |
| filename_rule: str, suffix: str, base_dir: Optional[str], | |
| dir_rule_dict: Optional[dict] | |
| ): | |
| """ | |
| 根据规则计算一个文件的全路径 | |
| 参数 dir_rule_dict 优先级最高, | |
| 如果 dir_rule_dict 不为空,优先用 dir_rule_dict | |
| 否则使用 base_dir + filename_rule + suffix | |
| """ | |
| filepath: str | |
| base_dir: str | |
| if dir_rule_dict is not None: | |
| dir_rule = DirRule(**dir_rule_dict) | |
| filepath = dir_rule.apply_rule_to_path(album, photo) | |
| base_dir = os.path.dirname(filepath) | |
| else: | |
| base_dir = base_dir or os.getcwd() | |
| filepath = os.path.join(base_dir, DirRule.apply_rule_to_filename(album, photo, filename_rule) + fix_suffix(suffix)) | |
| mkdir_if_not_exists(base_dir) | |
| return filepath | |
| from .jm_option import DirRule | |
| from jmcomic.utils import fix_suffix, mkdir_if_not_exists |
🧰 Tools
🪛 Ruff (0.11.9)
111-111: Optional may be undefined, or defined from star imports
(F405)
111-111: JmAlbumDetail may be undefined, or defined from star imports
(F405)
112-112: Optional may be undefined, or defined from star imports
(F405)
112-112: JmPhotoDetail may be undefined, or defined from star imports
(F405)
113-113: Optional may be undefined, or defined from star imports
(F405)
114-114: Optional may be undefined, or defined from star imports
(F405)
126-126: DirRule may be undefined, or defined from star imports
(F405)
128-128: os may be undefined, or defined from star imports
(F405)
130-130: os may be undefined, or defined from star imports
(F405)
131-131: os may be undefined, or defined from star imports
(F405)
131-131: DirRule may be undefined, or defined from star imports
(F405)
131-131: fix_suffix may be undefined, or defined from star imports
(F405)
133-133: mkdir_if_not_exists may be undefined, or defined from star imports
(F405)
🪛 Pylint (3.3.7)
[refactor] 110-110: Too many arguments (7/5)
(R0913)
[refactor] 110-110: Too many positional arguments (7/5)
(R0917)
[error] 111-111: Undefined variable 'Optional'
(E0602)
[error] 112-112: Undefined variable 'Optional'
(E0602)
[error] 113-113: Undefined variable 'Optional'
(E0602)
[error] 114-114: Undefined variable 'Optional'
(E0602)
[error] 128-128: Undefined variable 'os'
(E0602)
[error] 130-130: Undefined variable 'os'
(E0602)
[error] 131-131: Undefined variable 'os'
(E0602)
[error] 131-131: Undefined variable 'fix_suffix'
(E0602)
[error] 133-133: Undefined variable 'mkdir_if_not_exists'
(E0602)
🤖 Prompt for AI Agents
In src/jmcomic/jm_plugin.py around lines 109 to 135, the functions fix_suffix
and mkdir_if_not_exists are used but not imported or defined in the file. To fix
this, add import statements at the top of the file to import fix_suffix and
mkdir_if_not_exists from their appropriate module, such as jmcomic.utils,
ensuring the import path matches where these functions are actually defined and
that they are available in that module.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
src/jmcomic/jm_plugin.py (1)
110-135:⚠️ Potential issueCritical import issues prevent method execution.
This method references several undefined imports (
Optional,os,DirRule,fix_suffix,mkdir_if_not_exists) that will cause runtime errors. As noted in previous reviews, these imports need to be added to the top of the file.The method design itself is excellent - it provides a flexible interface for path determination with appropriate fallback logic and automatic directory creation.
🧰 Tools
🪛 Ruff (0.11.9)
112-112:
Optionalmay be undefined, or defined from star imports(F405)
112-112:
JmAlbumDetailmay be undefined, or defined from star imports(F405)
113-113:
Optionalmay be undefined, or defined from star imports(F405)
113-113:
JmPhotoDetailmay be undefined, or defined from star imports(F405)
114-114:
Optionalmay be undefined, or defined from star imports(F405)
115-115:
Optionalmay be undefined, or defined from star imports(F405)
127-127:
DirRulemay be undefined, or defined from star imports(F405)
129-129:
osmay be undefined, or defined from star imports(F405)
131-131:
osmay be undefined, or defined from star imports(F405)
132-132:
osmay be undefined, or defined from star imports(F405)
132-132:
DirRulemay be undefined, or defined from star imports(F405)
132-132:
fix_suffixmay be undefined, or defined from star imports(F405)
134-134:
mkdir_if_not_existsmay be undefined, or defined from star imports(F405)
🪛 Pylint (3.3.7)
[refactor] 111-111: Too many arguments (7/5)
(R0913)
[refactor] 111-111: Too many positional arguments (7/5)
(R0917)
[error] 112-112: Undefined variable 'Optional'
(E0602)
[error] 113-113: Undefined variable 'Optional'
(E0602)
[error] 114-114: Undefined variable 'Optional'
(E0602)
[error] 115-115: Undefined variable 'Optional'
(E0602)
[error] 129-129: Undefined variable 'os'
(E0602)
[error] 131-131: Undefined variable 'os'
(E0602)
[error] 132-132: Undefined variable 'os'
(E0602)
[error] 132-132: Undefined variable 'fix_suffix'
(E0602)
[error] 134-134: Undefined variable 'mkdir_if_not_exists'
(E0602)
🧹 Nitpick comments (1)
src/jmcomic/jm_plugin.py (1)
307-474: Excellent encryption feature implementation with minor complexity concerns.The ZipPlugin has been significantly enhanced with comprehensive encryption support including:
- Multiple encryption backends (pyzipper, py7zr)
- Random password generation with configurable length
- Proper error handling for missing dependencies
- Integration with the new unified path generation
The implementation is well-structured and feature-rich.
Consider extracting encryption logic into a separate helper class to reduce method complexity and improve testability, as some methods now exceed the recommended parameter count (7+ parameters).
🧰 Tools
🪛 Ruff (0.11.9)
317-317:
JmAlbumDetailmay be undefined, or defined from star imports(F405)
318-318:
JmPhotoDetailmay be undefined, or defined from star imports(F405)
335-335:
JmcomicTextmay be undefined, or defined from star imports(F405)
336-336:
mkdir_if_not_existsmay be undefined, or defined from star imports(F405)
351-351:
ExceptionToolmay be undefined, or defined from star imports(F405)
369-369:
osmay be undefined, or defined from star imports(F405)
372-372:
files_of_dirmay be undefined, or defined from star imports(F405)
373-373:
osmay be undefined, or defined from star imports(F405)
374-374:
osmay be undefined, or defined from star imports(F405)
382-382:
fix_filepathmay be undefined, or defined from star imports(F405)
382-382:
osmay be undefined, or defined from star imports(F405)
391-391: Use
key in dictinstead ofkey in dict.keys()Remove
.keys()(SIM118)
396-396:
files_of_dirmay be undefined, or defined from star imports(F405)
397-397:
osmay be undefined, or defined from star imports(F405)
398-398:
osmay be undefined, or defined from star imports(F405)
402-402:
Listmay be undefined, or defined from star imports(F405)
429-429:
Optionalmay be undefined, or defined from star imports(F405)
🪛 Pylint (3.3.7)
[refactor] 315-315: Too many arguments (11/5)
(R0913)
[refactor] 315-315: Too many positional arguments (11/5)
(R0917)
[refactor] 315-315: Too many local variables (16/15)
(R0914)
[error] 336-336: Undefined variable 'mkdir_if_not_exists'
(E0602)
[refactor] 346-346: Redefining argument with the local name 'photo'
(R1704)
[refactor] 363-363: Too many arguments (6/5)
(R0913)
[refactor] 363-363: Too many positional arguments (6/5)
(R0917)
[error] 369-369: Undefined variable 'os'
(E0602)
[error] 372-372: Undefined variable 'files_of_dir'
(E0602)
[error] 373-373: Undefined variable 'os'
(E0602)
[error] 374-374: Undefined variable 'os'
(E0602)
[error] 382-382: Undefined variable 'fix_filepath'
(E0602)
[error] 382-382: Undefined variable 'os'
(E0602)
[refactor] 384-384: Too many arguments (6/5)
(R0913)
[refactor] 384-384: Too many positional arguments (6/5)
(R0917)
[error] 396-396: Undefined variable 'files_of_dir'
(E0602)
[error] 397-397: Undefined variable 'os'
(E0602)
[error] 398-398: Undefined variable 'os'
(E0602)
[error] 402-402: Undefined variable 'List'
(E0602)
[error] 429-429: Undefined variable 'Optional'
(E0602)
[refactor] 435-459: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
(R1705)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
README.md(1 hunks)assets/docs/sources/option_file_syntax.md(0 hunks)src/jmcomic/__init__.py(1 hunks)src/jmcomic/jm_plugin.py(15 hunks)
💤 Files with no reviewable changes (1)
- assets/docs/sources/option_file_syntax.md
✅ Files skipped from review due to trivial changes (2)
- src/jmcomic/init.py
- README.md
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/jmcomic/jm_plugin.py (4)
usage/workflow_download.py (1)
decide_filepath(89-107)src/jmcomic/jm_entity.py (2)
JmAlbumDetail(454-566)JmPhotoDetail(292-451)src/jmcomic/jm_option.py (6)
DirRule(60-168)apply_rule_to_path(78-95)apply_rule_to_filename(164-168)decide_image_save_dir(69-73)decide_image_save_dir(242-252)decide_album_root_dir(75-76)src/jmcomic/jm_exception.py (3)
ExceptionTool(69-191)raises(83-107)downloader(66-67)
🪛 Ruff (0.11.9)
src/jmcomic/jm_plugin.py
63-63: No explicit stacklevel keyword argument found
Set stacklevel=2
(B028)
79-79: os may be undefined, or defined from star imports
(F405)
112-112: Optional may be undefined, or defined from star imports
(F405)
112-112: JmAlbumDetail may be undefined, or defined from star imports
(F405)
113-113: Optional may be undefined, or defined from star imports
(F405)
113-113: JmPhotoDetail may be undefined, or defined from star imports
(F405)
114-114: Optional may be undefined, or defined from star imports
(F405)
115-115: Optional may be undefined, or defined from star imports
(F405)
127-127: DirRule may be undefined, or defined from star imports
(F405)
129-129: os may be undefined, or defined from star imports
(F405)
131-131: os may be undefined, or defined from star imports
(F405)
132-132: os may be undefined, or defined from star imports
(F405)
132-132: DirRule may be undefined, or defined from star imports
(F405)
132-132: fix_suffix may be undefined, or defined from star imports
(F405)
134-134: mkdir_if_not_exists may be undefined, or defined from star imports
(F405)
351-351: ExceptionTool may be undefined, or defined from star imports
(F405)
369-369: os may be undefined, or defined from star imports
(F405)
372-372: files_of_dir may be undefined, or defined from star imports
(F405)
373-373: os may be undefined, or defined from star imports
(F405)
374-374: os may be undefined, or defined from star imports
(F405)
429-429: Optional may be undefined, or defined from star imports
(F405)
🪛 Pylint (3.3.7)
src/jmcomic/jm_plugin.py
[error] 79-79: Undefined variable 'os'
(E0602)
[refactor] 111-111: Too many arguments (7/5)
(R0913)
[refactor] 111-111: Too many positional arguments (7/5)
(R0917)
[error] 112-112: Undefined variable 'Optional'
(E0602)
[error] 113-113: Undefined variable 'Optional'
(E0602)
[error] 114-114: Undefined variable 'Optional'
(E0602)
[error] 115-115: Undefined variable 'Optional'
(E0602)
[error] 129-129: Undefined variable 'os'
(E0602)
[error] 131-131: Undefined variable 'os'
(E0602)
[error] 132-132: Undefined variable 'os'
(E0602)
[error] 132-132: Undefined variable 'fix_suffix'
(E0602)
[error] 134-134: Undefined variable 'mkdir_if_not_exists'
(E0602)
[refactor] 346-346: Redefining argument with the local name 'photo'
(R1704)
[refactor] 363-363: Too many arguments (6/5)
(R0913)
[refactor] 363-363: Too many positional arguments (6/5)
(R0917)
[error] 369-369: Undefined variable 'os'
(E0602)
[error] 372-372: Undefined variable 'files_of_dir'
(E0602)
[error] 373-373: Undefined variable 'os'
(E0602)
[error] 374-374: Undefined variable 'os'
(E0602)
[refactor] 384-384: Too many arguments (6/5)
(R0913)
[refactor] 384-384: Too many positional arguments (6/5)
(R0917)
[error] 429-429: Undefined variable 'Optional'
(E0602)
[refactor] 435-459: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
(R1705)
🔇 Additional comments (4)
src/jmcomic/jm_plugin.py (4)
59-64: Enhanced flexibility for warning handling.The addition of the
throwparameter allows the method to optionally raise exceptions after issuing warnings, providing better control over error handling strategies while maintaining backward compatibility.🧰 Tools
🪛 Ruff (0.11.9)
63-63: No explicit
stacklevelkeyword argument foundSet
stacklevel=2(B028)
79-81: Critical safety improvement for directory deletion.The enhanced logic now checks if directories contain files before attempting deletion, preventing accidental data loss. This is a well-implemented safety measure that logs appropriate warnings when directories are skipped.
🧰 Tools
🪛 Ruff (0.11.9)
79-79:
osmay be undefined, or defined from star imports(F405)
🪛 Pylint (3.3.7)
[error] 79-79: Undefined variable 'os'
(E0602)
750-850: Successful integration with unified path generation.Both Img2pdfPlugin and LongImgPlugin have been cleanly updated to use the new
decide_filepathmethod, maintaining their core functionality while gaining consistency with the overall architecture. The addition of error logging when no images are found improves user experience.🧰 Tools
🪛 Ruff (0.11.9)
755-755:
jm_logmay be undefined, or defined from star imports(F405)
758-758:
img2pdfimported but unused; consider usingimportlib.util.find_specto test for availability(F401)
776-776:
JmAlbumDetailmay be undefined, or defined from star imports(F405)
776-776:
JmPhotoDetailmay be undefined, or defined from star imports(F405)
787-787:
files_of_dirmay be undefined, or defined from star imports(F405)
805-805:
JmPhotoDetailmay be undefined, or defined from star imports(F405)
806-806:
JmAlbumDetailmay be undefined, or defined from star imports(F405)
815-815:
jm_logmay be undefined, or defined from star imports(F405)
818-818:
PIL.Imageimported but unused; consider usingimportlib.util.find_specto test for availability(F401)
835-835:
JmAlbumDetailmay be undefined, or defined from star imports(F405)
835-835:
JmPhotoDetailmay be undefined, or defined from star imports(F405)
835-835:
Listmay be undefined, or defined from star imports(F405)
844-844:
files_of_dirmay be undefined, or defined from star imports(F405)
🪛 Pylint (3.3.7)
[error] 787-787: Undefined variable 'files_of_dir'
(E0602)
[refactor] 804-804: Too many arguments (8/5)
(R0913)
[refactor] 804-804: Too many positional arguments (8/5)
(R0917)
[refactor] 835-835: Too many local variables (16/15)
(R0914)
[error] 835-835: Undefined variable 'List'
(E0602)
[error] 844-844: Undefined variable 'files_of_dir'
(E0602)
943-943: Appropriate suppression of false positive import warnings.The noinspection comment is correctly used here since
plugin_jm_serveris an optional external dependency with proper ImportError handling in the surrounding code.
Summary by CodeRabbit