Skip to content

#12254: cppcheck.cfg can't be loaded from relative paths anymore - #5780

Open
olabetskyi wants to merge 14 commits into
cppcheck-opensource:mainfrom
olabetskyi:ticket_12254
Open

#12254: cppcheck.cfg can't be loaded from relative paths anymore#5780
olabetskyi wants to merge 14 commits into
cppcheck-opensource:mainfrom
olabetskyi:ticket_12254

Conversation

@olabetskyi

Copy link
Copy Markdown
Collaborator

fix python tests

Comment thread test/cli/test-other.py Outdated
Comment thread test/cli/test-other.py
Comment thread test/cli/test-other.py
Comment thread test/cli/test-other.py
Comment thread test/cli/testutils.py Outdated
Comment thread test/cli/testutils.py Outdated
Comment thread test/cli/testutils.py Outdated
Comment thread test/cli/testutils.py Outdated

@danmar danmar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. I have some nits.

Comment thread test/cli/test-other.py Outdated

args.insert(0, cppcheck_exe)

exitcode, _, stderr = cppcheck(args)

@danmar danmar Dec 20, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stylistically I would personally tighten this:

exitcode, _, stderr = cppcheck([cppcheck_exe, '--premium=misra-c++-2008', test_file])

or at least just create args, with the exe filename as first option directly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would also be interesting to check that stdout does not complain about unhandled option.

Comment thread test/cli/test-other.py Outdated
Comment thread test/cli/test-other.py Outdated
Comment thread test/cli/test-other.py Outdated
Comment thread test/cli/test-other.py Outdated

@danmar danmar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have minor nits. when those are done and CI is happy I think we can merge this.

Comment thread test/cli/test-other.py Outdated
Comment thread test/cli/test-other.py Outdated
Comment thread test/cli/test-other.py Outdated
Comment thread test/cli/test-other.py Outdated
'Checking {} ...'.format(test_file)
]
lines = stdout.splitlines()
assert lines == out_lines

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well it works but I guess you could also just write:

assert f'Checking {test_file} ...' == stdout.strip()

Comment thread test/cli/test-other.py Outdated

# check the version it should be as in cfg
exitcode, stdout, stderr = cppcheck([cppcheck_exe, '--version'])
assert stdout == product_name + '\n'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe stdout.strip() == product_name would be somewhat better. So it doesn't care if there is "\r\n" in windows. or extra newlines.

Comment thread test/cli/test-other.py

# should be fine now
exitcode, stdout, stderr = cppcheck([cppcheck_exe, '--premium=misra-c++-2008', test_file])
exitcode, stdout, stderr = cppcheck(['--premium=misra-c++-2008', test_file], None, True, cppcheck_exe)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than providing all arguments explicitly it's better to write:

exitcode, stdout, stderr = cppcheck(['--premium=misra-c++-2008', test_file], cppcheck_exe=cppcheck_exe)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants