From fa857b59b27ba3f767e18f1ba2df56d58c7200f0 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 13 Dec 2024 07:41:32 -0800 Subject: [PATCH 1/5] ci: Fix tests --- Eask | 5 ++++- cognitive-complexity.el | 2 +- test/bash-test.el | 1 + test/c-test.el | 1 + test/java-test.el | 1 + test/javascript-test.el | 1 + test/kotlin-test.el | 1 + test/lua-test.el | 1 + test/rust-test.el | 1 + test/test-helper.el | 19 +++++++++++-------- test/typescript-test.el | 1 + 11 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Eask b/Eask index 2063795..c2d8afc 100644 --- a/Eask +++ b/Eask @@ -2,7 +2,7 @@ "1.0.0" "Plugin shows complexity information") -(website-url "https://github.com/abougouffa/cognitive-complexity") +(website-url "https://github.com/emacs-vs/cognitive-complexity") (keywords "convenience" "complexity") (package-file "cognitive-complexity.el") @@ -19,4 +19,7 @@ (development (depends-on "kotlin-mode") (depends-on "lua-mode") + (depends-on "treesit-langs" + :repo "emacs-tree-sitter/treesit-langs" + :fetcher github) ; pre-built binary (depends-on "treesit-auto")) diff --git a/cognitive-complexity.el b/cognitive-complexity.el index cb6cbd8..3bc20a2 100644 --- a/cognitive-complexity.el +++ b/cognitive-complexity.el @@ -7,7 +7,7 @@ ;; Author: Abdelhak BOUGOUFFA ;; Maintainer: Shen, Jen-Chieh ;; Maintainer: Abdelhak BOUGOUFFA -;; URL: https://github.com/abougouffa/cognitive-complexity +;; URL: https://github.com/emacs-vs/cognitive-complexity ;; Version: 1.0.0 ;; Package-Requires: ((emacs "29.1")) ;; Keywords: convenience tools c languages diff --git a/test/bash-test.el b/test/bash-test.el index 2d5f608..7c11c2f 100644 --- a/test/bash-test.el +++ b/test/bash-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (cognitive-complexity-test bash-simple diff --git a/test/c-test.el b/test/c-test.el index 1ff2936..77433eb 100644 --- a/test/c-test.el +++ b/test/c-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (cognitive-complexity-test c-simple diff --git a/test/java-test.el b/test/java-test.el index 36bc689..c480862 100644 --- a/test/java-test.el +++ b/test/java-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (cognitive-complexity-test java-recursion diff --git a/test/javascript-test.el b/test/javascript-test.el index a786145..2469ad7 100644 --- a/test/javascript-test.el +++ b/test/javascript-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (cognitive-complexity-test javascript-simple diff --git a/test/kotlin-test.el b/test/kotlin-test.el index 9aeb956..7452484 100644 --- a/test/kotlin-test.el +++ b/test/kotlin-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (require 'kotlin-mode) diff --git a/test/lua-test.el b/test/lua-test.el index 4990fac..13e9eef 100644 --- a/test/lua-test.el +++ b/test/lua-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (require 'lua-mode) diff --git a/test/rust-test.el b/test/rust-test.el index 297028f..898a2b0 100644 --- a/test/rust-test.el +++ b/test/rust-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (cognitive-complexity-test rust-simple diff --git a/test/test-helper.el b/test/test-helper.el index 16ca84c..f53a4ec 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -21,19 +21,22 @@ ;; ;;; Code: + +(require 'treesit-langs) ; Install pre-built binary + (defmacro cognitive-complexity-test (test-name file major-mode expected-result) "Create a cognitive-complexity test named TEST-NAME using FILE in MAJOR-MODE. Expecting result EXPECTED-RESULT." (declare (indent 1)) `(ert-deftest ,test-name () - (with-current-buffer (find-file-noselect ,file) - (,major-mode) - (let* ((cognitive-complexity-results (cognitive-complexity-buffer)) - (total-score (car cognitive-complexity-results)) - (expressions-and-scores (cognitive-complexity-test-utils-expression-scores cognitive-complexity-results))) - (should (equal ,expected-result - (cons total-score - expressions-and-scores))))))) + (with-current-buffer (find-file-noselect ,file) + (,major-mode) + (let* ((cognitive-complexity-results (cognitive-complexity-buffer)) + (total-score (car cognitive-complexity-results)) + (expressions-and-scores (cognitive-complexity-test-utils-expression-scores cognitive-complexity-results))) + (should (equal ,expected-result + (cons total-score + expressions-and-scores))))))) (defun cognitive-complexity-test-utils-expression-scores (analyze-result) "Helper method to get a list of simple expression + score pairs to work with." diff --git a/test/typescript-test.el b/test/typescript-test.el index 11b27ab..d67988e 100644 --- a/test/typescript-test.el +++ b/test/typescript-test.el @@ -21,6 +21,7 @@ ;; ;;; Code: + (require 'cognitive-complexity) (cognitive-complexity-test typescript-simple From 42cda11316020d6876cd6f3f4ad53b537ea9a363 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 13 Dec 2024 07:42:58 -0800 Subject: [PATCH 2/5] ci: fix syntax --- Eask | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eask b/Eask index c2d8afc..c0f99fb 100644 --- a/Eask +++ b/Eask @@ -21,5 +21,5 @@ (depends-on "lua-mode") (depends-on "treesit-langs" :repo "emacs-tree-sitter/treesit-langs" - :fetcher github) ; pre-built binary + :fetcher 'github) ; pre-built binary (depends-on "treesit-auto")) From 74cc43e5750ce0705d556d0edf352744163bbc94 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 13 Dec 2024 08:02:26 -0800 Subject: [PATCH 3/5] setup major mode --- test/test-helper.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test-helper.el b/test/test-helper.el index f53a4ec..dbc434c 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -22,7 +22,7 @@ ;;; Code: -(require 'treesit-langs) ; Install pre-built binary +(require 'treesit-langs) ; Install pre-built binaries (defmacro cognitive-complexity-test (test-name file major-mode expected-result) "Create a cognitive-complexity test named TEST-NAME using FILE in MAJOR-MODE. @@ -31,6 +31,7 @@ Expecting result EXPECTED-RESULT." `(ert-deftest ,test-name () (with-current-buffer (find-file-noselect ,file) (,major-mode) + (treesit-langs-major-mode-setup) (let* ((cognitive-complexity-results (cognitive-complexity-buffer)) (total-score (car cognitive-complexity-results)) (expressions-and-scores (cognitive-complexity-test-utils-expression-scores cognitive-complexity-results))) From 675a10abca98c8ca4a64cca548cf1bfc6ab7d236 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 13 Dec 2024 08:15:52 -0800 Subject: [PATCH 4/5] fix test --- Eask | 3 +++ test/bash-test.el | 4 ++-- test/c-test.el | 4 ++-- test/go-test.el | 6 +++--- test/javascript-test.el | 8 ++++---- test/lua-test.el | 2 -- test/rust-test.el | 10 +++++----- test/typescript-test.el | 2 +- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Eask b/Eask index c0f99fb..7e3e276 100644 --- a/Eask +++ b/Eask @@ -18,7 +18,10 @@ (development (depends-on "kotlin-mode") + (depends-on "go-mode") (depends-on "lua-mode") + (depends-on "rust-mode") + (depends-on "typescript-mode") (depends-on "treesit-langs" :repo "emacs-tree-sitter/treesit-langs" :fetcher 'github) ; pre-built binary diff --git a/test/bash-test.el b/test/bash-test.el index 7c11c2f..a7cebc2 100644 --- a/test/bash-test.el +++ b/test/bash-test.el @@ -26,7 +26,7 @@ (cognitive-complexity-test bash-simple "test/bash/Simple.sh" - bash-ts-mode + sh-mode '(3 (function_definition . 0) (command . 0) @@ -44,7 +44,7 @@ (cognitive-complexity-test bash-recursion "test/bash/Recursion.sh" - bash-ts-mode + sh-mode '(2 (function_definition . 0) (if_statement . 1) diff --git a/test/c-test.el b/test/c-test.el index 77433eb..1b193df 100644 --- a/test/c-test.el +++ b/test/c-test.el @@ -26,7 +26,7 @@ (cognitive-complexity-test c-simple "test/c/Simple.c" - c-ts-mode + c-mode '(4 (preproc_ifdef . 1) (function_definition . 0) @@ -37,7 +37,7 @@ (cognitive-complexity-test c-recursion "test/c/Recursion.c" - c-ts-mode + c-mode '(2 (function_definition . 0) (if_statement . 1) diff --git a/test/go-test.el b/test/go-test.el index 017b52e..ad14425 100644 --- a/test/go-test.el +++ b/test/go-test.el @@ -26,7 +26,7 @@ (cognitive-complexity-test simple-go-code "test/go/Simple.go" - go-ts-mode + go-mode '(2 ("function_declaration" . 0) ("if_statement" . 1) @@ -35,7 +35,7 @@ (cognitive-complexity-test recursion-go-code "test/go/Recursion.go" - go-ts-mode + go-mode '(2 ("function_declaration" . 0) ("if_statement" . 1) @@ -45,7 +45,7 @@ ;; https://github.com/emacs-vs/codemetrics/issues/7 (cognitive-complexity-test go-nested-print-calls "test/go/NestedPrints.go" - go-ts-mode + go-mode '(6 ("function_declaration" . 0) ("for_statement" . 1) diff --git a/test/javascript-test.el b/test/javascript-test.el index 2469ad7..fcedd32 100644 --- a/test/javascript-test.el +++ b/test/javascript-test.el @@ -26,7 +26,7 @@ (cognitive-complexity-test javascript-simple "test/javascript/Simple.js" - js-ts-mode + js-mode '(3 (function_declaration . 0) (call_expression . 0) @@ -36,7 +36,7 @@ (cognitive-complexity-test javascript-recursion "test/javascript/Recursion.js" - js-ts-mode + js-mode '(2 (function_declaration . 0) (if_statement . 1) @@ -44,7 +44,7 @@ (cognitive-complexity-test javascript-nesting "test/javascript/Nesting.js" - js-ts-mode + js-mode '(4 (call_expression . 0) (arrow_function . 0) @@ -58,7 +58,7 @@ (cognitive-complexity-test javascript-logical-operators "test/javascript/LogicalOperators.js" - js-ts-mode + js-mode '(2 ("&&" . 0) ("||" . 0) diff --git a/test/lua-test.el b/test/lua-test.el index 13e9eef..8632ea2 100644 --- a/test/lua-test.el +++ b/test/lua-test.el @@ -87,6 +87,4 @@ (binary_expression . 0) (binary_expression . 0))) - - ;;; lua-test.el ends here diff --git a/test/rust-test.el b/test/rust-test.el index 898a2b0..61cd532 100644 --- a/test/rust-test.el +++ b/test/rust-test.el @@ -26,7 +26,7 @@ (cognitive-complexity-test rust-simple "test/rust/Simple.rs" - rust-ts-mode + rust-mode '(2 (function_item . 0) (function_item . 0) @@ -37,7 +37,7 @@ (cognitive-complexity-test rust-recursion "test/rust/Recursion.rs" - rust-ts-mode + rust-mode '(2 (function_item . 0) (if_expression . 1) @@ -45,7 +45,7 @@ (cognitive-complexity-test rust-nesting "test/rust/Nesting.rs" - rust-ts-mode + rust-mode '(5 (function_item . 0) (macro_invocation . 0) @@ -60,7 +60,7 @@ (cognitive-complexity-test rust-logical-operators "test/rust/LogicalOperators.rs" - rust-ts-mode + rust-mode '(6 (function_item . 0) (if_expression . 1) @@ -76,7 +76,7 @@ (cognitive-complexity-test rust-control-flow "test/rust/ControlFlow.rs" - rust-ts-mode + rust-mode '(17 (function_item . 0) (loop_expression . 1) diff --git a/test/typescript-test.el b/test/typescript-test.el index d67988e..c1be022 100644 --- a/test/typescript-test.el +++ b/test/typescript-test.el @@ -26,7 +26,7 @@ (cognitive-complexity-test typescript-simple "test/typescript/Simple.ts" - typescript-ts-mode + typescript-mode '(1 ("class_declaration" . 0) ("method_definition" . 0) From 937d2018989352798d4d1e0d6001ca0766fc369d Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 13 Dec 2024 08:34:00 -0800 Subject: [PATCH 5/5] use string instead --- test/bash-test.el | 38 +++++++++--------- test/c-test.el | 76 ++++++++++++++++++------------------ test/go-test.el | 22 +++++------ test/java-test.el | 8 ++-- test/javascript-test.el | 34 ++++++++-------- test/kotlin-test.el | 30 +++++++------- test/lua-test.el | 84 ++++++++++++++++++++-------------------- test/rust-test.el | 86 ++++++++++++++++++++--------------------- 8 files changed, 189 insertions(+), 189 deletions(-) diff --git a/test/bash-test.el b/test/bash-test.el index a7cebc2..44ed61d 100644 --- a/test/bash-test.el +++ b/test/bash-test.el @@ -28,29 +28,29 @@ "test/bash/Simple.sh" sh-mode '(3 - (function_definition . 0) - (command . 0) - (function_definition . 0) - (for_statement . 1) - (command . 0) - (command . 0) - (function_definition . 0) - (while_statement . 1) - (command . 0) - (if_statement . 1) - (command . 0) - (command . 0) - (command . 0))) + ("function_definition" . 0) + ("command" . 0) + ("function_definition" . 0) + ("for_statement" . 1) + ("command" . 0) + ("command" . 0) + ("function_definition" . 0) + ("while_statement" . 1) + ("command" . 0) + ("if_statement" . 1) + ("command" . 0) + ("command" . 0) + ("command" . 0))) (cognitive-complexity-test bash-recursion "test/bash/Recursion.sh" sh-mode '(2 - (function_definition . 0) - (if_statement . 1) - (command . 0) - (command . 1) - (command . 0) - (command . 0))) + ("function_definition" . 0) + ("if_statement" . 1) + ("command" . 0) + ("command" . 1) + ("command" . 0) + ("command" . 0))) ;;; bash-test.el ends here diff --git a/test/c-test.el b/test/c-test.el index 1b193df..4a6d2f6 100644 --- a/test/c-test.el +++ b/test/c-test.el @@ -28,63 +28,63 @@ "test/c/Simple.c" c-mode '(4 - (preproc_ifdef . 1) - (function_definition . 0) - (for_statement . 1) - (while_statement . 1) - (if_statement . 1) - (call_expression . 0))) + ("preproc_ifdef" . 1) + ("function_definition" . 0) + ("for_statement" . 1) + ("while_statement" . 1) + ("if_statement" . 1) + ("call_expression" . 0))) (cognitive-complexity-test c-recursion "test/c/Recursion.c" c-mode '(2 - (function_definition . 0) - (if_statement . 1) - (call_expression . 1))) + ("function_definition" . 0) + ("if_statement" . 1) + ("call_expression" . 1))) (cognitive-complexity-test c-control-flow "test/c/ControlFlow.c" - c-ts-mode + c-mode '(5 - (function_definition . 0) - (switch_statement . 1) - (call_expression . 0) - (function_definition . 0) - (do_statement . 1) - (call_expression . 0) - (function_definition . 0) - (call_expression . 0) - (if_statement . 1) - (goto_statement . 2))) + ("function_definition" . 0) + ("switch_statement" . 1) + ("call_expression" . 0) + ("function_definition" . 0) + ("do_statement" . 1) + ("call_expression" . 0) + ("function_definition" . 0) + ("call_expression" . 0) + ("if_statement" . 1) + ("goto_statement" . 2))) (cognitive-complexity-test c-logical-operators "test/c/LogicalOperators.c" - c-ts-mode + c-mode '(6 - (function_definition . 0) - (if_statement . 1) - ("&&" . 0) - (if_statement . 1) - ("||" . 0) - (if_statement . 1) - ("&&" . 0) - ("||" . 1) - (if_statement . 1) - ("||" . 1) - ("&&" . 0))) + ("function_definition" . 0) + ("if_statement" . 1) + ("&&" . 0) + ("if_statement" . 1) + ("||" . 0) + ("if_statement" . 1) + ("&&" . 0) + ("||" . 1) + ("if_statement" . 1) + ("||" . 1) + ("&&" . 0))) ;; Loosely inspired by go nested prints issue ;; (for verifying issue with multiple nested ifs inside a for-loop) (cognitive-complexity-test c-nested-prints "test/c/NestedPrints.c" - c-ts-mode + c-mode '(5 (function_definition . 0) - (for_statement . 1) - (if_statement . 2) - (call_expression . 0) - (if_statement . 2) - (call_expression . 0))) + (for_statement . 1) + (if_statement . 2) + (call_expression . 0) + (if_statement . 2) + (call_expression . 0))) ;;; c-test.el ends here diff --git a/test/go-test.el b/test/go-test.el index ad14425..3160cc1 100644 --- a/test/go-test.el +++ b/test/go-test.el @@ -29,17 +29,17 @@ go-mode '(2 ("function_declaration" . 0) - ("if_statement" . 1) - ("call_expression" . 0) - ("for_statement" . 1))) + ("if_statement" . 1) + ("call_expression" . 0) + ("for_statement" . 1))) (cognitive-complexity-test recursion-go-code "test/go/Recursion.go" go-mode '(2 ("function_declaration" . 0) - ("if_statement" . 1) - ("call_expression" . 1))) + ("if_statement" . 1) + ("call_expression" . 1))) ;; Test of issue: ;; https://github.com/emacs-vs/codemetrics/issues/7 @@ -48,11 +48,11 @@ go-mode '(6 ("function_declaration" . 0) - ("for_statement" . 1) - ("if_statement" . 2) - ("call_expression" . 0) - ("if_statement" . 2) - ("call_expression" . 0) - ("for_statement" . 1))) + ("for_statement" . 1) + ("if_statement" . 2) + ("call_expression" . 0) + ("if_statement" . 2) + ("call_expression" . 0) + ("for_statement" . 1))) ;;; go-test.el ends here diff --git a/test/java-test.el b/test/java-test.el index c480862..ae8d220 100644 --- a/test/java-test.el +++ b/test/java-test.el @@ -28,9 +28,9 @@ "test/java/Recursion.java" java-mode '(2 - (class_declaration . 0) - (method_declaration . 0) - (if_statement . 1) - (method_invocation . 1))) + ("class_declaration" . 0) + ("method_declaration" . 0) + ("if_statement" . 1) + ("method_invocation" . 1))) ;;; java-test.el ends here diff --git a/test/javascript-test.el b/test/javascript-test.el index fcedd32..e0ff636 100644 --- a/test/javascript-test.el +++ b/test/javascript-test.el @@ -28,33 +28,33 @@ "test/javascript/Simple.js" js-mode '(3 - (function_declaration . 0) - (call_expression . 0) - (call_expression . 0) - (for_statement . 1) - (if_statement . 2))) + ("function_declaration" . 0) + ("call_expression" . 0) + ("call_expression" . 0) + ("for_statement" . 1) + ("if_statement" . 2))) (cognitive-complexity-test javascript-recursion "test/javascript/Recursion.js" js-mode '(2 - (function_declaration . 0) - (if_statement . 1) - (call_expression . 1))) + ("function_declaration" . 0) + ("if_statement" . 1) + ("call_expression" . 1))) (cognitive-complexity-test javascript-nesting "test/javascript/Nesting.js" js-mode '(4 - (call_expression . 0) - (arrow_function . 0) - (call_expression . 0) - (call_expression . 0) - (function_expression . 0) - (if_statement . 2) - (arrow_function . 0) - (if_statement . 2) - (call_expression . 0))) + ("call_expression" . 0) + ("arrow_function" . 0) + ("call_expression" . 0) + ("call_expression" . 0) + ("function_expression" . 0) + ("if_statement" . 2) + ("arrow_function" . 0) + ("if_statement" . 2) + ("call_expression" . 0))) (cognitive-complexity-test javascript-logical-operators "test/javascript/LogicalOperators.js" diff --git a/test/kotlin-test.el b/test/kotlin-test.el index 7452484..16e2cd9 100644 --- a/test/kotlin-test.el +++ b/test/kotlin-test.el @@ -29,30 +29,30 @@ "test/kotlin/Simple.kt" kotlin-mode '(2 - (function_declaration . 0) - (if_expression . 1) - (for_statement . 1) - (call_expression . 0))) + ("function_declaration" . 0) + ("if_expression" . 1) + ("for_statement" . 1) + ("call_expression" . 0))) (cognitive-complexity-test kotlin-recursion "test/kotlin/Recursion.kt" kotlin-mode '(2 - (function_declaration . 0) - (if_expression . 1) - (call_expression . 1))) + ("function_declaration" . 0) + ("if_expression" . 1) + ("call_expression" . 1))) (cognitive-complexity-test kotlin-break-continue "test/kotlin/BreakContinue.kt" kotlin-mode '(6 - (function_declaration . 0) - (call_expression . 0) - (for_statement . 1) - (if_expression . 2) - ("break" . 0) - (for_statement . 1) - (if_expression . 2) - ("continue" . 0))) + ("function_declaration" . 0) + ("call_expression" . 0) + ("for_statement" . 1) + ("if_expression" . 2) + ("break" . 0) + ("for_statement" . 1) + ("if_expression" . 2) + ("continue" . 0))) ;;; kotlin-test.el ends here diff --git a/test/lua-test.el b/test/lua-test.el index 8632ea2..888561d 100644 --- a/test/lua-test.el +++ b/test/lua-test.el @@ -29,62 +29,62 @@ "test/lua/Simple.lua" lua-mode '(3 - (function_declaration . 0) - (binary_expression . 0) - (function_call . 0) - (binary_expression . 0) - (function_call . 0) - (for_statement . 1) - (if_statement . 2) - (binary_expression . 0))) + ("function_declaration" . 0) + ("binary_expression" . 0) + ("function_call" . 0) + ("binary_expression" . 0) + ("function_call" . 0) + ("for_statement" . 1) + ("if_statement" . 2) + ("binary_expression" . 0))) (cognitive-complexity-test lua-recursion "test/lua/Recursion.lua" lua-mode '(2 - (function_declaration . 0) - (if_statement . 1) - (binary_expression . 0) - (binary_expression . 0) - (function_call . 1) - (binary_expression . 0))) + ("function_declaration" . 0) + ("if_statement" . 1) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("function_call" . 1) + ("binary_expression" . 0))) (cognitive-complexity-test lua-nesting "test/lua/Nesting.lua" lua-mode '(7 - (while_statement . 1) - (binary_expression . 0) - (if_statement . 2) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (repeat_statement . 2) - (binary_expression . 0) - (binary_expression . 0) - (if_statement . 1) - (binary_expression . 0) - (goto_statement . 1))) + ("while_statement" . 1) + ("binary_expression" . 0) + ("if_statement" . 2) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("repeat_statement" . 2) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("if_statement" . 1) + ("binary_expression" . 0) + ("goto_statement" . 1))) (cognitive-complexity-test lua-logical-operators "test/lua/LogicalOperators.lua" lua-mode '(2 - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 1) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 1) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0) - (binary_expression . 0))) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 1) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 1) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0) + ("binary_expression" . 0))) ;;; lua-test.el ends here diff --git a/test/rust-test.el b/test/rust-test.el index 61cd532..763e0ed 100644 --- a/test/rust-test.el +++ b/test/rust-test.el @@ -28,68 +28,68 @@ "test/rust/Simple.rs" rust-mode '(2 - (function_item . 0) - (function_item . 0) - (call_expression . 0) - (macro_invocation . 0) - (if_expression . 1) - (for_expression . 1))) + ("function_item" . 0) + ("function_item" . 0) + ("call_expression" . 0) + ("macro_invocation" . 0) + ("if_expression" . 1) + ("for_expression" . 1))) (cognitive-complexity-test rust-recursion "test/rust/Recursion.rs" rust-mode '(2 - (function_item . 0) - (if_expression . 1) - (call_expression . 1))) + ("function_item" . 0) + ("if_expression" . 1) + ("call_expression" . 1))) (cognitive-complexity-test rust-nesting "test/rust/Nesting.rs" rust-mode '(5 - (function_item . 0) - (macro_invocation . 0) - (call_expression . 0) - (call_expression . 0) - (call_expression . 0) - (closure_expression . 0) - (closure_expression . 0) - (match_expression . 2) - (loop_expression . 1) - (if_expression . 2))) + ("function_item" . 0) + ("macro_invocation" . 0) + ("call_expression" . 0) + ("call_expression" . 0) + ("call_expression" . 0) + ("closure_expression" . 0) + ("closure_expression" . 0) + ("match_expression" . 2) + ("loop_expression" . 1) + ("if_expression" . 2))) (cognitive-complexity-test rust-logical-operators "test/rust/LogicalOperators.rs" rust-mode '(6 - (function_item . 0) - (if_expression . 1) - ("&&" . 0) - (if_expression . 1) - ("||" . 0) - (if_expression . 1) - ("&&" . 0) - ("||" . 1) - (if_expression . 1) - ("||" . 1) - ("&&" . 0))) + ("function_item" . 0) + ("if_expression" . 1) + ("&&" . 0) + ("if_expression" . 1) + ("||" . 0) + ("if_expression" . 1) + ("&&" . 0) + ("||" . 1) + ("if_expression" . 1) + ("||" . 1) + ("&&" . 0))) (cognitive-complexity-test rust-control-flow "test/rust/ControlFlow.rs" rust-mode '(17 - (function_item . 0) - (loop_expression . 1) - (loop_expression . 2) - (if_expression . 3) - (break_expression . 1) - (if_expression . 3) - (continue_expression . 0) - (macro_invocation . 0) - (for_expression . 1) - (loop_expression . 2) - (if_expression . 3) - (continue_expression . 1) - (break_expression . 0))) + ("function_item" . 0) + ("loop_expression" . 1) + ("loop_expression" . 2) + ("if_expression" . 3) + ("break_expression" . 1) + ("if_expression" . 3) + ("continue_expression" . 0) + ("macro_invocation" . 0) + ("for_expression" . 1) + ("loop_expression" . 2) + ("if_expression" . 3) + ("continue_expression" . 1) + ("break_expression" . 0))) ;;; rust-test.el ends here