Skip to content

Commit

Permalink
Merge pull request #18 from 0xPolygon/dev
Browse files Browse the repository at this point in the history
fix: skip → omit
  • Loading branch information
ZeroEkkusu authored Jan 11, 2024
2 parents 961d288 + 5797469 commit 117bf04
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ When the storage is not clean.

## Configuration

| Option | Values | Description |
| -------- | ------ | ---------------------------------------------------- |
| `--skip` | `new` | Does not generate a report with only those findings. |
| Option | Values | Description |
| -------- | ------ | -------------------------------------------------- |
| `--omit` | `new` | Do not generate a report with only those findings. |

## Requirements

Expand Down
8 changes: 4 additions & 4 deletions _reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const path = require("path");
const oldData = JSON.parse(process.argv[2]);
const newData = JSON.parse(process.argv[3]);
const contractPath = path.parse(process.argv[4]);
const skipNew = process.argv[5];
const omitNew = process.argv[5];

// Skip if same
// Omit if same
if (JSON.stringify(oldData) === JSON.stringify(newData)) process.exit(0);

// ========== VISUALIZE LAYOUTS ==========
Expand Down Expand Up @@ -118,8 +118,8 @@ for (; i < alignedOldVisualized.length; i++) {

// ========== OPTIONS ==========

// Skip if only new findings
if (!["🏴", "🏳️", "🏁", "🪦"].some((emoji) => reportNew.includes(emoji)) && skipNew) process.exit(1);
// --omit report if only New findings
if (!["🏴", "🏳️", "🏁", "🪦"].some((emoji) => reportNew.includes(emoji)) && omitNew) process.exit(1);

// ========== REPORT FINDINGS ==========

Expand Down
12 changes: 6 additions & 6 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ fi

# Process positional arguments
POSITIONAL_ARGS=()
SKIP_NEW=0
OMIT_NEW=0

# Parsing the command-line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--skip)
shift # Remove --skip from processing
--omit)
shift # Remove --omit from processing
if [[ $1 == "new" ]]; then
SKIP_NEW=1
OMIT_NEW=1
shift # Remove the value from processing
else
echo "Usage: --skip new"
echo "Usage: --omit new"
exit 1
fi
;;
Expand Down Expand Up @@ -145,6 +145,6 @@ for line in "${filesWithPath_old[@]}"; do
cd "$current_dir"
output_new=$(forge inspect $formated_name storage)

node ./lib/storage-delta/_reporter.js "$output_old" "$output_new" ${line} $SKIP_NEW
node ./lib/storage-delta/_reporter.js "$output_old" "$output_new" ${line} $OMIT_NEW
fi
done

0 comments on commit 117bf04

Please sign in to comment.