whitesmith / whitesmith/rubycritic

Report directory structure when comparing branches seems off

Open
#287 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.5k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

When running rubycritic in CI mode, the report-folder seems to be weirdly nested.

After executing the following command (while on a branch called test-123):

$ rubycritic --mode-ci=develop --format=json app

I get the following directory structure:

tmp/rubycritic/
├── build_number.txt
└── compare
    ├── build_details.txt
    └── develop
        ├── compare
        │   └── test-123
        │       ├── compare
        │       │   └── report.json
        │       └── report.json
        └── report.json

I would expect the structure to be this:

tmp/rubycritic/
├── build_number.txt
└── compare
    ├── build_details.txt
    ├── develop
    │   └── report.json
    ├── test-123
    │   └── report.json
    └── report.json

Actually, when generating a HTML report, the links in the top right corner also seem to expect this structure.

Version
Ruby 2.3.7
RubyCritic 3.5.2

I am happy to create a PR for this, jut wanted to confirm first if this is an actual issue. I think the problem is that Config.root is overwritten in two places during the branch comparison and not reset to its initial value: here and here.

While at it, I have two additional questions regarding the CI mode (happy to create separate issues if preferred):

  • The help (and also the readme) states that the CI mode will be faster. This currently seems to not be the case, as it runs a full analysis of both branches, and then looks at the diff. So it's about twice as slow as the normal run. Maybe I am doing something wrong (see command above)?
  • Wouldn't it make more sense to include the information stored in build_details.txt in the json output, so that it can be easily parsed?

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

Reproduce the CI comparison with rubycritic --mode-ci=develop --format=json app and inspect lib/rubycritic/commands/compare.rb, especially the linked lines 52 and 60 where Config.root is changed. Compare the generated report paths with the expected tmp/rubycritic/compare layout and verify that the HTML links resolve to the same structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devtools
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.