Skip to content

Commit 6309657

Browse files
committed
add jsx and tsx files to count
1 parent 0e87202 commit 6309657

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

lib/rails_stats/util.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def calculate_statistics(directories, type = :code, &block)
7575
out
7676
end
7777

78-
def calculate_directory_statistics(directory, pattern = /.*\.(rb|js|ts|coffee|feature)$/)
78+
def calculate_directory_statistics(directory, pattern = /.*\.(rb|js|jsx|ts|tsx|coffee|feature)$/)
7979
stats = CodeStatisticsCalculator.new
8080

8181
Dir.foreach(directory) do |file_name|

test/dummy/app/javascript/dummy.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test/dummy/app/javascript/dummy.tsx

Whitespace-only changes.

test/fixtures/console-output.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
| Configuration | 19 | 417 | 111 | 1 | 0 | 0 | 0 |
2525
| Controllers | 1 | 7 | 6 | 1 | 1 | 1 | 4 |
2626
| Helpers | 1 | 3 | 3 | 0 | 0 | 0 | 0 |
27-
| Javascripts | 4 | 27 | 7 | 0 | 0 | 0 | 0 |
27+
| Javascripts | 6 | 28 | 7 | 0 | 0 | 0 | 0 |
2828
| Jobs | 1 | 7 | 2 | 1 | 0 | 0 | 0 |
2929
| Libraries | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
3030
| Mailers | 1 | 4 | 4 | 1 | 0 | 0 | 0 |
@@ -33,11 +33,11 @@
3333
| Spec Support | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
3434
| Test Support | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
3535
+----------------------+---------+---------+---------+---------+---------+-----+-------+
36-
| Code | 34 | 484 | 152 | 10 | 1 | 0 | 150 |
36+
| Code | 36 | 485 | 152 | 10 | 1 | 0 | 150 |
3737
| Tests | 4 | 7 | 6 | 2 | 0 | 0 | 0 |
38-
| Total | 38 | 491 | 158 | 12 | 1 | 0 | 156 |
38+
| Total | 40 | 492 | 158 | 12 | 1 | 0 | 156 |
3939
+----------------------+---------+---------+---------+---------+---------+-----+-------+
40-
Code LOC: 152 Test LOC: 6 Code to Test Ratio: 1:0.0 Files: 38
40+
Code LOC: 152 Test LOC: 6 Code to Test Ratio: 1:0.0 Files: 40
4141

4242
Polymorphic models count: 1 polymorphic associations
4343
Schema Stats: 2 `create_table` calls in schema.rb

test/lib/rails_stats/json_formatter_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@
166166
"loc_over_m": "0"
167167
}, {
168168
"name": "Javascripts",
169-
"files": "4",
170-
"lines": "27",
169+
"files": "6",
170+
"lines": "28",
171171
"loc": "7",
172172
"classes": "0",
173173
"methods": "0",
@@ -220,8 +220,8 @@
220220
"loc_over_m": "0"
221221
}, {
222222
"name": "Code",
223-
"files": "34",
224-
"lines": "484",
223+
"files": "36",
224+
"lines": "485",
225225
"loc": "152",
226226
"classes": "10",
227227
"methods": "1",
@@ -242,8 +242,8 @@
242242
"total": true
243243
}, {
244244
"name": "Total",
245-
"files": "38",
246-
"lines": "491",
245+
"files": "40",
246+
"lines": "492",
247247
"loc": "158",
248248
"classes": "12",
249249
"methods": "1",

0 commit comments

Comments
 (0)