Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from cayhorstmann/codecheck2 #1

Open
wants to merge 268 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
268 commits
Select commit Hold shift + click to select a range
3a89f5f
Updated build instructions
cayhorstmann Jun 8, 2022
217b45c
AWS CLI build instructions
cayhorstmann Jun 16, 2022
eb86d1d
AWS CLI build instructions
cayhorstmann Jun 16, 2022
8bcf1f1
AWS CLI build instructions
cayhorstmann Jun 16, 2022
1b6d313
Change prefix base on reqest
hisergiorojas Jun 16, 2022
6e07f3d
...
cayhorstmann Jun 29, 2022
513aa21
build instructions for docker on codespaces
cayhorstmann Jul 1, 2022
16c8f1d
Added checkUIDForBadWords and slightly adjusted createPronouncableUID.
odiaz95012 Jul 6, 2022
0fb264d
Made improvements to createPronouncableUID() and created another help…
odiaz95012 Jul 11, 2022
0a32d13
Updated generateNewWord() so that the checking for bad words occurs i…
odiaz95012 Jul 12, 2022
fafed82
Changed generateNewWord() to return a StringBuilder rather than a Str…
odiaz95012 Jul 12, 2022
071f584
Made generateNewWord() simpler by removing revursive call and only ca…
odiaz95012 Jul 13, 2022
6588b24
Modified readDescription() to remove relative links from problem stat…
charlesnguyen8 Jul 14, 2022
0bf98c2
Merge branch 'cayhorstmann:main' into main
agill18 Jul 15, 2022
3b4dca0
Merge pull request #20 from codeday-labs/main
cayhorstmann Jul 16, 2022
88cfea7
...
cayhorstmann Jul 16, 2022
ac43d08
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Jul 16, 2022
a59def6
update the algorithm to replace relative links to be more accurate
charlesnguyen8 Jul 17, 2022
8562312
removing unnecessary comments
charlesnguyen8 Jul 17, 2022
1e7a51b
Tester/X-Unit, SUB, and CALL work with HIDDEN
agill18 Jul 18, 2022
8dc11f4
Merge pull request #4 from agill18/hiddenTestsFeature
agill18 Jul 18, 2022
483f108
Merge pull request #24 from agill18/hiddenTestsFeature
cayhorstmann Jul 19, 2022
022f6f2
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Jul 19, 2022
958e022
Merge pull request #18 from hisergiorojas/request-url
cayhorstmann Jul 20, 2022
7cada41
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Jul 20, 2022
11c085c
Made it so SUB does not work with HIDDEN
agill18 Jul 21, 2022
dd419f0
added HIDDENCALL annotation to hide specific CALLS & added some sampl…
agill18 Jul 21, 2022
e1fe6c7
remove hidden tester files from student
agill18 Jul 25, 2022
03c8b40
Update Main.java
cayhorstmann Jul 25, 2022
52ec089
Merge pull request #25 from agill18/hiddenTestsFeature
cayhorstmann Jul 25, 2022
1d4af2a
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Jul 25, 2022
789a6a2
Deploy staging play-codecheck
cayhorstmann Jul 25, 2022
d379c6d
modified fixZip() to handle edge case of zip file has only 1 file
charlesnguyen8 Jul 28, 2022
f7ac1b6
Merge pull request #26 from codeday-labs/fixZipFix
cayhorstmann Jul 28, 2022
5558a15
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Jul 28, 2022
2b51d11
Merge branch 'cayhorstmann:main' into hiddenTestsFeature
agill18 Jul 28, 2022
59f5fab
Added INH annotation to hide specific input lines when testing a whol…
agill18 Jul 26, 2022
1c4c8d0
Got //INH to work with testX.in files
agill18 Jul 28, 2022
1ec5568
Modified hidden report output and added method in Report class
agill18 Aug 1, 2022
cdb3b4d
Merge pull request #21 from thinh241819/issue15
cayhorstmann Aug 2, 2022
ef4f83c
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Aug 2, 2022
bc531ba
Fixed annotation parsing to account for space with hidden annotations
agill18 Aug 2, 2022
1f4c883
created 2 interfaces ProblemConnection and AssignmentConnection
charlesnguyen8 Jul 27, 2022
ef27057
implement write() for ProblemLocalConnection
charlesnguyen8 Jul 29, 2022
4fa1411
modified Upload.java, start using ProblemConnector instead of S3Conne…
charlesnguyen8 Jul 29, 2022
c2a5b43
implement read() for ProblemLocalConnection
charlesnguyen8 Jul 31, 2022
a6ec451
implement the other 2 write methods and delete methods for ProblemLoc…
charlesnguyen8 Jul 31, 2022
1ac1177
cleaned up code, delete 2 unecessary write functions and 2 isOnS3
charlesnguyen8 Aug 3, 2022
018d61b
minor changes
agill18 Aug 3, 2022
ddcf23f
Merge pull request #27 from agill18/hiddenTestsFeature
cayhorstmann Aug 4, 2022
0732639
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Aug 4, 2022
e04d197
Deploy staging play-codecheck
cayhorstmann Aug 7, 2022
3576ab1
Deploy release comrun
cayhorstmann Aug 7, 2022
254fcc8
Deploy staging comrun
cayhorstmann Aug 7, 2022
54ca587
Deploy staging comrun
cayhorstmann Aug 7, 2022
eda4133
Deploy staging comrun
cayhorstmann Aug 7, 2022
4f39e08
Deploy staging comrun
cayhorstmann Aug 7, 2022
d733bfb
update ProblemConnection structure and AssignmentConnection structure
charlesnguyen8 Aug 8, 2022
dcb6675
Merge pull request #28 from codeday-labs/localAssignments
cayhorstmann Aug 8, 2022
01e3fa4
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Aug 8, 2022
98407e3
fixed tiny bug
agill18 Aug 8, 2022
216f408
Merge branch 'codeday-labs:hiddenTestsFeature' into hiddenTestsFeature
agill18 Aug 8, 2022
f89901c
Merge pull request #29 from agill18/hiddenTestsFeature
cayhorstmann Aug 9, 2022
d34e023
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Aug 9, 2022
df999c9
Add missing AssignmentLocalConnection contructor
charlesnguyen8 Aug 9, 2022
6d5257d
modify Util.prefix to handle localhost, modify Assignment.parseAssign…
charlesnguyen8 Aug 11, 2022
89ce357
Added changes to AssigmentLocalConnector class in AssigmentConnector …
odiaz95012 Aug 11, 2022
3878df5
update Util.prefix to handle localhost properly
charlesnguyen8 Aug 13, 2022
d259541
Update build-instructions.md
cayhorstmann Aug 13, 2022
eb07a7b
Merge pull request #30 from codeday-labs/prefixLocalDev
cayhorstmann Aug 13, 2022
d5c3890
Merge branch 'main' of github.com:cayhorstmann/codecheck2 into main
cayhorstmann Aug 13, 2022
800152a
Implemented all methods for AssignmentLocalConnector
odiaz95012 Aug 16, 2022
e485f09
Merge branch 'cayhorstmann:main' into OscarNgocLocalAssignment
charlesnguyen8 Aug 16, 2022
a6c6805
clean up code for AssignmentConnector
charlesnguyen8 Aug 16, 2022
1699b80
add case CodeCheckComments to writeJsonToDB
charlesnguyen8 Aug 16, 2022
5747b19
import a missing library
charlesnguyen8 Aug 16, 2022
5da3ced
Merge pull request #33 from codeday-labs/OscarNgocLocalAssignment
cayhorstmann Aug 16, 2022
2b7a2d5
Merge branch 'main' of github.com:cayhorstmann/codecheck2
cayhorstmann Aug 16, 2022
c5591ea
instructor feedback for student submission
charlesnguyen8 Aug 16, 2022
375b73b
change saveComment so that it reload the page correctly
charlesnguyen8 Aug 17, 2022
af71a57
Merge pull request #34 from codeday-labs/instructorFeedback
cayhorstmann Aug 17, 2022
994d8a5
Merge branch 'main' of github.com:cayhorstmann/codecheck2
cayhorstmann Aug 17, 2022
3f2e97a
Update build-instructions.md
cayhorstmann Aug 17, 2022
6dc8f2d
don't read comment when blank workID
charlesnguyen8 Aug 17, 2022
d4f8aef
Merge pull request #35 from codeday-labs/instructorFeedback
cayhorstmann Aug 17, 2022
f9ac5e6
...
cayhorstmann Aug 17, 2022
d6c0d77
change view workAssignment so that instuctor feedback textbox only di…
charlesnguyen8 Aug 18, 2022
eb4b17e
Added feature that allows instructors to input a deadline in their lo…
odiaz95012 Aug 18, 2022
f2566b7
Removed console.log debug statements.
odiaz95012 Aug 18, 2022
800ef7d
Merge pull request #37 from codeday-labs/instructorFeedback
cayhorstmann Aug 18, 2022
940e623
Merge pull request #36 from codeday-labs/issue3
cayhorstmann Aug 18, 2022
4d44bfa
Update on progress
agill18 Aug 19, 2022
0aac810
seperated student and solution with call
agill18 Aug 22, 2022
b97ef9e
Deploy release comrun
cayhorstmann Oct 3, 2022
b52874f
...
cayhorstmann Oct 24, 2022
a242c1e
...
cayhorstmann Oct 24, 2022
39b26e8
Update build-instructions.md
cayhorstmann Oct 27, 2022
01fcf56
Update build-instructions.md
cayhorstmann Oct 27, 2022
17bf68c
Update build-instructions.md
cayhorstmann Oct 27, 2022
081582a
Update build-instructions.md
cayhorstmann Oct 27, 2022
24ce9b2
Merge pull request #38 from agill18/seperateCALL
cayhorstmann Oct 28, 2022
f44edb9
multiline CALL merge
cayhorstmann Oct 28, 2022
de57999
Multiple lines in CALL
cayhorstmann Oct 29, 2022
cd05bcd
Update build-instructions.md
cayhorstmann Oct 30, 2022
51eaa28
Update build-instructions.md
cayhorstmann Oct 31, 2022
604ac4b
Deploy staging play-codecheck
Nov 5, 2022
4f1a381
Deploy staging play-codecheck
Nov 6, 2022
6f1cfa0
...
Nov 7, 2022
d15bc2a
...
Nov 7, 2022
d0d986a
Editing with directories
cayhorstmann Nov 8, 2022
12de21d
Deploy staging play-codecheck
cayhorstmann Nov 8, 2022
033e500
Deploy staging play-codecheck
cayhorstmann Nov 8, 2022
ce89e55
Deploy staging play-codecheck
cayhorstmann Nov 8, 2022
37247ec
Deploy staging play-codecheck
cayhorstmann Nov 11, 2022
3faddcb
Deploy staging play-codecheck
cayhorstmann Nov 12, 2022
36a0f66
Deploy staging play-codecheck
cayhorstmann Nov 14, 2022
53e651e
Deploy staging play-codecheck
cayhorstmann Nov 15, 2022
6288a8f
Merge branch 'main' of github.com:cayhorstmann/codecheck2
cayhorstmann Nov 16, 2022
7e295eb
...
cayhorstmann Nov 16, 2022
6aeeec8
Deploy staging play-codecheck
cayhorstmann Dec 2, 2022
17032be
Deploy staging play-codecheck
cayhorstmann Dec 7, 2022
c2c6cfa
Deploy staging play-codecheck
cayhorstmann Dec 7, 2022
b647aa4
Deploy staging play-codecheck
cayhorstmann Dec 7, 2022
3da4abf
Deploy staging play-codecheck
cayhorstmann Dec 7, 2022
ef9b4ed
Deploy staging play-codecheck
cayhorstmann Dec 8, 2022
619390e
...
cayhorstmann Dec 8, 2022
ee0d980
Added imports/includes to Java/C++ CALL progs
cayhorstmann Dec 9, 2022
5b2160e
..
cayhorstmann Dec 14, 2022
4bcec79
Deploy release play-codecheck
cayhorstmann Dec 16, 2022
30d0ff7
Deploy release play-codecheck
cayhorstmann Dec 16, 2022
92ec299
Deploy release play-codecheck
cayhorstmann Dec 16, 2022
b8d8851
Deploy release play-codecheck
cayhorstmann Dec 16, 2022
ee6e745
Deploy release play-codecheck
cayhorstmann Dec 18, 2022
ea17e76
Deploy release play-codecheck
cayhorstmann Dec 18, 2022
7193919
Deploy release play-codecheck
cayhorstmann Dec 18, 2022
7d7e4b6
Deploy staging play-codecheck
cayhorstmann Dec 22, 2022
39dddcc
Deploy release play-codecheck
cayhorstmann Dec 22, 2022
00c2467
Deploy release play-codecheck
cayhorstmann Jan 12, 2023
251861c
...
cayhorstmann Jan 28, 2023
d9ba132
Deploy staging comrun
cayhorstmann Jan 29, 2023
f017846
Deploy release play-codecheck
cayhorstmann Feb 21, 2023
d2015f4
Deploy release play-codecheck
cayhorstmann Feb 22, 2023
354d9ce
Deploy release play-codecheck
cayhorstmann Feb 22, 2023
cf54eaa
Deploy release play-codecheck
cayhorstmann Mar 9, 2023
e8c284f
Deploy staging play-codecheck
cayhorstmann Mar 24, 2023
c93b7de
Deploy staging play-codecheck
cayhorstmann Mar 24, 2023
47905b2
Deploy staging play-codecheck
cayhorstmann Mar 24, 2023
d0e96b9
Deploy staging play-codecheck
cayhorstmann Mar 24, 2023
b81a79c
Deploy staging play-codecheck
cayhorstmann Apr 17, 2023
62d0432
Deploy staging play-codecheck
cayhorstmann Apr 28, 2023
8943b1f
Deploy staging play-codecheck
cayhorstmann Apr 28, 2023
433fb5e
Deploy staging play-codecheck
cayhorstmann Apr 28, 2023
6a6da32
Deploy staging play-codecheck
cayhorstmann May 7, 2023
fd21a3d
Deploy staging play-codecheck
cayhorstmann May 7, 2023
4c030ba
Deploy staging play-codecheck
cayhorstmann May 10, 2023
4fcd774
Deploy staging play-codecheck
cayhorstmann May 10, 2023
3d2afa9
Deploy staging play-codecheck
cayhorstmann May 10, 2023
c131b41
Deploy staging play-codecheck
cayhorstmann May 10, 2023
fef6fb7
Deploy staging play-codecheck
cayhorstmann May 10, 2023
05443e8
Deploy staging play-codecheck
cayhorstmann May 10, 2023
996d157
Deploy staging play-codecheck
cayhorstmann May 11, 2023
c55a432
Deploy staging play-codecheck
cayhorstmann May 11, 2023
7652e41
Deploy staging play-codecheck
cayhorstmann May 15, 2023
02cabf8
Deploy staging play-codecheck
cayhorstmann May 15, 2023
8dc274c
Deploy staging play-codecheck
cayhorstmann May 15, 2023
3f145a5
Deploy staging play-codecheck
cayhorstmann May 31, 2023
04deb75
...
cayhorstmann Jun 8, 2023
bbc1a2e
Deploy staging play-codecheck
cayhorstmann Jun 8, 2023
ed5d040
Deploy release play-codecheck
cayhorstmann Jun 10, 2023
88822b4
Deploy release play-codecheck
cayhorstmann Jun 10, 2023
7cc5b8c
Deploy staging play-codecheck
cayhorstmann Jun 16, 2023
731fcc5
Deploy staging play-codecheck
cayhorstmann Oct 30, 2023
f4effb2
Deploy release play-codecheck
cayhorstmann Oct 31, 2023
6f8d4d3
Update build-instructions.md
cayhorstmann Nov 5, 2023
7e059d2
Update build-instructions.md
cayhorstmann Nov 5, 2023
50c896d
Modifications to RegEx for isUnitTest and isTester
Tienbruh Nov 7, 2023
3fe559d
Cleanup
Tienbruh Nov 7, 2023
3a2bf28
Merge pull request #48 from Tienbruh/Tien-Pham-Issue-#16
cayhorstmann Nov 9, 2023
74a21ff
Update build-instructions.md
cayhorstmann Nov 9, 2023
4f7695c
Added a feature to expand/collapse read-only files:
GeoJ2003 Nov 15, 2023
825684e
Rust support and some test functionality added
Tienbruh Nov 17, 2023
e16ee2c
added example files for Rust testing
Tienbruh Nov 17, 2023
a238c31
Progress on unit tests
Tienbruh Nov 21, 2023
f612f1d
unit tests working changes
Tienbruh Nov 22, 2023
c62082a
Rust timeout for run and unittest added
Tienbruh Nov 25, 2023
43dff2f
Added student URL to edit problem page
AlexanderChang140 Nov 25, 2023
fb64252
Cleanup
Tienbruh Nov 27, 2023
38b1770
Merge pull request #1 from Tienbruh/Building-Rust-Support
Tienbruh Nov 27, 2023
ad87935
Merge pull request #51 from Tienbruh/main
cayhorstmann Nov 27, 2023
094e726
Refined student URL creation on edit page; both file and tracer type …
AlexanderChang140 Dec 1, 2023
063cc4e
Merge branch 'cayhorstmann:main' into main
AlexanderChang140 Dec 1, 2023
c8f4a00
Merge pull request #50 from GeoJ2003/main
cayhorstmann Dec 5, 2023
c8336fd
Added feature sort table in viewSubmissions
joshmre Dec 6, 2023
b5d7eca
Deploy staging
cayhorstmann Dec 8, 2023
c60f85d
Deploy staging play-codecheck
cayhorstmann Dec 8, 2023
6ec9566
Deploy release comrun
cayhorstmann Dec 8, 2023
5e6da52
Deploy staging play-codecheck
cayhorstmann Jan 6, 2024
16a6386
Merge pull request #52 from AlexanderChang140/main
cayhorstmann Jan 19, 2024
2576dd9
Deploy staging play-codecheck
cayhorstmann Jan 19, 2024
00a3251
Deploy staging play-codecheck
cayhorstmann Jan 19, 2024
9e9101b
Your commit message
joshmre Jan 20, 2024
c3ee577
Refactor code to follow conventions and add column styling
cayhorstmann Nov 27, 2023
4991583
Merge remote-tracking branch 'origin/main' into feature-sort-table
joshmre Jan 20, 2024
f9a44be
Merge branch 'cayhorstmann:main' into feature-sort-table
joshmre Jan 20, 2024
68bb605
Refactor code to follow conventions of existing code, add CSS, and in…
joshmre Jan 20, 2024
96ec9dd
Merge branch 'feature-sort-table' of https://github.com/joshmre/codec…
joshmre Jan 20, 2024
dfe5ff9
Merge pull request #55 from joshmre/feature-sort-table
cayhorstmann Jan 20, 2024
fa239e1
Deploy staging play-codecheck
cayhorstmann Jan 20, 2024
418f542
Deploy staging play-codecheck
cayhorstmann Jan 21, 2024
d2c76f4
Deploy release play-codecheck
cayhorstmann Jan 21, 2024
e71ffeb
Deploy staging play-codecheck
cayhorstmann Feb 7, 2024
4ad51b9
Updated build instructions, error message for misconfigured comrun
cayhorstmann Mar 1, 2024
ee736ea
Deploy staging play-codecheck
cayhorstmann Mar 24, 2024
bb833bb
Bash
cayhorstmann Mar 24, 2024
27661e1
Deploy staging play-codecheck
cayhorstmann Mar 29, 2024
9ea3e29
Deploy staging play-codecheck
cayhorstmann Apr 19, 2024
ecee72d
Deploy staging play-codecheck
cayhorstmann Apr 20, 2024
46c1b52
Deploy staging play-codecheck
cayhorstmann Jun 2, 2024
215a8c2
Deploy release comrun
cayhorstmann Jun 4, 2024
da9cc7c
Update build-instructions.md
cayhorstmann Jun 29, 2024
f80337e
Deploy staging play-codecheck
cayhorstmann Jul 10, 2024
e5b40c4
Merge branch 'main' of github.com:cayhorstmann/codecheck2
cayhorstmann Jul 10, 2024
8e3c3b2
Deploy staging play-codecheck
cayhorstmann Jul 14, 2024
3217482
Deploy staging play-codecheck
cayhorstmann Aug 11, 2024
10b953e
Setup report
cayhorstmann Aug 13, 2024
b709461
Setup report
cayhorstmann Aug 13, 2024
08c6e5f
Added Kristine Nguyen's build instructions
cayhorstmann Aug 14, 2024
6521dcd
Update build-instructions.md
cayhorstmann Sep 5, 2024
b750616
Deploy staging comrun
cayhorstmann Sep 5, 2024
d9e4136
Merge branch 'main' of github.com:cayhorstmann/codecheck2
cayhorstmann Sep 5, 2024
f5d5c47
Kotlin
cayhorstmann Sep 5, 2024
77e9b5b
Kotlin samples
cayhorstmann Sep 5, 2024
8040f2b
Deploy staging comrun
cayhorstmann Sep 9, 2024
4eb9869
Deploy staging comrun
cayhorstmann Sep 9, 2024
39a7476
Deploy staging play-codecheck
cayhorstmann Sep 11, 2024
8c12beb
Deploy staging comrun
cayhorstmann Sep 19, 2024
12b7b4a
Deploy staging comrun
cayhorstmann Sep 19, 2024
3c7ef78
Deploy staging play-codecheck
cayhorstmann Sep 20, 2024
4e7ed37
Deploy staging play-codecheck
cayhorstmann Sep 20, 2024
e895ce2
Deploy staging play-codecheck
cayhorstmann Oct 16, 2024
eb40d8a
Deploy staging play-codecheck
cayhorstmann Oct 26, 2024
f153821
Deploy staging play-codecheck
cayhorstmann Oct 26, 2024
1872f38
Deploy staging play-codecheck
cayhorstmann Oct 27, 2024
88b2d41
Deploy staging play-codecheck
cayhorstmann Oct 27, 2024
86d07e9
Deploy staging play-codecheck
cayhorstmann Oct 30, 2024
95e946c
PHP
cayhorstmann Oct 30, 2024
a8766ec
Storage cleanup
cayhorstmann Nov 6, 2024
b9640fe
Storage cleanup
cayhorstmann Nov 6, 2024
9c5be8a
Storage cleanup
cayhorstmann Nov 6, 2024
cf24f22
Deploy staging codeckeck-quarkus
cayhorstmann Dec 1, 2024
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
**/*.class
**/*.zip
**/*.jar
development.conf
**/*.bloop
conf/development.conf
conf/production.conf
conf/staging.conf
production.env
antbuild
project/project
Expand All @@ -17,11 +19,13 @@ target
.cache-main
.bsp
.metals
.vscode
application-log*
gcloud
deploy
checkall
testdiff
/bin
checker/docker/build
comrun/build
todo.txt
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CodeCheck^®^
CodeCheck<sup>®</sup>
============

