Skip to content

Commit

Permalink
Add scancode ignore rules
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Sep 21, 2024
1 parent c4e3062 commit 0df1e87
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
3 changes: 0 additions & 3 deletions targets/TARGET_STM/TARGET_STM32H5/STM32Cube_FW/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ target_sources(mbed-stm32h5cube-fw
# HAL driver for i3c is enabled due to a circular include issue.
)

# Silence warning
set_property(SOURCE STM32H5xx_HAL_Driver/stm32h5xx_hal_hcd.c PROPERTY COMPILE_OPTIONS -Wno-old-style-declaration)

target_include_directories(mbed-stm32h5cube-fw
INTERFACE
.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ static void HCD_HC_OUT_BulkDb(HCD_HandleTypeDef *hhcd, uint8_t ch_num, uint8_t p

static uint16_t HAL_HCD_GetFreePMA(HCD_HandleTypeDef *hhcd, uint16_t mps);
static HAL_StatusTypeDef HAL_HCD_PMAFree(HCD_HandleTypeDef *hhcd, uint32_t pma_base, uint16_t mps);
static void inline HCD_HC_IN_ISO(HCD_HandleTypeDef *hhcd, uint8_t ch_num, uint8_t phy_chnum, uint32_t regvalue);
// Mbed: moved inline ahead of void
static inline void HCD_HC_IN_ISO(HCD_HandleTypeDef *hhcd, uint8_t ch_num, uint8_t phy_chnum, uint32_t regvalue);
/**
* @}
*/
Expand Down Expand Up @@ -1797,7 +1798,8 @@ static void HCD_HC_IN_BulkDb(HCD_HandleTypeDef *hhcd,
* @param regvalue contain Snapshot of the EPCHn register when ISR is detected
* @retval none
*/
static void inline HCD_HC_IN_ISO(HCD_HandleTypeDef *hhcd, uint8_t ch_num,
// Mbed: moved inline ahead of void
static inline void HCD_HC_IN_ISO(HCD_HandleTypeDef *hhcd, uint8_t ch_num,
uint8_t phy_chnum, uint32_t regvalue)
{
/* Check if Double buffer isochronous */
Expand Down
18 changes: 18 additions & 0 deletions tools/python/scancode_evaluate/scancode_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
MISSING_PERMISSIVE_LICENSE_TEXT = "Non-permissive license"
MISSING_SPDX_TEXT = "Missing SPDX license identifier"

# If a path contains text matching one of these regexes, it will be ignored for license checking.
IGNORE_PATH_REGEXES = [
# As of 2024, STMicro stopped putting license declaraions or SPDX identifiers
# in its HAL drivers. Instead they reference a license file in the repo root.
# We don't want to have to modify all their code to add SPDX license IDs every time
# it gets updated, so we ignore everything under STM32Cube_FW
re.compile(r"TARGET_STM/.*STM32Cube_FW")
]

userlog = logging.getLogger("scancode_evaluate")

# find the mbed-os root dir by going up three levels from this script
Expand Down Expand Up @@ -144,6 +153,15 @@ def license_check(scancode_output_path):
if scancode_output_data_file['type'] != 'file':
continue

is_ignored = False
for regex in IGNORE_PATH_REGEXES:
if re.search(regex, scancode_output_data_file['path']) is not None:
userlog.info("Ignoring %s due to ignore rule." % (scancode_output_data_file['path'],))
is_ignored = True
break
if is_ignored:
continue

if not scancode_output_data_file['licenses']:
scancode_output_data_file['fail_reason'] = MISSING_LICENSE_TEXT
license_offenders.append(scancode_output_data_file)
Expand Down

0 comments on commit 0df1e87

Please sign in to comment.