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

Fix issues reported by cppcheck #1652

Merged
merged 10 commits into from May 14, 2019

Conversation

@bb111189
Copy link
Member

commented May 9, 2019

Description

This PR fixes issues reported by cppcheck. Issues are

  • Missing bracket for one of log message
  • Pass in by ref where possible
  • Remove unused vars
  • Remove c_str() from throw
  • Use prefix operator for non-primitive type

cppcheck options used

cppcheck --force --enable=all .

Backward Compatibility

  • This is not a breaking change
  • This is a breaking change

Review Suggestion

Status

Implementation

  • ready for review

Integration Test (Core Team)

  • local machine test
  • medium-scale cloud test
@bb111189 bb111189 added the Untested label May 9, 2019
@bb111189 bb111189 self-assigned this May 9, 2019
@bb111189 bb111189 added this to PRs in development in Core via automation May 9, 2019
@codecov-io

This comment has been minimized.

Copy link

commented May 9, 2019

Codecov Report

Merging #1652 into master will increase coverage by <.01%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master    #1652      +/-   ##
==========================================
+ Coverage   33.75%   33.75%   +<.01%     
==========================================
  Files         270      270              
  Lines       32850    32846       -4     
==========================================
- Hits        11087    11086       -1     
+ Misses      21763    21760       -3
Impacted Files Coverage Δ
src/libPersistence/ContractStorage.cpp 65.38% <ø> (-0.14%) ⬇️
src/libData/AccountData/Transaction.h 93.33% <ø> (ø) ⬆️
src/libData/AccountData/Transaction.cpp 89.88% <ø> (ø) ⬆️
src/libPersistence/Retriever.cpp 0% <0%> (ø) ⬆️
src/libNetwork/P2PComm.cpp 5.13% <0%> (ø) ⬆️
tests/Data/BlockChainData/Test_BlockChain.cpp 97.7% <0%> (ø) ⬆️
...rc/libDirectoryService/FinalBlockPreProcessing.cpp 0% <0%> (ø) ⬆️
src/libConsensus/ConsensusCommon.cpp 3.03% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7cd64e2...6496f37. Read the comment docs.

@bb111189 bb111189 force-pushed the fix/cppchecker_run branch from 109b6e4 to 040f35a May 13, 2019
@bb111189 bb111189 requested review from kaikawaliu and ansnunez May 13, 2019
@bb111189 bb111189 changed the title Fix issues reported by cppchecker Fix issues reported by cppcheck May 13, 2019
@bb111189 bb111189 added enhancement Ready and removed Untested labels May 13, 2019
@@ -303,7 +302,7 @@ BOOST_AUTO_TEST_CASE(TxBlock_test) {
const std::vector<Transaction> tranData2 = block2.GetTranData();

uint32_t type2_large = type2;
LOG_GENERAL(INFO, "Block 2 type: " << type2_large);
LOG_GENERAL(INFO, "Block 2 type: " << type2_large));

This comment has been minimized.

Copy link
@kaikawaliu

kaikawaliu May 13, 2019

Contributor

Why here got an extra close bracket

This comment has been minimized.

Copy link
@bb111189

bb111189 May 13, 2019

Author Member

Fixed

@ansnunez ansnunez moved this from PRs in development to PRs needing review (please help!) in Core May 14, 2019
Core automation moved this from PRs needing review (please help!) to PRs approved - ready to merge! May 14, 2019
@ansnunez ansnunez merged commit 80a8008 into master May 14, 2019
2 checks passed
2 checks passed
Travis CI - Branch Build Passed
Details
Travis CI - Pull Request Build Passed
Details
Core automation moved this from PRs approved - ready to merge! to PRs done (merged) May 14, 2019
@Gnnng Gnnng deleted the fix/cppchecker_run branch Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Core
  
PRs done (merged)
4 participants
You can’t perform that action at this time.