bento icon indicating copy to clipboard operation
bento copied to clipboard

bento archive fails to archive issues

Open ievans opened this issue 5 years ago • 2 comments

Overview

Briefly describe the issue and your expected behavior

Bento archive failed to actually archive a check on commit a5d11ee in https://github.com/returntocorp/sgrep-rules/compare/ie/useless-comparison-check-test?expand=1

Current Behavior

ine@I ~/D/r/sgrep-rules (ie/useless-comparison-check-test)> git commit -am "test case"

Running Bento checks on staged files...

bandit․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․|■■■■■■■■■■| 00:00, 🍱 Done
flake8․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․|■■■■■■■■■■| 00:00, 🍱 Done
r2c.click․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․|■■■■■■■■■■| 00:00, 🍱 Done
r2c.flask․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․|■■■■■■■■■■| 00:00, 🍱 Done
r2c.requests․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․|■■■■■■■■■■| 00:00, 🍱 Done

flake8 undefined-name
     > python/deadcode/useless-comparison.py:24
     ╷
   24│   if some_id == "foobar":
     ╵
     = undefined name 'some_id'

⚠ 1 finding(s) due to staged changes in 1.24 s

Please fix these issues, or:

◦ To archive findings as tech debt, run $ bento archive
◦ To disable a specific check, run $ bento disable check TOOL CHECK
◦ Not showing 5 archived finding(s). To view, run $ cat .bento/archive.json

But bento archive doesn't work...

ine@ ~/D/r/sgrep-rules (ie/useless-comparison-check-test) [1]> bento archive

Running Bento archive on staged files...

⚠ Nothing to check or archive. Please confirm that changes are staged and not
excluded by `.bentoignore`. To check all Git tracked files, use `--all`.

0 finding(s) due to staged changes were archived, and will be hidden in future Bento runs.

◦ To view archived results, run $ cat .bento/archive.json

Possible Solution

Do you have an idea for how to address the issue or feedback?

Additional Context

Bento version (run bento --version): 0.9.0 Operation system (e.g. Ubuntu 18.04): Mac OSX

ievans avatar Feb 18 '20 21:02 ievans

Hi @ievans

Can you please post the file diff you were trying to commit, in order to aid in issue reproduction?

Thanks!

nbrahms avatar Feb 19 '20 17:02 nbrahms

I looked into this a little.

It turns out that git commit -a does not leave diffs staged if the commit fails. (This would make sense, as git commit is supposed to be atomic).

In order to archive you would need to first:

git add <file>

then run archive.

nbrahms avatar Feb 19 '20 17:02 nbrahms