ruby / ruby/rdoc

Static analysis errors

Open
#415 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
930
Forks
465
Avg merge
3d 10h
Merged PRs (30d)
27

Description

Running recent Coverity on my package in Fedora, I got some error reports about the generated documentation:

Error: NESTING_INDENT_MISMATCH: [#def1]
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:62: parent: This 'if'  statement is the parent, indented to column 9.
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:63: nephew: This  statement is nested within its parent, indented to column 11.
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:64: uncle: This  statement is indented to column 11, as if it were nested within the preceding parent statement, but it is not.
#   62|           if (this.$current)
#   63|             e.preventDefault();
#   64|->           this.select(this.$current);
#   65|           break;
#   66|       }

Error: IDENTIFIER_TYPO: [#def2]
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:83: identifier_typo: Using "moveTimout" appears to be a typo:
* Identifier "moveTimout" is only known to be referenced here, or in copies of this code.
* Identifier "moveTimeout" is referenced elsewhere at least 5 times.
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:71: identifier_use: Example 1: Using identifier "moveTimeout" (2 total uses in this function).
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:77: identifier_use: Example 2: Using identifier "moveTimeout" (2 total uses in this function).
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:81: identifier_use: Example 3: Using identifier "moveTimeout".
rubygem-gem2rpm-0.11.3/usr/share/gems/doc/gem2rpm-0.11.3/rdoc/js/navigation.js:83: remediation: Should identifier "moveTimout" be replaced by "moveTimeout"?
#   81|         if (!_this.moveTimeout) return;
#   82|         _this[isDown ? 'moveDown' : 'moveUp']();
#   83|->       _this.moveTimout = setTimeout(go, 100);
#   84|       }
#   85|       this.moveTimeout = setTimeout(go, 200);

Both of them seems to be legit to me ... Actually for the first one, I'd say there might be missing braces?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how RDoc generates rdoc/js/navigation.js from the reported generated documentation. Inspect the source responsible for the indentation around lines 62-65 and the moveTimout reference around line 83. Done means the generated JavaScript no longer produces these Coverity errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ruby
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.