BVE-Reborn / bve-reborn-archive

Mirror of https://gitlab.bvereborn.com/bve-reborn/bve-reborn-archive. Remake of OpenBVE to a Modern Architecture
https://bvereborn.com
GNU Lesser General Public License v2.1
4 stars 0 forks source link

Adds tests and error handling for route_markers xml parser #11

Closed KevinCybura closed 6 years ago

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 150


Changes Missing Coverage Covered Lines Changed/Added Lines %
libparsers/src/csv_rw_route/executor_pass3/track_misc.cpp 0 2 0.0%
libparsers/src/xml/route_marker.cpp 64 78 82.05%
<!-- Total: 73 89 82.02% -->
Totals Coverage Status
Change from base Build 132: 2.2%
Covered Lines: 2237
Relevant Lines: 6021

💛 - Coveralls
cwfitzgerald commented 6 years ago

For reference, here is the report from me linting the code. I'm only including the stuff relevant to this PR:

/home/connor/Dropbox/OpenBVE2/OpenBVE2/libparsers/src/xml/dynamic_background.cpp:14:47: warning: the parameter 'input_string' is copied for each invocation but only used as a const reference; consider making it a const reference  [performance-unnecessary-value-param]
                                                std::string input_string,
                                                ~~~         ^
                                                const      &
/home/connor/Dropbox/OpenBVE2/OpenBVE2/libparsers/src/xml/route_marker.cpp:184:6: warning: do not use 'else' after 'return'  [readability-else-after-return]
                                        else {
                                        ^~~~~~
/home/connor/Dropbox/OpenBVE2/OpenBVE2/libparsers/src/xml/route_marker.cpp:310:41: warning: the parameter 'input_string' is copied for each invocation but only used as a const reference; consider making it a const reference  [performance-unnecessary-value-param]
                                          std::string input_string,
                                          ~~~         ^
                                          const      &
/home/connor/Dropbox/OpenBVE2/OpenBVE2/libparsers/src/xml/dynamic_lighting.cpp:9:48: warning: the parameter 'input_string' is copied for each invocation but only used as a const reference; consider making it a const reference  [performance-unnecessary-value-param]
                                                 std::string input_string,
                                                 ~~~         ^
                                                 const      &

The warnings about the unnecessary value param are actually wrong, the linter isn't following the constness all the way down. I have commented those out, the only relevant thing that shows up is that if you return inside of an if statement, don't use an else.

I'm going to fix all of these, but something to be aware of.