CI: Add checks for new inter-module dependencies#30
Conversation
9b87133 to
284589b
Compare
284589b to
1c1e343
Compare
| """Script to parse changed files and determine if any new C++ dependencies were added between | ||
| FreeCAD modules.""" | ||
|
|
||
| import argparse |
Check notice
Code scanning / CodeQL
Unused import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
To fix an unused-import issue, the general solution is to remove the import statement for any module that is not referenced anywhere in the file. This reduces clutter and avoids implying dependencies that are not actually required.
In this file, the argparse module imported on line 7 is not used in the provided code, while command-line handling is done via sys.argv. The safest, non‑functional change is to delete only the import argparse line and leave the rest of the imports untouched. No additional methods or definitions are required.
Concretely, in tools/lint/added_dependency.py, remove line 7 (import argparse) and do not replace it with anything. All remaining imports (os, re, sys, and the utils imports) stay as they are.
| @@ -4,7 +4,6 @@ | ||
| """Script to parse changed files and determine if any new C++ dependencies were added between | ||
| FreeCAD modules.""" | ||
|
|
||
| import argparse | ||
| import os | ||
| import re | ||
| import sys |
| from utils import ( | ||
| init_environment, | ||
| write_file, | ||
| append_file, | ||
| emit_problem_matchers, | ||
| add_common_arguments, | ||
| ) |
Check notice
Code scanning / CodeQL
Unused import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 2 months ago
To fix unused-import issues, remove the unused names from the import statement (or remove the entire import if none of its names are needed). This eliminates the unnecessary dependency and clarifies which modules the file actually relies on.
In this file, the only use of utils is the from utils import (...) block on lines 12–18. Since CodeQL reports every imported symbol as unused and no usage is visible in the snippet, the best, non‑behavior‑changing fix is to delete this entire from utils import (...) block. No other code changes are needed, and no new imports or helper methods are required.
Concretely: in tools/lint/added_dependency.py, delete lines 12–18 containing the multi-line import from utils, leaving the rest of the file unchanged.
| @@ -9,14 +9,6 @@ | ||
| import re | ||
| import sys | ||
|
|
||
| from utils import ( | ||
| init_environment, | ||
| write_file, | ||
| append_file, | ||
| emit_problem_matchers, | ||
| add_common_arguments, | ||
| ) | ||
|
|
||
| KNOWN_MODULES = [ | ||
| "app", | ||
| "base", |
Merge for testing