Skip to content

Commit

Permalink
Properly handle cases when path to a file with a defect is unknown
Browse files Browse the repository at this point in the history
Resolves #4237
  • Loading branch information
valeros committed Apr 27, 2022
1 parent 4151f53 commit 285f19e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Please check `Migration guide from 5.x to 6.0 <https://docs.platformio.org/en/la

- Added support for the custom `Clang-Tidy <https://docs.platformio.org/en/latest/plus/check-tools/clang-tidy.html>`__ configuration file (`issue #4186 <https://github.com/platformio/platformio-core/issues/4186>`_)
- Added ability to override a tool version using the `platform_packages <https://docs.platformio.org/en/latest/projectconf/section_env_platform.html#platform-packages>`__ option (`issue #3798 <https://github.com/platformio/platformio-core/issues/3798>`_)
- Fixed an issue with improper handling of defects that don't specify a source file (`issue #4237 <https://github.com/platformio/platformio-core/issues/4237>`_)

* **Build System**

Expand Down
4 changes: 2 additions & 2 deletions platformio/commands/check/defect.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
severity,
category,
message,
file="unknown",
file=None,
line=0,
column=0,
id=None,
Expand All @@ -50,7 +50,7 @@ def __init__(
self.callstack = callstack
self.cwe = cwe
self.id = id
self.file = file
self.file = file or "unknown"
if file.lower().startswith(get_project_dir().lower()):
self.file = os.path.relpath(file, get_project_dir())

Expand Down

0 comments on commit 285f19e

Please sign in to comment.