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

Collapse extra context #61

Closed
rdb opened this issue Feb 12, 2023 · 1 comment · Fixed by #70
Closed

Collapse extra context #61

rdb opened this issue Feb 12, 2023 · 1 comment · Fixed by #70
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@rdb
Copy link

rdb commented Feb 12, 2023

clang-tidy can be extremely verbose, adding lots of context that can be useful but is often redundant and can cause extremely long comments.

It would be great if the additional context, if present, could be hidden underneath a collapsible section, like so:


warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]

  return result;
  ^
Additional context

panda/src/downloadertools/multify.cxx:784: Assuming 'argc' is >= 2

  if (argc < 2) {
      ^

panda/src/downloadertools/multify.cxx:784: Taking false branch

  if (argc < 2) {
  ^

panda/src/downloadertools/multify.cxx:791: 'argc' is >= 2

  if (argc >= 2) {
      ^

panda/src/downloadertools/multify.cxx:791: Taking true branch

  if (argc >= 2) {
  ^

panda/src/downloadertools/multify.cxx:792: Assuming the condition is false

    if (*argv[1] != '-' && *argv[1] != '\0') {
        ^

panda/src/downloadertools/multify.cxx:792: Left side of '&&' is false

    if (*argv[1] != '-' && *argv[1] != '\0') {
                        ^

panda/src/downloadertools/multify.cxx:807: Left side of '&&' is false

  if (source_date_epoch_str != nullptr && source_date_epoch_str[0] != 0) {
                                       ^

panda/src/downloadertools/multify.cxx:817: Assuming the condition is false

  while (flag != EOF) {
         ^

panda/src/downloadertools/multify.cxx:817: Loop condition is false. Execution continues on line 953

  while (flag != EOF) {
  ^

panda/src/downloadertools/multify.cxx:956: Assuming 'create' is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
       ^

panda/src/downloadertools/multify.cxx:956: '?' condition is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
       ^

panda/src/downloadertools/multify.cxx:956: Assuming 'append' is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                      ^

panda/src/downloadertools/multify.cxx:956: '?' condition is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                      ^

panda/src/downloadertools/multify.cxx:956: Assuming 'update' is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                     ^

panda/src/downloadertools/multify.cxx:956: '?' condition is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                     ^

panda/src/downloadertools/multify.cxx:956: Assuming 'tlist' is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                                    ^

panda/src/downloadertools/multify.cxx:956: '?' condition is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                                    ^

panda/src/downloadertools/multify.cxx:956: Assuming 'extract' is true

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                                                  ^

panda/src/downloadertools/multify.cxx:956: '?' condition is true

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                                                  ^

panda/src/downloadertools/multify.cxx:956: Assuming 'kill_cmd' is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                                                                  ^

panda/src/downloadertools/multify.cxx:956: '?' condition is false

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
                                                                                  ^

panda/src/downloadertools/multify.cxx:956: Taking false branch

  if ((create?1:0) + (append?1:0) + (update?1:0) + (tlist?1:0) + (extract?1:0) + (kill_cmd?1:0) != 1) {
  ^

panda/src/downloadertools/multify.cxx:962: Assuming 'got_multifile_name' is true

  if (!got_multifile_name) {
      ^

panda/src/downloadertools/multify.cxx:962: Taking false branch

  if (!got_multifile_name) {
  ^

panda/src/downloadertools/multify.cxx:977: Assuming 'i' is >= 'argc'

  for (int i = 1; i < argc; i++) {
                  ^

panda/src/downloadertools/multify.cxx:977: Loop condition is false. Execution continues on line 982

  for (int i = 1; i < argc; i++) {
  ^

panda/src/downloadertools/multify.cxx:982: Assuming 'create' is true

  if (create || append || update) {
      ^

panda/src/downloadertools/multify.cxx:982: Left side of '||' is true

  if (create || append || update) {
             ^

panda/src/downloadertools/multify.cxx:983: Calling 'add_files'

    okflag = add_files(params);
             ^

panda/src/downloadertools/multify.cxx:381: Assuming 'append' is false

  if (append || update) {
      ^

panda/src/downloadertools/multify.cxx:381: Left side of '||' is false

  if (append || update) {
      ^

panda/src/downloadertools/multify.cxx:381: Assuming 'update' is false

  if (append || update) {
                ^

panda/src/downloadertools/multify.cxx:381: Taking false branch

  if (append || update) {
  ^

panda/src/downloadertools/multify.cxx:387: Assuming the condition is false

    if (!multifile->open_write(multifile_name)) {
        ^

panda/src/downloadertools/multify.cxx:387: Taking false branch

    if (!multifile->open_write(multifile_name)) {
    ^

panda/src/downloadertools/multify.cxx:396: Assuming 'got_record_timestamp_flag' is false

  if (got_record_timestamp_flag) {
      ^

panda/src/downloadertools/multify.cxx:396: Taking false branch

  if (got_record_timestamp_flag) {
  ^

panda/src/downloadertools/multify.cxx:400: Assuming 'encryption_flag' is false

  if (encryption_flag) {
      ^

panda/src/downloadertools/multify.cxx:400: Taking false branch

  if (encryption_flag) {
  ^

panda/src/downloadertools/multify.cxx:405: Assuming 'got_header_prefix' is false

  if (got_header_prefix) {
      ^

panda/src/downloadertools/multify.cxx:405: Taking false branch

  if (got_header_prefix) {
  ^

panda/src/downloadertools/multify.cxx:409: Assuming 'scale_factor' is equal to 0

  if (scale_factor != 0 && scale_factor != multifile->get_scale_factor()) {
      ^

panda/src/downloadertools/multify.cxx:409: Left side of '&&' is false

  if (scale_factor != 0 && scale_factor != multifile->get_scale_factor()) {
                        ^

panda/src/downloadertools/multify.cxx:419: Loop condition is false. Execution continues on line 426

  for (si = params.begin(); si != params.end(); ++si) {
  ^

panda/src/downloadertools/multify.cxx:425: Assuming 'got_chdir_to' is false

  if (got_chdir_to && !chdir_to.chdir()) {
      ^

panda/src/downloadertools/multify.cxx:425: Left side of '&&' is false

  if (got_chdir_to && !chdir_to.chdir()) {
                   ^

panda/src/downloadertools/multify.cxx:430: Calling 'do_add_files'

  bool okflag = do_add_files(multifile, filenames);
                ^

panda/src/downloadertools/multify.cxx:338: Loop condition is true. Entering loop body

  for (fi = filenames.begin(); fi != filenames.end(); ++fi) {
  ^

panda/src/downloadertools/multify.cxx:341: Assuming the condition is false

    if (subfile_name.is_directory()) {
        ^

panda/src/downloadertools/multify.cxx:341: Taking false branch

    if (subfile_name.is_directory()) {
    ^

panda/src/downloadertools/multify.cxx:346: Assuming the condition is false

    } else if (!subfile_name.exists()) {
               ^

panda/src/downloadertools/multify.cxx:346: Taking false branch

    } else if (!subfile_name.exists()) {
           ^

panda/src/downloadertools/multify.cxx:351: Taking false branch

      if (is_text(subfile_name)) {
      ^

panda/src/downloadertools/multify.cxx:358: Assuming 'update' is false

      if (update) {
          ^

panda/src/downloadertools/multify.cxx:358: Taking false branch

      if (update) {
      ^

panda/src/downloadertools/multify.cxx:363: Calling 'get_compression_level'

          (subfile_name, subfile_name, get_compression_level(subfile_name));
                                       ^

panda/src/downloadertools/multify.cxx:297: 'result' declared without an initial value

  int result;
  ^

panda/src/downloadertools/multify.cxx:298: Assuming 'compress_flag' is true

  if (!compress_flag) {
      ^

panda/src/downloadertools/multify.cxx:298: Taking false branch

  if (!compress_flag) {
  ^

panda/src/downloadertools/multify.cxx:303: Calling 'operator!='

  if (dont_compress.find(ext) != dont_compress.end()) {
      ^

/usr/include/c++/11/bits/stl_tree.h:401: Assuming '__x._M_node' is equal to '__y._M_node'

      { return __x._M_node != __y._M_node; }
               ^

/usr/include/c++/11/bits/stl_tree.h:401: Returning zero, which participates in a condition later

      { return __x._M_node != __y._M_node; }
        ^

panda/src/downloadertools/multify.cxx:303: Returning from 'operator!='

  if (dont_compress.find(ext) != dont_compress.end()) {
      ^

panda/src/downloadertools/multify.cxx:303: Taking false branch

  if (dont_compress.find(ext) != dont_compress.end()) {
  ^

panda/src/downloadertools/multify.cxx:309: Undefined or garbage value returned to caller

  return result;
  ^
@ZedThree
Copy link
Owner

That is a great idea, thanks @rdb! I might have time to implement that this week, but if you're able to add it yourself, PRs are always greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
2 participants