Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_src_filters flag behaviour interferes with other settings #4788

Closed
Strooom opened this issue Nov 16, 2023 · 2 comments
Closed

check_src_filters flag behaviour interferes with other settings #4788

Strooom opened this issue Nov 16, 2023 · 2 comments

Comments

@Strooom
Copy link

Strooom commented Nov 16, 2023

[x] PlatformIO Core.

Configuration

Operating system : Win64 v11
PlatformIO Version (platformio --version) : 6.1.11

Description of problem

when using a check_src_filters flag this works only when there is only one environment. As soon as a second [env] is created, the cppcheck only checks the files in folder 'src'

Steps to Reproduce

  1. set up a simple, single [env] and configure the static code checking
[env:native]
platform = native
check_tool = cppcheck
check_flags = --enable=all
check_src_filters = 
    +<test/test_*/*>
    +<src/*>

run pio check --environment native and it works, checking code in src and test folders

now add a second environment [env:another]

[env:another]

[env:native]
platform = native
check_tool = cppcheck
check_flags = --enable=all
check_src_filters = 
    +<test/test_*/*>
    +<src/*>

run pio check --environment native and it will only check source in 'src', no longer in test folders

Actual Results

does not include files in folders set by check_src_filters

Expected Results

should include files in folders set by check_src_filters, independent of how many environments there are or settings in unselected environments

@Strooom
Copy link
Author

Strooom commented Nov 16, 2023

When moving the static code check settings to [env], the check_src_filters flag does work as expected

[env]
check_tool = cppcheck
check_flags = --enable=all
check_src_filters = 
    +<test/test_*/*>
    +<src/*>

[env:another]

[env:native]
; Environment for testing things without hardware.
platform = native

when extending/overriding general settings from [env] in the [env:native], this has no effect, ie. the [env:native] settings do not overrule the [env] settings

[env]
check_tool = cppcheck
check_flags = --enable=all
check_src_filters = 
    +<src/*>

[env:another]

[env:native]
; Environment for testing things without hardware.
platform = native
check_src_filters = 
    +<test/test_*/*>
    +<src/*>

files in test folders are not being included in cppcheck

@valeros
Copy link
Member

valeros commented Nov 17, 2023

Hi @Strooom, many thanks for reporting, should be fixed in the development branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants