diff --git a/SConstruct b/SConstruct index 34ff80bc..474175c1 100644 --- a/SConstruct +++ b/SConstruct @@ -241,13 +241,13 @@ distenv.PhonyTarget( distenv.PhonyTarget( "lint", "${PYTHON3} ${FBT_SCRIPT_DIR}/lint.py check ${LINT_SOURCES}", - LINT_SOURCES=firmware_env["LINT_SOURCES"], + LINT_SOURCES=[n.srcnode() for n in firmware_env["LINT_SOURCES"]], ) distenv.PhonyTarget( "format", "${PYTHON3} ${FBT_SCRIPT_DIR}/lint.py format ${LINT_SOURCES}", - LINT_SOURCES=firmware_env["LINT_SOURCES"], + LINT_SOURCES=[n.srcnode() for n in firmware_env["LINT_SOURCES"]], ) # PY_LINT_SOURCES contains recursively-built modules' SConscript files + application manifests diff --git a/firmware.scons b/firmware.scons index da5caba5..d674bf16 100644 --- a/firmware.scons +++ b/firmware.scons @@ -22,7 +22,7 @@ env = ENV.Clone( FW_FLAVOR=fw_build_meta["flavor"], LIB_DIST_DIR=fw_build_meta["build_dir"].Dir("lib"), LINT_SOURCES=[ - "applications", + Dir("applications"), ], LIBPATH=[ "${LIB_DIST_DIR}", diff --git a/firmware/SConscript b/firmware/SConscript index 19dde2e4..a16f14e6 100644 --- a/firmware/SConscript +++ b/firmware/SConscript @@ -1,7 +1,7 @@ Import("env") env.Append( - LINT_SOURCES=["firmware"], + LINT_SOURCES=[Dir(".")], SDK_HEADERS=[ *env.GlobRecursive("*.h", "targets/furi_hal_include", "*_i.h"), *env.GlobRecursive("*.h", "targets/f${TARGET_HW}/furi_hal", "*_i.h"), diff --git a/furi/SConscript b/furi/SConscript index f95ef13f..8f8caeb8 100644 --- a/furi/SConscript +++ b/furi/SConscript @@ -2,8 +2,7 @@ Import("env") env.Append( LINT_SOURCES=[ - "furi", - "furi/core", + Dir("."), ] ) diff --git a/lib/SConscript b/lib/SConscript index 60ffabfa..abede5f3 100644 --- a/lib/SConscript +++ b/lib/SConscript @@ -2,19 +2,19 @@ Import("env") env.Append( LINT_SOURCES=[ - "lib/app-scened-template", - "lib/digital_signal", - "lib/drivers", - "lib/flipper_format", - "lib/infrared", - "lib/nfc", - "lib/one_wire", - "lib/ST25RFAL002", - "lib/subghz", - "lib/toolbox", - "lib/u8g2", - "lib/update_util", - "lib/print", + Dir("app-scened-template"), + Dir("digital_signal"), + Dir("drivers"), + Dir("flipper_format"), + Dir("infrared"), + Dir("nfc"), + Dir("one_wire"), + Dir("ST25RFAL002"), + Dir("subghz"), + Dir("toolbox"), + Dir("u8g2"), + Dir("update_util"), + Dir("print"), ], SDK_HEADERS=[ File("one_wire/one_wire_host_timing.h"), diff --git a/lib/lfrfid/SConscript b/lib/lfrfid/SConscript index 69ea9d3c..f9431ca7 100644 --- a/lib/lfrfid/SConscript +++ b/lib/lfrfid/SConscript @@ -2,7 +2,7 @@ Import("env") env.Append( LINT_SOURCES=[ - "lib/lfrfid", + Dir("."), ], CPPPATH=[ "#/lib/lfrfid", diff --git a/lib/nfc/SConscript b/lib/nfc/SConscript index c6b70a67..b086298d 100644 --- a/lib/nfc/SConscript +++ b/lib/nfc/SConscript @@ -5,7 +5,7 @@ env.Append( "#/lib/nfc", ], SDK_HEADERS=[ - File("#/lib/nfc/nfc_device.h"), + File("nfc_device.h"), ], ) diff --git a/scripts/lint.py b/scripts/lint.py index c178c876..58f2d69f 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -35,11 +35,23 @@ class Main(App): ) self.parser_format.set_defaults(func=self.format) + @staticmethod + def _filter_lint_directories(dirnames: list[str]): + # Skipping 3rd-party code - usually resides in subfolder "lib" + if "lib" in dirnames: + dirnames.remove("lib") + # Skipping hidden folders + for dirname in dirnames.copy(): + if dirname.startswith("."): + dirnames.remove(dirname) + def _check_folders(self, folders: list): show_message = False pattern = re.compile(SOURCE_CODE_DIR_PATTERN) for folder in folders: for dirpath, dirnames, filenames in os.walk(folder): + self._filter_lint_directories(dirnames) + for dirname in dirnames: if not pattern.match(dirname): to_fix = os.path.join(dirpath, dirname) @@ -54,9 +66,7 @@ class Main(App): output = [] for folder in folders: for dirpath, dirnames, filenames in os.walk(folder): - # Skipping 3rd-party code - usually resides in subfolder "lib" - if "lib" in dirnames: - dirnames.remove("lib") + self._filter_lint_directories(dirnames) for filename in filenames: ext = os.path.splitext(filename.lower())[1]