Skip to content

bcon.c from C Driver for MongoDB#14

Open
pavel-ignatovich wants to merge 1 commit intomasterfrom
c_mongo-c-driver-legacy_bcon.c
Open

bcon.c from C Driver for MongoDB#14
pavel-ignatovich wants to merge 1 commit intomasterfrom
c_mongo-c-driver-legacy_bcon.c

Conversation

@pavel-ignatovich
Copy link
Copy Markdown

Copy link
Copy Markdown

@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: 7

Comment thread bcon.c
return Token_Default;
}

static bcon_error_t bson_bcon_key_value(bson *b, const char *key, const char *typespec, const bcon bci) {
Copy link
Copy Markdown

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

bson_bcon_key_value( bson * b , const char * key , const char * typespec , const bcon bci) now spans 88 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

Comment thread bcon.c
/*
* simplified FSM to parse BCON structure, uses stacks for sub-documents and sub-arrays
*/
static bcon_error_t bson_append_bcon_with_state(bson *b, const bcon *bc, bcon_state_t start_state) {
Copy link
Copy Markdown

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

bson_append_bcon_with_state( bson * b , const bcon * bc , bcon_state_t start_state) now spans 103 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

Comment thread bcon.c
return ( ret == BSON_OK ? BCON_OK : BCON_BSON_ERROR );
}

void bcon_print(const bcon *bc) { /* prints internal representation, not JSON */
Copy link
Copy Markdown

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

bcon_print( const bcon * bc) now spans 79 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

Comment thread bcon.c
/* should be static, but it used by test files */
bcon_token_t bcon_token(char *s);

bcon_token_t bcon_token(char *s) {
Copy link
Copy Markdown

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

bcon_token( char * s) now has cyclomatic complexity of 21.
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

Comment thread bcon.c
return Token_Default;
}

static bcon_error_t bson_bcon_key_value(bson *b, const char *key, const char *typespec, const bcon bci) {
Copy link
Copy Markdown

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

bson_bcon_key_value( bson * b , const char * key , const char * typespec , const bcon bci) now has cyclomatic complexity of 43.
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

Comment thread bcon.c
/*
* simplified FSM to parse BCON structure, uses stacks for sub-documents and sub-arrays
*/
static bcon_error_t bson_append_bcon_with_state(bson *b, const bcon *bc, bcon_state_t start_state) {
Copy link
Copy Markdown

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

bson_append_bcon_with_state( bson * b , const bcon * bc , bcon_state_t start_state) now has cyclomatic complexity of 20.
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

Comment thread bcon.c
return ( ret == BSON_OK ? BCON_OK : BCON_BSON_ERROR );
}

void bcon_print(const bcon *bc) { /* prints internal representation, not JSON */
Copy link
Copy Markdown

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

bcon_print( const bcon * bc) now has cyclomatic complexity of 66.
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

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