|
56 | 56 | fi
|
57 | 57 | done
|
58 | 58 |
|
| 59 | + - name: initialize counters |
| 60 | + working-directory: ./${{ matrix.project }} |
| 61 | + run: | |
| 62 | + echo "for_loop_count=0" >> $GITHUB_ENV |
| 63 | + echo "for_loop_count_after=0" >> $GITHUB_ENV |
| 64 | + echo "iter_count=0" >> $GITHUB_ENV |
| 65 | + echo "iter_count_after=0" >> $GITHUB_ENV |
| 66 | + echo "iter_mut_count=0" >> $GITHUB_ENV |
| 67 | + echo "iter_mut_count_after=0" >> $GITHUB_ENV |
| 68 | + echo "into_iter_count=0" >> $GITHUB_ENV |
| 69 | + echo "into_iter_count_after=0" >> $GITHUB_ENV |
| 70 | + echo "par_iter_count=0" >> $GITHUB_ENV |
| 71 | + echo "into_par_iter_count=0" >> $GITHUB_ENV |
| 72 | + echo "par_iter_mut_count=0" >> $GITHUB_ENV |
| 73 | +
|
59 | 74 | - name: count for loops
|
60 | 75 | working-directory: ./${{ matrix.project }}
|
61 |
| - continue-on-error: true |
62 | 76 | shell: bash
|
63 | 77 | run: |
|
64 | 78 | while read -r file; do
|
|
71 | 85 |
|
72 | 86 | - name: count iterator methods
|
73 | 87 | working-directory: ./${{ matrix.project }}
|
74 |
| - continue-on-error: true |
75 | 88 | shell: bash
|
76 | 89 | run: |
|
77 | 90 | # Initialize counters
|
@@ -114,49 +127,46 @@ jobs:
|
114 | 127 |
|
115 | 128 | - name: count for loops after tool
|
116 | 129 | working-directory: ./${{ matrix.project }}
|
117 |
| - continue-on-error: true |
118 | 130 | shell: bash
|
119 | 131 | run: |
|
120 | 132 | while read -r file; do
|
121 | 133 | echo "Checking $file"
|
122 |
| - for_loop_count_in_file=$(grep -oE 'for\s+(\([^)]+\)|\w+)\s+in\s+[^{]+' "$file" | wc -l) |
123 |
| - echo "Count in file: $for_loop_count_in_file" |
124 |
| - ((for_loop_count += for_loop_count_in_file)) |
| 134 | + for_loop_count_after_in_file=$(grep -oE 'for\s+(\([^)]+\)|\w+)\s+in\s+[^{]+' "$file" | wc -l) |
| 135 | + echo "Count in file: $for_loop_count_after_in_file" |
| 136 | + ((for_loop_count_after += for_loop_count_after_in_file)) |
125 | 137 | done < <(find . -type f -name '*.rs')
|
126 |
| - echo "for loop occurrences: $for_loop_count" |
| 138 | + echo "for loop occurrences: $for_loop_count_after" |
127 | 139 |
|
128 | 140 | - name: count iterator methods after tool
|
129 | 141 | working-directory: ./${{ matrix.project }}
|
130 |
| - continue-on-error: true |
131 | 142 | shell: bash
|
132 | 143 | run: |
|
133 | 144 | # Initialize counters
|
134 |
| - iter_count=0 |
135 |
| - iter_mut_count=0 |
136 |
| - into_iter_count=0 |
| 145 | + iter_count_after=0 |
| 146 | + iter_mut_count_after=0 |
| 147 | + into_iter_count_after=0 |
137 | 148 |
|
138 | 149 | # Iterate over all .rs files in the current directory and subdirectories
|
139 | 150 | while read -r file; do
|
140 | 151 | echo checking $file
|
141 | 152 | # Count occurrences of iterator methods in the current file
|
142 |
| - iter_count_in_file=$(grep -o '\.iter()' "$file" | wc -l) |
143 |
| - iter_mut_count_in_file=$(grep -o '\.iter_mut()' "$file" | wc -l) |
144 |
| - into_iter_count_in_file=$(grep -o '\.into_iter()' "$file" | wc -l) |
| 153 | + iter_count_after_in_file=$(grep -o '\.iter()' "$file" | wc -l) |
| 154 | + iter_mut_count_after_in_file=$(grep -o '\.iter_mut()' "$file" | wc -l) |
| 155 | + into_iter_count_after_in_file=$(grep -o '\.into_iter()' "$file" | wc -l) |
145 | 156 |
|
146 | 157 | # Update total counters
|
147 |
| - ((iter_count += iter_count_in_file)) |
148 |
| - ((iter_mut_count += iter_mut_count_in_file)) |
149 |
| - ((into_iter_count += into_iter_count_in_file)) |
| 158 | + ((iter_count_after += iter_count_after_in_file)) |
| 159 | + ((iter_mut_count_after += iter_mut_count_after_in_file)) |
| 160 | + ((into_iter_count_after += into_iter_count_after_in_file)) |
150 | 161 | done < <(find . -type f -name '*.rs')
|
151 | 162 |
|
152 | 163 | # Print results
|
153 |
| - echo ".iter() occurrences: $iter_count" |
154 |
| - echo ".iter_mut() occurrences: $iter_mut_count" |
155 |
| - echo ".into_iter() occurrences: $into_iter_count" |
| 164 | + echo ".iter() occurrences: $iter_count_after" |
| 165 | + echo ".iter_mut() occurrences: $iter_mut_count_after" |
| 166 | + echo ".into_iter() occurrences: $into_iter_count_after" |
156 | 167 |
|
157 | 168 | - name: par iter count
|
158 | 169 | working-directory: ./${{ matrix.project }}
|
159 |
| - continue-on-error: true |
160 | 170 | shell: bash
|
161 | 171 | run: |
|
162 | 172 | # Initialize counters
|
|
0 commit comments