* [Description](https://codecheck.io)
Expand Down
102 changes: 71 additions & 31 deletions app/com/horstmann/codecheck/Annotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Pattern;

public class Annotations {
public static final Set<String> VALID_ANNOTATIONS = Set.of(
"HIDE", "SHOW", "EDIT", "SOLUTION", "CALL", "SUB", "ID", "SAMPLE", "ARGS",
public static final Set<String> VALID_ANNOTATIONS = new LinkedHashSet<>(List.of(
"CALL HIDDEN", "IN HIDDEN", "HIDDEN", "HIDE", "SHOW", "EDIT", "SOLUTION", "CALL", "SUB", "ID", "SAMPLE", "ARGS",
"IN", "OUT", "TIMEOUT", "TOLERANCE", "IGNORECASE", "IGNORESPACE", "MAXOUTPUTLEN",
"REQUIRED", "FORBIDDEN", "SCORING", "INTERLEAVE", "TILE", "FIXED", "OR", "PSEUDO");
"REQUIRED", "FORBIDDEN", "SCORING", "INTERLEAVE", "TILE", "FIXED", "OR", "PSEUDO"));
// TODO SAMPLE, SCORING legacy
public static final Set<String> NON_BLANK_BEFORE_OK = Set.of("SUB", "PSEUDO");

public static class Annotation {
Expand All @@ -27,35 +30,48 @@ public static class Annotation {
public String next = "";
}

/**
@param line the line of code to parse
@param start the starting comment delimiter
@param end the ending comment delimiter
@return the parsed annotation, or an empty annotation if none found
*/
public static Annotation parse(String line, String start, String end) {
Annotation ann = new Annotation();
int i = line.indexOf(start);
if (i < 0) return ann;
String before = line.substring(0, i);
i += start.length();
String line1 = line.stripTrailing();
if (!line1.endsWith(end)) return ann;
int j = line1.length() - end.length();
int k = i;
while (k < j && Character.isAlphabetic(line.charAt(k))) k++;
if (k < j && !Character.isWhitespace(line.charAt(k))) return ann;
String key = line.substring(i, k);
if (!VALID_ANNOTATIONS.contains(key)) return ann;
String line1 = line.substring(i).stripTrailing();
if (end.length() > 0) {
if (!line1.endsWith(end)) return ann;
line1 = line1.substring(0, line1.length() - end.length()).stripTrailing();
}
boolean found = false;
Iterator<String> iter = VALID_ANNOTATIONS.iterator();
String key = "";
while (!found && iter.hasNext()) {
key = iter.next();
if (line1.startsWith(key)) found = true;
}
if (!found) return ann;
if (key.length() < line1.length() && !Character.isWhitespace(line1.charAt(key.length()))) return ann;
// Only a few annotations can have non-blank before
if (!before.isBlank() && !NON_BLANK_BEFORE_OK.contains(key)) return ann;
ann.isValid = true;
ann.before = before;
ann.key = key;
ann.args = line.substring(k, j).strip();
ann.args = line1.substring(key.length()).strip();
return ann;
}


private Language language;
private List<Annotation> annotations = new ArrayList<>();
private Set<String> keys = new HashSet<>();
private Set<Path> solutions = new TreeSet<>();
private Set<Path> hidden = new TreeSet<>();
private Set<Path> hiddenCallFiles = new TreeSet<>();
private Set<Path> hiddenTestFiles = new TreeSet<>();

public Annotations(Language language) {
this.language = language;
Expand Down Expand Up @@ -88,6 +104,12 @@ private void read(Path p, byte[] contents) {
solutions.add(p);
if (a.key.equals("HIDE"))
hidden.add(p);
if (a.key.equals("CALL HIDDEN"))
hiddenCallFiles.add(p);
if (a.key.equals("HIDDEN")) {
hiddenTestFiles.add(p);
hidden.add(p);
}
a.path = p;
annotations.add(a);
}
Expand All @@ -102,7 +124,15 @@ public Set<Path> getHidden() {
return Collections.unmodifiableSet(hidden);
}

public String findUniqueKey(String key) {
public Set<Path> getHiddenCallFiles() {
return Collections.unmodifiableSet(hiddenCallFiles);
}

public Set<Path> getHiddenTestFiles() {
return Collections.unmodifiableSet(hiddenTestFiles);
}

public String findUnique(String key) {
Annotation match = null;
for (Annotation a : annotations) {
if (a.key.equals(key)) {
Expand All @@ -123,7 +153,7 @@ else if (!match.args.equals(a.args)) {
return match == null ? null : match.args;
}

public List<String> findKeys(String key) {
public List<String> findAll(String key) {
List<String> result = new ArrayList<>();
for (Annotation a : annotations)
if (a.key.equals(key))
Expand Down Expand Up @@ -152,27 +182,24 @@ public double findUniqueDoubleKey(String key, double defaultValue) {


public boolean checkConditions(Map<Path, String> submissionFiles, Report report) {
String[] delims = language.pseudoCommentDelimiters();
for (Annotation a : annotations) {
boolean forbidden = a.key.equals("FORBIDDEN");
if (a.key.equals("REQUIRED") || forbidden) {
String nextLine = a.next;
String message = null;
if (nextLine.startsWith(delims[0]) && nextLine.endsWith(delims[1]))
message = nextLine.substring(delims[0].length(), nextLine.length() - delims[1].length()).trim();
StringBuilder contents = new StringBuilder();
for (String line : Util.lines(submissionFiles.get(a.path))) {
// TODO: Removing comments like this is language specific
contents.append(line.replaceAll("//.*$", ""));
String commentPattern = Pattern.quote(delims[0]) + ".*" + Pattern.quote(delims[1]);
contents.append(line.replaceAll(commentPattern, ""));
contents.append(" ");
}
boolean found = Pattern.compile(a.args).matcher(contents).find();
if (found == forbidden) { // found && forbidden || !found && required
String nextLine = a.next;
String[] delims = language.pseudoCommentDelimiters();
String message;
if (nextLine.startsWith(delims[0]) && nextLine.endsWith(delims[1]))
message = nextLine.substring(delims[0].length(), nextLine.length() - delims[1].length()).trim();
else
message = (forbidden ? "Found " : "Did not find ") + a.args;
report.error(a.path + ": " + message);
return false;
}
boolean passed = found != forbidden; // found and required or not found and forbidden
report.condition(passed, forbidden, a.path, a.args, message);
if (!passed) return false;
}
}
return true;
Expand All @@ -182,6 +209,10 @@ public boolean has(String key) {
return keys.contains(key);
}

/*
* TODO: It would be more robust if substitutions could only be
* in non-editable lines.
*/
public Substitution findSubstitution() {
Substitution sub = new Substitution(language);
for (Annotation a : annotations) {
Expand All @@ -191,6 +222,7 @@ public Substitution findSubstitution() {
return sub;
}

// TODO: SAMPLE legacy?
/**
* Checks if a path is a sample
* @param p the path without student/solution directory
Expand All @@ -205,9 +237,17 @@ public boolean isSample(Path p) {

public Calls findCalls() {
Calls calls = new Calls(language);
for (Annotation a : annotations) {
if (a.key.equals("CALL"))
calls.addCall(a.path, a.args, a.next);
int callNum = 0;
for (int a=0; a<annotations.size(); a++) {
if (annotations.get(a).key.equals("CALL")) {
calls.addCall(annotations.get(a).path, annotations.get(a).args, annotations.get(a).next);
callNum += 1;
}
else if (annotations.get(a).key.equals("CALL HIDDEN")) {
calls.addCall(annotations.get(a).path, annotations.get(a).args, annotations.get(a).next);
calls.getCall(callNum).setHidden(true);
callNum += 1;
}
}
return calls;
}
Expand Down
10 changes: 5 additions & 5 deletions app/com/horstmann/codecheck/AsExpected.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public class AsExpected {
public AsExpected(Comparison comp) {
this.comp = comp;
}
// Scoring doesn't work when outerr contains an exception report because we don't know how many
// test cases have not occurred.
// Need to count the number of expected cases in the file

// Scoring doesn't work when outerr contains an exception report because we don't know how many
// test cases have not occurred.
// Need to count the number of expected cases in the file

public static int expectedTests(String contents) { // TODO: Shouldn't this be in Language?
Pattern expecteds = Pattern.compile("Expected: "); // TODO: What if this is commented out?
Expand Down Expand Up @@ -66,7 +66,7 @@ public void eval(String value, Report report, Score score, String tester) {
report.output(value);
report.error("Missing \"Expected: ...\"\n");
} else {
report.output(lines, matches, mismatches);
report.output(lines, matches, mismatches);
}
// If the program run ends in an exception, it can happen that the number of
// actual vs. expected values is less than it should be. In that case,
Expand Down
54 changes: 54 additions & 0 deletions app/com/horstmann/codecheck/BashLanguage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.horstmann.codecheck;

import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class BashLanguage implements Language {

@Override
public String getExtension() {
return "sh";
}

@Override
public boolean isMain(Path filename, String contents) {
return moduleOf(filename).matches("main|tester[0-9]*");
}

@Override
public String[] pseudoCommentDelimiters() {
return new String[] { "##", "" };
}

private static Pattern VARIABLE_PATTERN = Pattern.compile("^\\s*(?<name>[A-Za-z][A-Za-z0-9_]*)=(?<rhs>.*)$");
@Override public Pattern variableDeclPattern() { return VARIABLE_PATTERN; }

private static Pattern FUNCTION_PATTERN = Pattern.compile("^\\s*function\\s+(?<name>[A-Za-z][A-Za-z0-9_]*).*");
@Override
public String functionName(String declaration) {
Matcher matcher = FUNCTION_PATTERN.matcher(declaration);
if (matcher.matches()) return matcher.group("name");
else return null;
}

@Override
public Map<Path, String> writeTester(Path file, String contents, List<Calls.Call> calls, ResourceLoader resourceLoader) {

String moduleName = moduleOf(file);
String result = contents + "\n";
result += "case $1 in\n";
for (int k = 0; k < calls.size(); k++) {
Calls.Call call = calls.get(k);
result += " " + (k + 1) + ")\n " + call.name + " " + call.args + "\n ;;\n";
}
result += "esac\n";

Map<Path, String> paths = new HashMap<>();
paths.put(pathOf(moduleName + "CodeCheck"), result);
return paths;
}
}
2 changes: 1 addition & 1 deletion app/com/horstmann/codecheck/CLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public boolean isSource(Path p) {
private static Pattern MAIN_PATTERN = Pattern.compile("\\s*((int|void)\\s+)?main\\s*\\([^)]*\\)\\s*(\\{\\s*)?");
@Override public Pattern mainPattern() { return MAIN_PATTERN; }

private static Pattern VARIABLE_PATTERN = Pattern.compile(".*\\S\\s+(?<name>[A-Za-z][A-Za-z0-9]*)(\\s*[*\\[\\]]+)?\\s*=\\s*(?<rhs>[^;]+);.*");
private static Pattern VARIABLE_PATTERN = Pattern.compile(".*\\S\\s+(?<name>[A-Za-z][A-Za-z0-9_]*)(\\s*[*\\[\\]]+)?\\s*=\\s*(?<rhs>[^;]+);.*");
@Override public Pattern variableDeclPattern() { return VARIABLE_PATTERN; }

private static Pattern ERROR_PATTERN = Pattern.compile(".+/(?<file>[^/]+\\.cpp):(?<line>[0-9]+):(?<col>[0-9]+): error: (?<msg>.+)");
Expand Down
12 changes: 4 additions & 8 deletions app/com/horstmann/codecheck/CSharpLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ public class CSharpLanguage implements Language {
public String getExtension() {
return "cs";
}

private static String patternString = ".*\\S\\s+(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*)\\s*=\\s*(?<rhs>[^;]+);.*";
private static Pattern pattern = Pattern.compile(patternString);

@Override
public Pattern variableDeclPattern() {
return pattern;
}

private static Pattern VARIABLE_DECL_PATTERN = Pattern.compile(
".*\\S\\s+(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*)\\s*=\\s*(?<rhs>[^;]+);");
@Override public Pattern variableDeclPattern() { return VARIABLE_DECL_PATTERN; }
}
2 changes: 1 addition & 1 deletion app/com/horstmann/codecheck/CallMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void run(Path dir, Report report, Score score) throws Exception {
} finally {
loader.close();
}
report.runTable(null, new String[] { "Arguments" }, args, actual, expected, outcomes);
report.runTable(null, new String[] { "Arguments" }, args, actual, expected, outcomes, null, null);
}

private boolean compare(Object a, Object b) {
Expand Down
Loading