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

PR for issue#70 #98

Merged
merged 10 commits into from
Mar 28, 2018
Merged

PR for issue#70 #98

merged 10 commits into from
Mar 28, 2018

Conversation

sagniknitr
Copy link
Contributor

No description provided.

@sloretz
Copy link
Contributor

sloretz commented Mar 16, 2018

Commenting to link to issue #70

Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

Please also run the unit tests locally to address code style violations

src/logging.c Outdated
const char * line_buffered;
const char * ret_str = rcutils_get_env("RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED", &line_buffered);

if (strcmp(line_buffered,"1")) {
Copy link
Member

Choose a reason for hiding this comment

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

Without checking ret_str for potential errors you can't access line_buffered. It might still be uninitialized.

See docblock.

src/logging.c Outdated
if (strcmp(line_buffered,"1")) {
g_force_stdout_line_buffered = true;
}
else if (NULL == ret_str || strcmp(output_format, "0") != 0) {
Copy link
Member

Choose a reason for hiding this comment

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

The check for NULL == ret_str seems also wrong here.

@dirk-thomas dirk-thomas added the in progress Actively being worked on (Kanban column) label Mar 17, 2018
@sagniknitr
Copy link
Contributor Author

@dirk-thomas Here is the unit test results after the recent commits
100% tests passed, 0 tests failed out of 30

Label Time Summary:
copyright = 0.34 secproc (1 test)
cppcheck = 0.76 sec
proc (2 tests)
cpplint = 2.68 secproc (2 tests)
flake8 = 0.54 sec
proc (1 test)
gmock = 0.79 secproc (2 tests)
gtest = 1.46 sec
proc (15 tests)
lint_cmake = 0.32 secproc (1 test)
linter = 6.36 sec
proc (10 tests)
pep257 = 0.39 secproc (1 test)
pytest = 0.88 sec
proc (2 tests)
uncrustify = 1.33 sec*proc (2 tests)

Total Test time (real) = 9.59 sec

src/logging.c Outdated
}
}
} else {
if (NULL != ret_str) {
Copy link
Member

Choose a reason for hiding this comment

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

This condition is redundant with line 68. Please remove it from the patch.

src/logging.c Outdated
}
} else {
if (NULL != ret_str) {
fprintf(stderr, "Error getting env var: %s\n", ret_str);
Copy link
Member

Choose a reason for hiding this comment

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

Please add the name of the environment variable here so that the reader has a better idea where it is failing.

Also added the name of the environment variable failing in the same function block,
@sagniknitr
Copy link
Contributor Author

@dirk-thomas Thanks for the review. Made the changes as requested.Also performed the unit test locally.
All the test cases are passing.

src/logging.c Outdated
}
} else {
fprintf(stderr, "Error getting env. variable"
"RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED %s\n", ret_str);
Copy link
Member

Choose a reason for hiding this comment

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

There is currently no space between the two wrapped string.

A colon after RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED before %s would be good too for the readability of the error message.

@sagniknitr
Copy link
Contributor Author

@dirk-thomas Oops.My apologies for overlooking that.

src/logging.c Outdated
if (!strcmp(line_buffered, "0")) {
fprintf(stderr,
"Warning: unexpected value %s specified for RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED."
"Default value 0 will be used. Valid values are 1 or 0.\n",
Copy link
Member

Choose a reason for hiding this comment

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

There is still no space between the two wrapped strings.

@dirk-thomas
Copy link
Member

I just applied the missing space I was referring to.

@dirk-thomas
Copy link
Member

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@dirk-thomas dirk-thomas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Mar 27, 2018
@dirk-thomas dirk-thomas merged commit ba3f589 into ros2:master Mar 28, 2018
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Mar 28, 2018
@dirk-thomas
Copy link
Member

@sagniknitr Thank you for contributing this option.

@sagniknitr
Copy link
Contributor Author

No problem @dirk-thomas . Thank you for reviewing my code.I really look forward to more contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants