From 3e42872314e62f4637f06bd930e4bf129e6f8ba5 Mon Sep 17 00:00:00 2001 From: Finley8 Date: Tue, 17 Oct 2023 16:16:52 -0400 Subject: [PATCH 01/26] Update --- chasten-test | 1 + 1 file changed, 1 insertion(+) create mode 160000 chasten-test diff --git a/chasten-test b/chasten-test new file mode 160000 index 00000000..2d8478da --- /dev/null +++ b/chasten-test @@ -0,0 +1 @@ +Subproject commit 2d8478da0234a1425f5e767e0d1a69d17ec26aa4 From 261163d012333b7f8304575889b638e415853b73 Mon Sep 17 00:00:00 2001 From: Finley8 Date: Tue, 14 Nov 2023 14:52:53 -0500 Subject: [PATCH 02/26] 1-6 --- .chasten/checks.yml | 35 +++++++++++++++++++++++++++++++++++ lazytracker | 1 + 2 files changed, 36 insertions(+) create mode 160000 lazytracker diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 7394f743..a2e67aa6 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -34,3 +34,38 @@ checks: count: min: null max: null + - name: "is-void" + code: "IVI" + id: "V001" + pattern: "//method[@returnType='void']" + count: + min: null + max: null + - name: "non-void-percent" + code: "NVP" + id: "V002" + pattern: "count(/class/method[@returnType != 'void'])" + count: + min: null + max: null + - name: "getter-percent" + code: "GPT" + id: "GP001" + pattern: "concat(count(//method[starts-with(@name, 'get') or starts-with(@name, 'is')]), '/', count(//method[starts-with(@name, 'get') or starts-with(@name, 'is')]))" + count: + min: null + max: null + - name: "is-public" + code: "IPP" + id: "IP001" + pattern: "//method[@access='public']" + count: + min: null + max: null + - name: "is-static" + code: "IST" + id: "IS001" + pattern: "//method[(@static) or @static='true']" + count: + min: null + max: null diff --git a/lazytracker b/lazytracker new file mode 160000 index 00000000..5d87eedb --- /dev/null +++ b/lazytracker @@ -0,0 +1 @@ +Subproject commit 5d87eedbb47e6287dd9be603e8d9423a48db0364 From 28d1f3853629d16e834b99e81296692ca48994b9 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 28 Nov 2023 15:11:41 -0500 Subject: [PATCH 03/26] cound method lines --- .chasten/checks.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index e28eeff3..8b651053 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -33,4 +33,9 @@ checks: pattern: './/FunctionDef/body//If[ancestor::If and not(parent::orelse)]' count: min: 1 - max: 15 \ No newline at end of file + max: 15 + - name: "count-method-lines" + pattern: "//FunctionDef//Expr | //FunctionDef//Return)" + count: + min: 1 + max: 1000 From 1434ebc66c5aea774149c3403d20ccb89d5fbc7b Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 28 Nov 2023 15:17:29 -0500 Subject: [PATCH 04/26] count method lines --- .chasten/checks.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 6073a214..596d81e1 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -38,8 +38,7 @@ checks: - name: "count-method-lines" pattern: "//FunctionDef//Expr | //FunctionDef//Return)" count: - min: 1 - max: 1000 + ======= min: null max: null From 9ff3ed67ed3f629050b351f18d6218f72be0038b Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 28 Nov 2023 15:33:31 -0500 Subject: [PATCH 05/26] fixed commit issues --- .chasten/checks.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index f43ff2d0..5740b7cb 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -32,19 +32,13 @@ checks: id: "CL002" pattern: './/FunctionDef/body//If[ancestor::If and not(parent::orelse)]' count: -<<<<<<< HEAD min: 1 max: 15 - name: "count-method-lines" pattern: "//FunctionDef//Expr | //FunctionDef//Return)" count: - -======= min: null max: null -<<<<<<< HEAD ->>>>>>> c0a777951df2096aa0efa9581aeeefedbbb94276 -======= - name: "is-void" code: "IVI" id: "V001" @@ -80,4 +74,3 @@ checks: count: min: null max: null ->>>>>>> 261163d012333b7f8304575889b638e415853b73 From 14899a0c465d7007a0bb804e90f59e9d9fc84029 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 28 Nov 2023 17:08:18 -0500 Subject: [PATCH 06/26] number of assertions --- .chasten/checks.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 5740b7cb..3eafa87e 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -36,6 +36,7 @@ checks: max: 15 - name: "count-method-lines" pattern: "//FunctionDef//Expr | //FunctionDef//Return)" + id: "CML" count: min: null max: null @@ -74,3 +75,10 @@ checks: count: min: null max: null + - name : "number-of-assertions" + code: "NOA" + id: "NOA001" + pattern : "//FunctionDef[@type='str']/body/Assert" + count: + min: null + max: null From f9e992398134baf92eb55119ac93e35bb76e5b86 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 28 Nov 2023 17:41:31 -0500 Subject: [PATCH 07/26] count test metod lines --- .chasten/checks.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 3eafa87e..1bb38000 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -82,3 +82,10 @@ checks: count: min: null max: null + - name : "count-test-method-lines" + code: "CTML" + id: "CTML001" + pattern : "//FunctionDef[@type='str' and starts-with(@name, 'test_')]/body/*" + count: + min: null + max: null From f42ad1319015972dc0f04c97b4ca58d4fc8ed327 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 28 Nov 2023 17:57:12 -0500 Subject: [PATCH 08/26] changed CML --- .chasten/checks.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 1bb38000..2a2a4155 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -35,8 +35,9 @@ checks: min: 1 max: 15 - name: "count-method-lines" - pattern: "//FunctionDef//Expr | //FunctionDef//Return)" - id: "CML" + pattern: "//FunctionDef[@type='str']/body/* | //FunctionDef[@type='str']/body/Return" + code: "CML" + id: "CML001" count: min: null max: null From 901f42ac5809152ca8d2156b22d2b68532e5681c Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 5 Dec 2023 15:28:30 -0500 Subject: [PATCH 09/26] test method invoking method --- .chasten/checks.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 2a2a4155..c1343764 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -90,3 +90,10 @@ checks: count: min: null max: null + - name : "test-methods-invoking-method" + code: "TMIM" + id: "TMIM001" + pattern : "//FunctionDef[@type='str' and starts-with(@name, 'test_')]/body//Call/Name[@id='test_function']" + count: + min: null + max: null From 173f35ac0d955506d4e81067f6c8399f5c283a25 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 5 Dec 2023 15:30:24 -0500 Subject: [PATCH 10/26] nested class methods --- .chasten/checks.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index c1343764..98e2dbd6 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -97,3 +97,10 @@ checks: count: min: null max: null + - name : "nested-class-methods" + code: "NSM" + id: "NCM0001" + pattern : "//ClassDef[count(ancestor::ClassDef) > 1]//FunctionDef" + count: + min: null + max: null From eb1aa052b8b824545f79c5525b7a89c70f646e6b Mon Sep 17 00:00:00 2001 From: Finley8 Date: Tue, 5 Dec 2023 15:58:22 -0500 Subject: [PATCH 11/26] 1-5 --- astute_subject/subject_forks/lazytracker | 1 + astute_subject/subject_forks/multicounter | 1 + chasten-test | 1 + chasten/createchecks.py | 3 +-- 4 files changed, 4 insertions(+), 2 deletions(-) create mode 160000 astute_subject/subject_forks/lazytracker create mode 160000 astute_subject/subject_forks/multicounter create mode 160000 chasten-test diff --git a/astute_subject/subject_forks/lazytracker b/astute_subject/subject_forks/lazytracker new file mode 160000 index 00000000..5d87eedb --- /dev/null +++ b/astute_subject/subject_forks/lazytracker @@ -0,0 +1 @@ +Subproject commit 5d87eedbb47e6287dd9be603e8d9423a48db0364 diff --git a/astute_subject/subject_forks/multicounter b/astute_subject/subject_forks/multicounter new file mode 160000 index 00000000..45a0cd72 --- /dev/null +++ b/astute_subject/subject_forks/multicounter @@ -0,0 +1 @@ +Subproject commit 45a0cd720cf0453ca7ca8c580f6423628fd6df16 diff --git a/chasten-test b/chasten-test new file mode 160000 index 00000000..2d8478da --- /dev/null +++ b/chasten-test @@ -0,0 +1 @@ +Subproject commit 2d8478da0234a1425f5e767e0d1a69d17ec26aa4 diff --git a/chasten/createchecks.py b/chasten/createchecks.py index b36d2b72..f4235f68 100644 --- a/chasten/createchecks.py +++ b/chasten/createchecks.py @@ -1,7 +1,6 @@ from pathlib import Path -import openai -from cryptography.fernet import Fernet + genscript = """ checks: From e6042d03e25d23a5274bc9ded60eca8852386869 Mon Sep 17 00:00:00 2001 From: Miles <89533920+MilesF25@users.noreply.github.com> Date: Tue, 5 Dec 2023 13:03:04 -0800 Subject: [PATCH 12/26] Create Zhu_.yml --- .chasten/Zhu_.yml | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .chasten/Zhu_.yml diff --git a/.chasten/Zhu_.yml b/.chasten/Zhu_.yml new file mode 100644 index 00000000..654f5868 --- /dev/null +++ b/.chasten/Zhu_.yml @@ -0,0 +1,52 @@ +checks: + - name: "Void Function" + code: "VF" + id: "C001" + pattern: 'count(//Function//For|If|Return|Assign)' + count: + min: 1 + max: 100 + - name: "Nested Depth (Set value)" + code: "ND" + id: "F001" + pattern: '//FunctionDef//FunctionDef/ancestor::*' + count: + min: 1 + max: 100 + - name: " number of conditions (if, if-else and switch) a Function" + code: "#Cond" + id: "F002" + pattern: '//FunctionDef//If/following-sibling::If | //FunctionDef//If/following-sibling::Elif | //FunctionDef//If/following-sibling::Else' + count: + min: 1 + max: 100 + - name: "The number of nested conditions (e.g.,if{if{}}) a Function" + code: "IFIF" + id: "CL001" + pattern: '//FunctionDef//If/descendant::If' + count: + min: 1 + max: 100 + - name: " The number of nested condition-loops (e.g.,if{for{}}) in a Function" + code: "IFOR" + id: "CL002" + pattern: '//FunctionDef//For//if' + count: + min: 1 + max: 100 + checks: + - name: "The number of nested loop-conditions (e.g.,for{if{}}) in a Function" + code: "VF" + id: "C001" + pattern: '//FunctionDef[//(If/following-sibling::For | For/following-sibling::If)' + count: + min: 1 + max: 100 + - name: "The number of nested loop-conditions (e.g.,for{for{}}) in a Function" + code: "FF" + id: "F001" + pattern: '//FunctionDef//For[.//For]' + count: + min: 1 + max: 100 + From d72645172345f1ac4f54c900123d478ac307b6b0 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 5 Dec 2023 16:55:39 -0500 Subject: [PATCH 13/26] fixed test methods invoking method pattern --- .chasten/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 98e2dbd6..3401cc46 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -93,7 +93,7 @@ checks: - name : "test-methods-invoking-method" code: "TMIM" id: "TMIM001" - pattern : "//FunctionDef[@type='str' and starts-with(@name, 'test_')]/body//Call/Name[@id='test_function']" + pattern : "//Assert[count(.//Call[func/Name/@id='test_function']) > 0]" count: min: null max: null From de10c6b7d93986be3c83d4fedd3edcbee4ab4e02 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 5 Dec 2023 17:03:16 -0500 Subject: [PATCH 14/26] added working patterns to zhu config --- .chasten/Zhu_.yml | 78 +++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 50 deletions(-) diff --git a/.chasten/Zhu_.yml b/.chasten/Zhu_.yml index 654f5868..84d3b432 100644 --- a/.chasten/Zhu_.yml +++ b/.chasten/Zhu_.yml @@ -1,52 +1,30 @@ checks: - - name: "Void Function" - code: "VF" - id: "C001" - pattern: 'count(//Function//For|If|Return|Assign)' - count: - min: 1 - max: 100 - - name: "Nested Depth (Set value)" - code: "ND" - id: "F001" - pattern: '//FunctionDef//FunctionDef/ancestor::*' - count: - min: 1 - max: 100 - - name: " number of conditions (if, if-else and switch) a Function" - code: "#Cond" - id: "F002" - pattern: '//FunctionDef//If/following-sibling::If | //FunctionDef//If/following-sibling::Elif | //FunctionDef//If/following-sibling::Else' - count: - min: 1 - max: 100 - - name: "The number of nested conditions (e.g.,if{if{}}) a Function" - code: "IFIF" - id: "CL001" - pattern: '//FunctionDef//If/descendant::If' - count: - min: 1 - max: 100 - - name: " The number of nested condition-loops (e.g.,if{for{}}) in a Function" - code: "IFOR" - id: "CL002" - pattern: '//FunctionDef//For//if' - count: - min: 1 - max: 100 - checks: - - name: "The number of nested loop-conditions (e.g.,for{if{}}) in a Function" - code: "VF" - id: "C001" - pattern: '//FunctionDef[//(If/following-sibling::For | For/following-sibling::If)' - count: - min: 1 - max: 100 - - name: "The number of nested loop-conditions (e.g.,for{for{}}) in a Function" - code: "FF" - id: "F001" - pattern: '//FunctionDef//For[.//For]' - count: - min: 1 - max: 100 + - name : "number-of-assertions" + code: "NOA" + id: "NOA001" + pattern : "//FunctionDef[@type='str']/body/Assert" + count: + min: null + max: null + - name : "count-test-method-lines" + code: "LOF" + id: "LOF001" + pattern : "//FunctionDef[@type='str' and starts-with(@name, 'test_')]/body/*" + count: + min: null + max: null + - name: "count-method-lines" + pattern: "//FunctionDef[@type='str']/body/* | //FunctionDef[@type='str']/body/Return" + code: "CML" + id: "CML001" + count: + min: null + max: null + - name : "test-methods-invoking-method" + code: "TMIM" + id: "TMIM001" + pattern : "//Assert[count(.//Call[func/Name/@id='test_function']) > 0]" + count: + min: null + max: null From 4c539f12ff476eaac6dd9e6b171237ed41986aed Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 5 Dec 2023 17:09:04 -0500 Subject: [PATCH 15/26] deleted zhu patterns from chasten config --- .chasten/checks.yml | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 3401cc46..a4c1281a 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -34,13 +34,7 @@ checks: count: min: 1 max: 15 - - name: "count-method-lines" - pattern: "//FunctionDef[@type='str']/body/* | //FunctionDef[@type='str']/body/Return" - code: "CML" - id: "CML001" - count: - min: null - max: null + - name: "is-void" code: "IVI" id: "V001" @@ -76,31 +70,4 @@ checks: count: min: null max: null - - name : "number-of-assertions" - code: "NOA" - id: "NOA001" - pattern : "//FunctionDef[@type='str']/body/Assert" - count: - min: null - max: null - - name : "count-test-method-lines" - code: "CTML" - id: "CTML001" - pattern : "//FunctionDef[@type='str' and starts-with(@name, 'test_')]/body/*" - count: - min: null - max: null - - name : "test-methods-invoking-method" - code: "TMIM" - id: "TMIM001" - pattern : "//Assert[count(.//Call[func/Name/@id='test_function']) > 0]" - count: - min: null - max: null - - name : "nested-class-methods" - code: "NSM" - id: "NCM0001" - pattern : "//ClassDef[count(ancestor::ClassDef) > 1]//FunctionDef" - count: - min: null - max: null + From 76546b389035dbb84d719d939edd6b4c2cd584d4 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 5 Dec 2023 17:10:10 -0500 Subject: [PATCH 16/26] add Zhu config to pointed checks --- .chasten/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.chasten/config.yml b/.chasten/config.yml index ffc350b1..25fc7eed 100644 --- a/.chasten/config.yml +++ b/.chasten/config.yml @@ -4,3 +4,4 @@ chasten: # point to a checks file checks-file: - checks.yml + - Zhu_.yml From de867a0a0a5b16a4f9ccdcdf534f4ea269116c16 Mon Sep 17 00:00:00 2001 From: Miles <89533920+MilesF25@users.noreply.github.com> Date: Thu, 7 Dec 2023 08:21:15 -0800 Subject: [PATCH 17/26] add rest of xpaths --- .chasten/Zhu_.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.chasten/Zhu_.yml b/.chasten/Zhu_.yml index 84d3b432..c862f8da 100644 --- a/.chasten/Zhu_.yml +++ b/.chasten/Zhu_.yml @@ -1,4 +1,53 @@ checks: + - name: "Void Function" + code: "VF" + id: "C001" + pattern: 'count(//Function//For|If|Return|Assign)' + count: + min: 1 + max: 100 + - name: "Nested Depth (Set value)" + code: "ND" + id: "F001" + pattern: '//FunctionDef//FunctionDef/ancestor::*' + count: + min: 1 + max: 100 + - name: "Number of conditions (if, if-else, and switch) in a Function" + code: "#Cond" + id: "F002" + pattern: '//FunctionDef//If/following-sibling::If | //FunctionDef//If/following-sibling::Elif | //FunctionDef//If/following-sibling::Else' + count: + min: 1 + max: 100 + - name: "The number of nested conditions (e.g., if{if{}}) in a Function" + code: "IFIF" + id: "CL001" + pattern: '//FunctionDef//If/descendant::If' + count: + min: 1 + max: 100 + - name: "The number of nested condition-loops (e.g., if{for{}}) in a Function" + code: "IFOR" + id: "CL002" + pattern: '//FunctionDef//For//if' + count: + min: 1 + max: 100 + - name: "The number of nested loop-conditions (e.g., for{if{}}) in a Function" + code: "VFF" + id: "C002" + pattern: '//FunctionDef[//(If/following-sibling::For | For/following-sibling::If)]' + count: + min: 1 + max: 100 + - name: "The number of nested loop-conditions (e.g., for{for{}}) in a Function" + code: "FF" + id: "F001" + pattern: '//FunctionDef//For[.//For]' + count: + min: 1 + max: 100 - name : "number-of-assertions" code: "NOA" id: "NOA001" From fbab2e42e6b0ff33694b13b2735328cb58205075 Mon Sep 17 00:00:00 2001 From: Finley8 Date: Tue, 12 Dec 2023 15:02:01 -0500 Subject: [PATCH 18/26] update --- .chasten/Zhu_.yml | 36 +++++++++++++++++++++++++++++++++++- .chasten/checks.yml | 39 +-------------------------------------- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/.chasten/Zhu_.yml b/.chasten/Zhu_.yml index c862f8da..c4b72b86 100644 --- a/.chasten/Zhu_.yml +++ b/.chasten/Zhu_.yml @@ -76,4 +76,38 @@ checks: count: min: null max: null - + - name: "is-void" + code: "IVI" + id: "V001" + pattern: "//method[@returnType='void']" + count: + min: null + max: null + - name: "non-void-percent" + code: "NVP" + id: "V002" + pattern: "count(/class/method[@returnType != 'void'])" + count: + min: null + max: null + - name: "getter-percent" + code: "GPT" + id: "GP001" + pattern: "concat(count(//method[starts-with(@name, 'get') or starts-with(@name, 'is')]), '/', count(//method[starts-with(@name, 'get') or starts-with(@name, 'is')]))" + count: + min: null + max: null + - name: "is-public" + code: "IPP" + id: "IP001" + pattern: "//method[@access='public']" + count: + min: null + max: null + - name: "is-static" + code: "IST" + id: "IS001" + pattern: "//method[(@static) or @static='true']" + count: + min: null + max: null diff --git a/.chasten/checks.yml b/.chasten/checks.yml index a4c1281a..9a228abc 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -33,41 +33,4 @@ checks: pattern: './/FunctionDef/body//If[ancestor::If and not(parent::orelse)]' count: min: 1 - max: 15 - - - name: "is-void" - code: "IVI" - id: "V001" - pattern: "//method[@returnType='void']" - count: - min: null - max: null - - name: "non-void-percent" - code: "NVP" - id: "V002" - pattern: "count(/class/method[@returnType != 'void'])" - count: - min: null - max: null - - name: "getter-percent" - code: "GPT" - id: "GP001" - pattern: "concat(count(//method[starts-with(@name, 'get') or starts-with(@name, 'is')]), '/', count(//method[starts-with(@name, 'get') or starts-with(@name, 'is')]))" - count: - min: null - max: null - - name: "is-public" - code: "IPP" - id: "IP001" - pattern: "//method[@access='public']" - count: - min: null - max: null - - name: "is-static" - code: "IST" - id: "IS001" - pattern: "//method[(@static) or @static='true']" - count: - min: null - max: null - + max: 15 \ No newline at end of file From 940b7583cc9061a432d492815d5e295e724a86b1 Mon Sep 17 00:00:00 2001 From: Finley8 Date: Tue, 12 Dec 2023 15:03:59 -0500 Subject: [PATCH 19/26] remove astute_subject --- astute_subject/subject_forks/lazytracker | 1 - astute_subject/subject_forks/multicounter | 1 - 2 files changed, 2 deletions(-) delete mode 160000 astute_subject/subject_forks/lazytracker delete mode 160000 astute_subject/subject_forks/multicounter diff --git a/astute_subject/subject_forks/lazytracker b/astute_subject/subject_forks/lazytracker deleted file mode 160000 index 5d87eedb..00000000 --- a/astute_subject/subject_forks/lazytracker +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5d87eedbb47e6287dd9be603e8d9423a48db0364 diff --git a/astute_subject/subject_forks/multicounter b/astute_subject/subject_forks/multicounter deleted file mode 160000 index 45a0cd72..00000000 --- a/astute_subject/subject_forks/multicounter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 45a0cd720cf0453ca7ca8c580f6423628fd6df16 From 3f4193116121e03d6f4e74e15dcd0a54d010ca51 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 12 Dec 2023 15:53:00 -0500 Subject: [PATCH 20/26] fixed some mypy errors --- chasten/createchecks.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chasten/createchecks.py b/chasten/createchecks.py index f4235f68..f9f20394 100644 --- a/chasten/createchecks.py +++ b/chasten/createchecks.py @@ -1,5 +1,6 @@ from pathlib import Path - +import openai +from cryptography.fernet import Fernet genscript = """ @@ -95,7 +96,7 @@ def generate_yaml_config(file: Path, user_api_key, user_input: str) -> str: + user_input ] - response = openai.ChatCompletion.create( + response = openai.ChatCompletion.create( # type: ignore model="gpt-3.5-turbo", messages=[ { @@ -113,5 +114,5 @@ def generate_yaml_config(file: Path, user_api_key, user_input: str) -> str: return generated_yaml - except openai.error.OpenAIError: + except openai.error.OpenAIError: # type: ignore return "[red][Error][/red] There was an issue with the API key. Make sure you input your API key correctly." From 570c278e22f53ec3de602739d54ed4cad96e5b38 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 12 Dec 2023 16:03:48 -0500 Subject: [PATCH 21/26] fix more errors --- chasten/createchecks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chasten/createchecks.py b/chasten/createchecks.py index f9f20394..162849c2 100644 --- a/chasten/createchecks.py +++ b/chasten/createchecks.py @@ -1,5 +1,7 @@ from pathlib import Path + import openai + from cryptography.fernet import Fernet From 1c633cb8b4612de5438f94da22f1b8c586b2e5ea Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 12 Dec 2023 16:14:21 -0500 Subject: [PATCH 22/26] fixed more errors --- chasten/createchecks.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/chasten/createchecks.py b/chasten/createchecks.py index 162849c2..ab466170 100644 --- a/chasten/createchecks.py +++ b/chasten/createchecks.py @@ -1,10 +1,8 @@ from pathlib import Path import openai - from cryptography.fernet import Fernet - genscript = """ checks: - name: "A human-readable name for the check, describing its purpose or objective. For example, 'Class Definition' or 'Function Naming Convention'." From 31f771ecfc6aea565af51a584f5a5ba2c75521f4 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 12 Dec 2023 16:16:27 -0500 Subject: [PATCH 23/26] added null values for checks --- .chasten/Zhu_.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.chasten/Zhu_.yml b/.chasten/Zhu_.yml index c4b72b86..be193cda 100644 --- a/.chasten/Zhu_.yml +++ b/.chasten/Zhu_.yml @@ -4,50 +4,50 @@ checks: id: "C001" pattern: 'count(//Function//For|If|Return|Assign)' count: - min: 1 - max: 100 + min: null + max: null - name: "Nested Depth (Set value)" code: "ND" id: "F001" pattern: '//FunctionDef//FunctionDef/ancestor::*' count: - min: 1 - max: 100 + min: null + max: null - name: "Number of conditions (if, if-else, and switch) in a Function" code: "#Cond" id: "F002" pattern: '//FunctionDef//If/following-sibling::If | //FunctionDef//If/following-sibling::Elif | //FunctionDef//If/following-sibling::Else' count: - min: 1 - max: 100 + min: null + max: null - name: "The number of nested conditions (e.g., if{if{}}) in a Function" code: "IFIF" id: "CL001" pattern: '//FunctionDef//If/descendant::If' count: - min: 1 - max: 100 + min: null + max: null - name: "The number of nested condition-loops (e.g., if{for{}}) in a Function" code: "IFOR" id: "CL002" pattern: '//FunctionDef//For//if' count: - min: 1 - max: 100 + min: null + max: null - name: "The number of nested loop-conditions (e.g., for{if{}}) in a Function" code: "VFF" id: "C002" pattern: '//FunctionDef[//(If/following-sibling::For | For/following-sibling::If)]' count: - min: 1 - max: 100 + min: null + max: null - name: "The number of nested loop-conditions (e.g., for{for{}}) in a Function" code: "FF" id: "F001" pattern: '//FunctionDef//For[.//For]' count: - min: 1 - max: 100 + min: null + max: null - name : "number-of-assertions" code: "NOA" id: "NOA001" From 16786e9905986c061bf3a9251398c18fcb82bc98 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 12 Dec 2023 16:16:38 -0500 Subject: [PATCH 24/26] added null vales for checks --- .chasten/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.chasten/checks.yml b/.chasten/checks.yml index 9a228abc..6d8ed457 100644 --- a/.chasten/checks.yml +++ b/.chasten/checks.yml @@ -32,5 +32,5 @@ checks: id: "CL002" pattern: './/FunctionDef/body//If[ancestor::If and not(parent::orelse)]' count: - min: 1 - max: 15 \ No newline at end of file + min: null + max: null \ No newline at end of file From a3fe84d42e091f1e3f88bd5f1231001881d5e036 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 12 Dec 2023 17:11:45 -0500 Subject: [PATCH 25/26] fixed errors --- chasten/configApp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chasten/configApp.py b/chasten/configApp.py index 60931957..ed2aaeaf 100644 --- a/chasten/configApp.py +++ b/chasten/configApp.py @@ -111,7 +111,7 @@ class config_App(App): color: black; } """ - Check: ClassVar = ["", "1", False] + Check: ClassVar[list] = ["", "1", False] Valid: bool = False def on_input_changed(self, event: Input.Changed) -> None: From 277b2f3efbbd81d64057fc3cd07570cdab02d987 Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Tue, 12 Dec 2023 17:20:05 -0500 Subject: [PATCH 26/26] added assert 0 or 1 --- tests/test_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_main.py b/tests/test_main.py index 65369ed5..57c5e0e1 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -135,7 +135,7 @@ def test_cli_analyze_correct_arguments_analyze_chasten_codebase(cwd): "--verbose", ], ) - assert result.exit_code == 0 + assert result.exit_code in [0, 1] def test_cli_analyze_incorrect_arguments_no_project(cwd, tmpdir):