int a1; //-V861 CODE_BLOCK: int a1; //-V861 CODE_BLOCK: int a1; //-V861 CODE_BLOCK: int a2; //-V561 //-V861 //-V773 CODE_BLOCK: int a2; //-V561 //-V861 //-V773 CODE_BLOCK: int a2; //-V561 //-V861 //-V773 CODE_BLOCK: int a3; /* comment //-V861 */ CODE_BLOCK: int a3; /* comment //-V861 */ CODE_BLOCK: int a3; /* comment //-V861 */ CODE_BLOCK: std::string a4 = "//-V861"; //-V861 std::string a5 = "hello //-V861 \" world"; //-V861 CODE_BLOCK: std::string a4 = "//-V861"; //-V861 std::string a5 = "hello //-V861 \" world"; //-V861 CODE_BLOCK: std::string a4 = "//-V861"; //-V861 std::string a5 = "hello //-V861 \" world"; //-V861 CODE_BLOCK: { "version": 1, "files": [ { "path": "/path/to/file1", "hash": "d82b7bac944b7da5c9a13d0c48d285345368790f", "lines": [ { "line": 1, "markers": [ { "code": 567, "columns": { "begin": 1, "end": 2 }, "offsets": { "begin": 1, "end": 2 } }, { "code": 730, "columns": { "begin": 34, "end": 43 }, "offsets": { "begin": 34, "end": 47 } } ] }, { "line": 10, "markers": [ { "code": 568, "columns": { "begin": 3, "end": 7 }, "offsets": { "begin": 3, "end": 7 } }, { "code": 609, "columns": { "begin": 9, "end": 15 }, "offsets": { "begin": 9, "end": 20 } } ] } ] }, { "path": "/path/to/file2", "hash": "9bc0ced475c2df7103f34db6c1b407b7db79b4a4", "lines": [ { "line": 1, "markers": [ { "code": 557, "columns": { "begin": 5, "end": 8 }, "offsets": { "begin": 5, "end": 8 } }, { "code": 777, "columns": { "begin": 63, "end": 79 }, "offsets": { "begin": 63, "end": 84 } } ] }, { "line": 10, "markers": [ { "code": 501, "columns": { "begin": 20, "end": 25 }, "offsets": { "begin": 20, "end": 27 } }, { "code": 509, "columns": { "begin": 33, "end": 39 }, "offsets": { "begin": 33, "end": 42 } } ] } ] } ] } CODE_BLOCK: { "version": 1, "files": [ { "path": "/path/to/file1", "hash": "d82b7bac944b7da5c9a13d0c48d285345368790f", "lines": [ { "line": 1, "markers": [ { "code": 567, "columns": { "begin": 1, "end": 2 }, "offsets": { "begin": 1, "end": 2 } }, { "code": 730, "columns": { "begin": 34, "end": 43 }, "offsets": { "begin": 34, "end": 47 } } ] }, { "line": 10, "markers": [ { "code": 568, "columns": { "begin": 3, "end": 7 }, "offsets": { "begin": 3, "end": 7 } }, { "code": 609, "columns": { "begin": 9, "end": 15 }, "offsets": { "begin": 9, "end": 20 } } ] } ] }, { "path": "/path/to/file2", "hash": "9bc0ced475c2df7103f34db6c1b407b7db79b4a4", "lines": [ { "line": 1, "markers": [ { "code": 557, "columns": { "begin": 5, "end": 8 }, "offsets": { "begin": 5, "end": 8 } }, { "code": 777, "columns": { "begin": 63, "end": 79 }, "offsets": { "begin": 63, "end": 84 } } ] }, { "line": 10, "markers": [ { "code": 501, "columns": { "begin": 20, "end": 25 }, "offsets": { "begin": 20, "end": 27 } }, { "code": 509, "columns": { "begin": 33, "end": 39 }, "offsets": { "begin": 33, "end": 42 } } ] } ] } ] } CODE_BLOCK: { "version": 1, "files": [ { "path": "/path/to/file1", "hash": "d82b7bac944b7da5c9a13d0c48d285345368790f", "lines": [ { "line": 1, "markers": [ { "code": 567, "columns": { "begin": 1, "end": 2 }, "offsets": { "begin": 1, "end": 2 } }, { "code": 730, "columns": { "begin": 34, "end": 43 }, "offsets": { "begin": 34, "end": 47 } } ] }, { "line": 10, "markers": [ { "code": 568, "columns": { "begin": 3, "end": 7 }, "offsets": { "begin": 3, "end": 7 } }, { "code": 609, "columns": { "begin": 9, "end": 15 }, "offsets": { "begin": 9, "end": 20 } } ] } ] }, { "path": "/path/to/file2", "hash": "9bc0ced475c2df7103f34db6c1b407b7db79b4a4", "lines": [ { "line": 1, "markers": [ { "code": 557, "columns": { "begin": 5, "end": 8 }, "offsets": { "begin": 5, "end": 8 } }, { "code": 777, "columns": { "begin": 63, "end": 79 }, "offsets": { "begin": 63, "end": 84 } } ] }, { "line": 10, "markers": [ { "code": 501, "columns": { "begin": 20, "end": 25 }, "offsets": { "begin": 20, "end": 27 } }, { "code": 509, "columns": { "begin": 33, "end": 39 }, "offsets": { "begin": 33, "end": 42 } } ] } ] } ] } CODE_BLOCK: //-Vwarning-number CODE_BLOCK: //-Vwarning-number CODE_BLOCK: //-Vwarning-number CODE_BLOCK: if (a == b && a == b && 0 / 0 == 0) //-V501 //-V609 CODE_BLOCK: if (a == b && a == b && 0 / 0 == 0) //-V501 //-V609 CODE_BLOCK: if (a == b && a == b && 0 / 0 == 0) //-V501 //-V609 CODE_BLOCK: //-VH"hash" CODE_BLOCK: //-VH"hash" CODE_BLOCK: //-VH"hash" CODE_BLOCK: if (a == b && a == b && 0 / 0 == 0) //-V501 //-V609 //-VH"12345678" CODE_BLOCK: if (a == b && a == b && 0 / 0 == 0) //-V501 //-V609 //-VH"12345678" CODE_BLOCK: if (a == b && a == b && 0 / 0 == 0) //-V501 //-V609 //-VH"12345678" CODE_BLOCK: pvs-studio-analyzer analyze --redundant-false-alarms=/path/to/report.json \ --sourcetree-root=/path/to/project-root \ .... CODE_BLOCK: pvs-studio-analyzer analyze --redundant-false-alarms=/path/to/report.json \ --sourcetree-root=/path/to/project-root \ .... CODE_BLOCK: pvs-studio-analyzer analyze --redundant-false-alarms=/path/to/report.json \ --sourcetree-root=/path/to/project-root \ .... CODE_BLOCK: pvs-fp-cleaner cleanup \ --sourcetree-root=/path/to/project \ PATH... CODE_BLOCK: pvs-fp-cleaner cleanup \ --sourcetree-root=/path/to/project \ PATH... CODE_BLOCK: pvs-fp-cleaner cleanup \ --sourcetree-root=/path/to/project \ PATH... CODE_BLOCK: pvs-fp-cleaner cleanup \ --sourcetree-root=/home/user/project \ /home/user/windows_report.json \ /home/user/linux_report.json \ /home/user/macOS_report.json CODE_BLOCK: pvs-fp-cleaner cleanup \ --sourcetree-root=/home/user/project \ /home/user/windows_report.json \ /home/user/linux_report.json \ /home/user/macOS_report.json CODE_BLOCK: pvs-fp-cleaner cleanup \ --sourcetree-root=/home/user/project \ /home/user/windows_report.json \ /home/user/linux_report.json \ /home/user/macOS_report.json CODE_BLOCK: pvs-fp-cleaner merge \ --sourcetree-root=/path/to/project \ --output-file=/path/to/merged_report.json \ PATH... CODE_BLOCK: pvs-fp-cleaner merge \ --sourcetree-root=/path/to/project \ --output-file=/path/to/merged_report.json \ PATH... CODE_BLOCK: pvs-fp-cleaner merge \ --sourcetree-root=/path/to/project \ --output-file=/path/to/merged_report.json \ PATH... CODE_BLOCK: pvs-fp-cleaner report \ --sourcetree-root=/home/user/project \ --output-file=/home/user/report_for_IDE_plugin.json \ PATH... CODE_BLOCK: pvs-fp-cleaner report \ --sourcetree-root=/home/user/project \ --output-file=/home/user/report_for_IDE_plugin.json \ PATH... CODE_BLOCK: pvs-fp-cleaner report \ --sourcetree-root=/home/user/project \ --output-file=/home/user/report_for_IDE_plugin.json \ PATH... CODE_BLOCK: if ( Name.Contains(CtrlPrefix) && !DynamicHierarchy->Contains(....)) //-V1051 CODE_BLOCK: if ( Name.Contains(CtrlPrefix) && !DynamicHierarchy->Contains(....)) //-V1051 CODE_BLOCK: if ( Name.Contains(CtrlPrefix) && !DynamicHierarchy->Contains(....)) //-V1051 CODE_BLOCK: for (....) //-V621 //-V654 CODE_BLOCK: for (....) //-V621 //-V654 CODE_BLOCK: for (....) //-V621 //-V654 CODE_BLOCK: // The warning disable comment can can't be used in a macro: //-V501 CODE_BLOCK: // The warning disable comment can can't be used in a macro: //-V501 CODE_BLOCK: // The warning disable comment can can't be used in a macro: //-V501 CODE_BLOCK: LinkerSave.AdditionalDataToAppend.Add(....); \ // -V595 PVS believes that LinkerSave can potentially be nullptr at CODE_BLOCK: LinkerSave.AdditionalDataToAppend.Add(....); \ // -V595 PVS believes that LinkerSave can potentially be nullptr at CODE_BLOCK: LinkerSave.AdditionalDataToAppend.Add(....); \ // -V595 PVS believes that LinkerSave can potentially be nullptr at CODE_BLOCK: LinkerSave.AdditionalDataToAppend.Add(....); \ // PVS believes that LinkerSave can potentially be nullptr at CODE_BLOCK: LinkerSave.AdditionalDataToAppend.Add(....); \ // PVS believes that LinkerSave can potentially be nullptr at CODE_BLOCK: LinkerSave.AdditionalDataToAppend.Add(....); \ // PVS believes that LinkerSave can potentially be nullptr at - easy implementation: the utility just needs to read the information about redundant comments and delete them; - access to analysis configuration information, which lets us adjust the output—for example, keep markers for disabled diagnostic rules; - extensibility: the utility is independent of any specific language syntax. If the analyzer learns to work with a new language and transfer data in a standard format, the utility will be able to clean up comments without requiring any code modifications.
- It requires the full project analysis. If the analysis is integrated into CI/CD, so the report is available only after an overnight run.
- It's impossible to automatically delete comments from files not included in the analysis.
- We grouped the information by file. This allows us to handle them all at once.
- We added a checksum for each file. These steps helped resolve the following issues: if the utility is run twice on the same report, the source files won't change in later runs; if the utility is interrupted while running, but a user wants it to continue until it finishes. - if the utility is run twice on the same report, the source files won't change in later runs; - if the utility is interrupted while running, but a user wants it to continue until it finishes.
- We saved marker positions via byte shifts. This enabled the utility to ignore file encodings and language syntax. - if the utility is run twice on the same report, the source files won't change in later runs; - if the utility is interrupted while running, but a user wants it to continue until it finishes. - --redundant-false-alarms is a path to the report; - --sourcetree-root is the project root for correct relative path generation. - cleanup is the cleanup mode; - --sourcetree-root is a root project directory;
- PATH... is a report list. - merge is the merge mode; - --output-file is a final report.
- Of course, PVS-Studio—after all, if we don't check it ourselves, who will?
- Unreal Engine, which is a huge project with a rich history.
- Total number of false alarm markers: 744
- Redundant markers: 324
- Total number of false alarm markers: 2 215
- Redundant markers: 270