Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-complete-cicd-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
echo "### Essential Documentation Files:" >> /tmp/review-results/documentation.md
for doc in README.md CONTRIBUTING.md LICENSE.md CHANGELOG.md CODE_OF_CONDUCT.md SECURITY.md; do
if [ -f "$doc" ]; then
word_count=$(wc -w < "$doc" 2>/dev/null || echo 0)
word_count=$(wc -w < "$doc" 2>/dev/null | tr -d ' \t\n\r' || echo 0)
echo "✅ $doc ($word_count words)" >> /tmp/review-results/documentation.md
else
echo "❌ $doc (missing)" >> /tmp/review-results/documentation.md
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-copilot-code-cleanliness-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
! -path "*/build/*" \
! -path "*/.venv/*" \
! -path "*/vendor/*" \
-exec sh -c 'count=$(grep -c "$1" "$2" 2>/dev/null || echo 0); if [ "$count" -gt 20 ]; then echo "$count definitions in $2"; fi' _ "$pattern" {} \; \
-exec sh -c 'count=$(grep -c "$1" "$2" 2>/dev/null | tr -d " \t\n\r" || echo 0); count=${count:-0}; if [ "$count" -gt 20 ] 2>/dev/null; then echo "$count definitions in $2"; fi' _ "$pattern" {} \; \
2>/dev/null || true
done | sort -rn >> /tmp/analysis.md

Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/auto-copilot-functionality-docs-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ jobs:
echo "### README.md Quality Check:" >> /tmp/doc-analysis.md

if [ -f "README.md" ]; then
word_count=$(wc -w < README.md)
word_count=$(wc -w < README.md | tr -d ' \t\n\r')
echo "- Word count: $word_count" >> /tmp/doc-analysis.md

if [ $word_count -lt 50 ]; then
if [ "$word_count" -lt 50 ] 2>/dev/null; then
echo "⚠️ README.md is very short (< 50 words)" >> /tmp/doc-analysis.md
else
echo "✅ README.md has adequate content" >> /tmp/doc-analysis.md
Expand Down Expand Up @@ -177,12 +177,17 @@ jobs:
! -name "__init__.py" \
-type f | while read -r file; do
# Count functions and classes
func_count=$(grep -c "^def " "$file" 2>/dev/null || echo 0)
class_count=$(grep -c "^class " "$file" 2>/dev/null || echo 0)
docstring_count=$(grep -c '"""' "$file" 2>/dev/null || echo 0)
func_count=$(grep -c "^def " "$file" 2>/dev/null | tr -d ' \t\n\r' || echo 0)
class_count=$(grep -c "^class " "$file" 2>/dev/null | tr -d ' \t\n\r' || echo 0)
docstring_count=$(grep -c '"""' "$file" 2>/dev/null | tr -d ' \t\n\r' || echo 0)

# Ensure variables are numeric
func_count=${func_count:-0}
class_count=${class_count:-0}
docstring_count=${docstring_count:-0}

total=$((func_count + class_count))
if [ $total -gt 0 ] && [ $docstring_count -eq 0 ]; then
if [ "$total" -gt 0 ] && [ "$docstring_count" -eq 0 ] 2>/dev/null; then
echo "⚠️ $file: $total definitions, no docstrings" >> /tmp/doc-analysis.md
fi
done
Expand All @@ -198,12 +203,17 @@ jobs:
! -path "*/build/*" \
-type f | while read -r file; do
# Count functions and classes
func_count=$(grep -cE "(^function |^export function |^const .* = .*=>)" "$file" 2>/dev/null || echo 0)
class_count=$(grep -c "^class " "$file" 2>/dev/null || echo 0)
jsdoc_count=$(grep -c '/\*\*' "$file" 2>/dev/null || echo 0)
func_count=$(grep -cE "(^function |^export function |^const .* = .*=>)" "$file" 2>/dev/null | tr -d ' \t\n\r' || echo 0)
class_count=$(grep -c "^class " "$file" 2>/dev/null | tr -d ' \t\n\r' || echo 0)
jsdoc_count=$(grep -c '/\*\*' "$file" 2>/dev/null | tr -d ' \t\n\r' || echo 0)

# Ensure variables are numeric
func_count=${func_count:-0}
class_count=${class_count:-0}
jsdoc_count=${jsdoc_count:-0}

total=$((func_count + class_count))
if [ $total -gt 5 ] && [ $jsdoc_count -eq 0 ]; then
if [ "$total" -gt 5 ] && [ "$jsdoc_count" -eq 0 ] 2>/dev/null; then
echo "⚠️ $file: ~$total definitions, no JSDoc comments" >> /tmp/doc-analysis.md
fi
done
Expand Down
48 changes: 48 additions & 0 deletions add_payload_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3

# Script to add the missing payload test to payloads_spec.rb
import os

# Read the current file
with open('/workspace/spec/modules/payloads_spec.rb', 'r') as f:
lines = f.readlines()

# Find the insertion point (after line containing "reference_name: 'multi/meterpreter/reverse_https'")
insertion_point = None
for i, line in enumerate(lines):
if "reference_name: 'multi/meterpreter/reverse_https'" in line:
# Find the next "end" line
for j in range(i + 1, len(lines)):
if lines[j].strip() == 'end':
insertion_point = j + 1
break
break

if insertion_point is None:
print("Could not find insertion point")
exit(1)

print(f"Found insertion point at line {insertion_point + 1}")

# The new payload test definition
new_payload_test = [
"\n",
" context 'multi/malware_dropper' do\n",
" it_should_behave_like 'payload cached size is consistent',\n",
" ancestor_reference_names: [\n",
" 'singles/multi/malware_dropper'\n",
" ],\n",
" dynamic_size: false,\n",
" modules_pathname: modules_pathname,\n",
" reference_name: 'multi/malware_dropper'\n",
" end\n"
]

# Insert the new test
lines[insertion_point:insertion_point] = new_payload_test

# Write the modified file
with open('/workspace/spec/modules/payloads_spec.rb', 'w') as f:
f.writelines(lines)

print("Successfully added malware_dropper payload test")
112 changes: 0 additions & 112 deletions analyze_ruby_files.py

This file was deleted.

Loading
Loading