Skip to content

Commit

Permalink
Refine Radon analysis workflow to capture raw output and improve meth…
Browse files Browse the repository at this point in the history
…od detection
  • Loading branch information
josephmancuso committed Nov 21, 2024
1 parent 85b0643 commit 7657fa4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/radon-anylsis-granular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ jobs:
for FILE in $CHANGED_FILES; do
echo "Processing file: $FILE"
# Get method names and their line numbers
METHODS=$(radon cc $FILE -s | grep -oP "^\s*\d+.*\K[^\(]+" || true)
# Run radon cc and check the raw output
RADON_OUTPUT=$(radon cc $FILE -s || true)
echo "Raw Radon Output for $FILE:"
echo "$RADON_OUTPUT"
# Check if there are methods in the output
METHODS=$(echo "$RADON_OUTPUT" | grep -oP "^\s*\d+.*\K[^\(]+" || true)
echo "Methods found: $METHODS"
# Extract the lines that are changed in this file
Expand All @@ -50,7 +55,7 @@ jobs:
LINE_NUMBER=$(echo $LINE | grep -oP '(?<=\+)\d+')
# Match the method based on line number
MATCHING_METHOD=$(radon cc $FILE -s | awk -v line=$LINE_NUMBER '{
MATCHING_METHOD=$(echo "$RADON_OUTPUT" | awk -v line=$LINE_NUMBER '{
if ($1 ~ /^[0-9]+:/ && $1 <= line) method=$NF;
if ($1 > line) { print method; exit }
}')
Expand Down

0 comments on commit 7657fa4

Please sign in to comment.