Skip to content

Commit

Permalink
Merge pull request #541 from BrightSpots/develop
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
HEdingfield committed Dec 13, 2020
2 parents a81a249 + b1af1e8 commit d4ac2db
Show file tree
Hide file tree
Showing 291 changed files with 118,168 additions and 8,523 deletions.
4 changes: 1 addition & 3 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions README.md
Expand Up @@ -30,7 +30,7 @@ The Tabulator produces the following as output:

#### Method 2 (Less Easy): Compile and Run Using Gradle

1. Install [JDK 11 or higher](https://jdk.java.net/), and make sure your Java path is picking it up properly by verifying that the following command returns the expected version:
1. Install [JDK 14 or higher](https://jdk.java.net/), and make sure your Java path is picking it up properly by verifying that the following command returns the expected version:

`$ java -version`

Expand Down Expand Up @@ -61,7 +61,7 @@ Mac OS has built-in encryption capability that allows users to create encrypted

The GUI can be used to easily create, save, and load contest configuration files (which are in .json format). These files can also be created manually using any basic text editor, but this method isn't recommended.

In either case, please reference the [config file documentation](src/main/resources/network/brightspots/rcv/config_file_documentation.txt) when configuring a contest.
In either case, please reference the [config file documentation](config_file_documentation.txt) when configuring a contest.

**Warning**: Using shortcuts, aliases, or symbolic links to launch the Tabulator is not supported; doing so may result in unexpected behavior. Also, please avoid clicking in the command prompt / terminal window when starting the Tabulator GUI, as it may halt the startup process.

Expand Down Expand Up @@ -95,11 +95,7 @@ Or, again, if you're compiling and running using Gradle:

`$ gradlew run --args="-cli path/to/config convert-to-cdf"`

Finally, there's a `convert-dominion-to-generic-csv` option as well for converting Dominion JSON CVRs into a standardized, generic .csv format:

`$ rcv -cli path/to/folder/containing/jsons convert-dominion-to-generic-csv`

This option is available in the GUI by selecting the "Conversion > Convert Dominion to Generic Format..." menu option.
Note: if you convert a source to CDF and that source uses an overvoteLabel or an undeclaredWriteInLabel, the label will be represented differently in the generated CDF source file than it was in the original CVR source. When you create a new config using this generated CDF source file and you need to set overvoteLabel, you should use "overvote". If you need to set undeclaredWriteInLabel, you should use "Undeclared Write-ins".

## Viewing Tabulator Output

Expand Down
47 changes: 30 additions & 17 deletions build.gradle
Expand Up @@ -3,27 +3,28 @@ plugins {
id "checkstyle"
id "idea"
id "java"
id "org.openjfx.javafxplugin" version "0.0.8"
id "org.beryx.jlink" version "2.17.2"
id "org.openjfx.javafxplugin" version "0.0.9"
id "org.beryx.jlink" version "2.20.0"
}

repositories {
mavenCentral()
}

dependencies {
compile "org.apache.commons:commons-csv:1.8"
compile "org.apache.poi:poi-ooxml:4.1.2"
compile "com.fasterxml.jackson.core:jackson-core:2.10.2"
compile "com.fasterxml.jackson.core:jackson-annotations:2.10.2"
compile "com.fasterxml.jackson.core:jackson-databind:2.10.2"
testCompile "org.junit.jupiter:junit-jupiter-api:5.5.0-M1"
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.5.0-M1"
implementation "org.apache.commons:commons-csv:1.8"
implementation "org.apache.poi:poi-ooxml:4.1.2"
implementation "com.fasterxml.jackson.core:jackson-core:2.11.1"
implementation "com.fasterxml.jackson.core:jackson-annotations:2.11.1"
implementation "com.fasterxml.jackson.core:jackson-databind:2.11.1"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.1"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
}

// ### Application plugin settings
application {
mainClassName = "$moduleName/network.brightspots.rcv.Main"
mainClassName = "${moduleName}.Main"
}

// Uncomment below to simulate running from the CLI
Expand All @@ -34,11 +35,17 @@ application {

// ### Checkstyle plugin settings
checkstyle {
toolVersion = "8.30"
toolVersion = "8.36.2"
// Keep the below file updated along with subsequent versions of Checkstyle (make sure to choose
// the tag matching the toolVersion above):
// https://github.com/checkstyle/checkstyle/blob/checkstyle-8.23/src/main/resources/google_checks.xml
configFile = file("${configDir}/google_checks.xml")
//
// https://github.com/checkstyle/checkstyle/blob/checkstyle-8.36.2/src/main/resources/google_checks.xml
//
// VERY IMPORTANT: after copying a new version of the above, make sure the "SuppressionFilter"
// module has this line in order to actually pick up our project's Checkstyle suppression rules:
// value="${config_loc}/checkstyle-suppressions.xml"
// More info on this at: https://github.com/BrightSpots/rcv/issues/489
configFile = file("$projectDir/config/checkstyle/google_checks.xml")
}

// ### Idea plugin settings
Expand All @@ -49,13 +56,19 @@ idea {
}

// ### Java plugin settings
sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_14

compileJava.dependsOn(clean)
compileJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}

test {
moduleOptions {
addExports = ["org.junit.platform.commons/org.junit.platform.commons.util": "ALL-UNNAMED",
"org.junit.platform.commons/org.junit.platform.commons.logging": "ALL-UNNAMED"]
}
maxHeapSize = "2056m"
useJUnitPlatform()
testLogging {
events "PASSED", "FAILED", "SKIPPED"
Expand All @@ -64,8 +77,8 @@ test {

// ### JavaFX plugin settings
javafx {
version = "13.0.2"
modules = ["javafx.controls", "javafx.fxml"]
version = "14.0.1"
modules = ["javafx.base", "javafx.controls", "javafx.fxml", "javafx.graphics"]
}

def JLINK_DIR = "$buildDir/rcv"
Expand All @@ -85,7 +98,7 @@ jlink {

def docsToCopy = copySpec {
from("$projectDir") {
include "README.md", "LICENSE"
include "README.md", "LICENSE", "config_file_documentation.txt"
}
}

Expand Down
18 changes: 18 additions & 0 deletions config/checkstyle/checkstyle-suppressions.xml
@@ -0,0 +1,18 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<!-- If we don't name our fields in ways the violate the below checks, the code doesn't function -->
<suppress checks="MemberName" files="CommonDataFormatReader.java|HartCvrReader.java"/>
<suppress checks="AbbreviationAsWordInNameCheck" files="CommonDataFormatReader.java"
message="CVR"/>
<suppress checks="AbbreviationAsWordInNameCheck" files="HartCvrReader.java" message="ID"/>

<!-- Disagree with the check in this case -->
<suppress checks="AbbreviationAsWordInNameCheck" files="ContestConfig.java"
message="isMultiSeatBottomsUpUntilNWinnersEnabled"/>

</suppressions>
70 changes: 49 additions & 21 deletions config/checkstyle/google_checks.xml
Expand Up @@ -6,17 +6,20 @@
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.org (or in your downloaded distribution).
To completely disable a check, just comment it out or delete it from the file.
To suppress certain violations please review suppression filters.
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
-->

<module name="Checker">
<module name="SuppressionFilter">
<property default="checkstyle-suppressions.xml" name="file"
value="${org.checkstyle.google.suppressionfilter.config}"/>
value="${config_loc}/checkstyle-suppressions.xml"/>
<property name="optional" value="true"/>
</module>

Expand Down Expand Up @@ -61,7 +64,7 @@
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
OBJBLOCK, STATIC_INIT"/>
OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
Expand All @@ -74,28 +77,35 @@
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF"/>
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF,
COMPACT_CTOR_DEF"/>
</module>
<module name="SuppressionXpathSingleFilter">
<!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
<property name="id" value="RightCurlyAlone"/>
<property name="query" value="//RCURLY[parent::SLIST[count(./*)=1]
or preceding-sibling::*[last()][self::LCURLY]]"/>
or preceding-sibling::*[last()][self::LCURLY]]"/>
</module>
<module name="WhitespaceAfter">
<property name="tokens"
value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE,
LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="ignoreEnhancedForColon" value="false"/>
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
Expand All @@ -111,7 +121,8 @@
<module name="EmptyLineSeparator">
<property name="tokens"
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF, RECORD_DEF,
COMPACT_CTOR_DEF"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
Expand Down Expand Up @@ -147,7 +158,8 @@
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF"/>
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
ANNOTATION_DEF, RECORD_DEF"/>
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
Expand Down Expand Up @@ -176,11 +188,21 @@
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="PatternVariableName">
<message key="name.invalidPattern"
value="Pattern variable name ''{0}'' must match pattern ''{1}''."/>
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="RecordTypeParameterName">
<message key="name.invalidPattern"
value="Record type name ''{0}'' must match pattern ''{1}''."/>
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
Expand Down Expand Up @@ -212,10 +234,11 @@
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="allowedAbbreviationLength" value="0"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/>
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF, RECORD_DEF,
RECORD_COMPONENT_DEF"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
Expand All @@ -228,19 +251,21 @@
<module name="MethodParamPad">
<property name="tokens"
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF"/>
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
value="COMMA, SEMI, POST_INC, POST_DEC, DOT,
LABELED_STAT, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="ParenPad">
<property name="tokens"
value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA"/>
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA,
RECORD_DEF"/>
</module>
<module name="OperatorWrap">
<property name="option" value="NL"/>
Expand All @@ -251,7 +276,8 @@
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF,
RECORD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
Expand All @@ -266,6 +292,7 @@
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="RequireEmptyLineBeforeBlockTagGroup"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target"
Expand All @@ -276,13 +303,14 @@
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="MissingJavadocMethod">
<property name="scope" value="public"/>
<property name="minLineCount" value="2"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF,
COMPACT_CTOR_DEF"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
Expand Down Expand Up @@ -311,14 +339,14 @@
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
<property name="charset" value="UTF-8"/>

<!-- Checks for whitespace -->
<!-- See http://checkstyle.org/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<!-- Checks for whitespace -->
<!-- See http://checkstyle.org/config_whitespace.html -->
<property name="charset" value="UTF-8"/>

<property name="severity" value="warning"/>

<property name="fileExtensions" value="java, properties, xml"/>
Expand Down

0 comments on commit d4ac2db

Please sign in to comment.