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

badblocks.c from rufus #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

pavel-ignatovich
Copy link

Copy link

@monocodus monocodus bot left a comment

Choose a reason for hiding this comment

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

This is autogenerated code-style review, new suggestions: 6

{
if (bb_u64_list_find(bb, blk) < 0)
return 0;
else
Copy link

Choose a reason for hiding this comment

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

Suggested change
else

This comment was generated with the following checker: ClangTidy

return got;
}

static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size, blk64_t first_block,
Copy link

Choose a reason for hiding this comment

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

The function is too long

test_rw( HANDLE hDrive , blk64_t last_block , size_t block_size , blk64_t first_block , size_t blocks_at_once , int pattern_type , int nb_passes) now spans 140 lines.
Corresponding modifications started here.
Keep your functions' length within 50 lines to improve readability.

This comment was generated with the following checker: long_method

/*
* This procedure adds a block to a badblocks list.
*/
static errcode_t bb_u64_list_add(bb_u64_list bb, uint64_t blk)
Copy link

Choose a reason for hiding this comment

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

The function is too complicated

bb_u64_list_add( bb_u64_list bb , uint64_t blk) now has cyclomatic complexity of 11.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.

This comment was generated with the following checker: high_cyclomatic_complexity

return got;
}

static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size, blk64_t first_block,
Copy link

Choose a reason for hiding this comment

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

The function is too complicated

test_rw( HANDLE hDrive , blk64_t last_block , size_t block_size , blk64_t first_block , size_t blocks_at_once , int pattern_type , int nb_passes) now has cyclomatic complexity of 46.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.

This comment was generated with the following checker: high_cyclomatic_complexity

return got;
}

static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size, blk64_t first_block,
Copy link

Choose a reason for hiding this comment

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

The function has too many parameters

test_rw( HANDLE hDrive , blk64_t last_block , size_t block_size , blk64_t first_block , size_t blocks_at_once , int pattern_type , int nb_passes) now has 7 parameters.
Functions with parameter list length above 5 are mostly hard to understand and use.
To reduce the number of arguments, you can isolate arguments used together into an object, or split the function

This comment was generated with the following checker: long_parameter_list

return bb_count;
}

BOOL BadBlocks(HANDLE hPhysicalDrive, ULONGLONG disk_size, int nb_passes,
Copy link

Choose a reason for hiding this comment

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

The function has too many parameters

BadBlocks( HANDLE hPhysicalDrive , ULONGLONG disk_size , int nb_passes , int flash_type , badblocks_report * report , FILE * fd) now has 6 parameters.
Functions with parameter list length above 5 are mostly hard to understand and use.
To reduce the number of arguments, you can isolate arguments used together into an object, or split the function

This comment was generated with the following checker: long_parameter_list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C/C++ Files in C or C++ Demonstration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant