Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ public enum EventKey {
WARNING_INVALID_CAT_SKIPPED("warning.invalidCategorySkipped", 1, MessageType.WARNING, MessageHandler.UX, true),
WARNING_INVALID_RULESET_SKIPPED("warning.invalidRulesetSkipped", 1, MessageType.WARNING, MessageHandler.UX, true),
WARNING_XML_DROPPED("warning.xmlDropped", 1, MessageType.WARNING, MessageHandler.UX, true),
WARNING_PMD7_INCOMPATIBLE_RULE("warning.pmd7IncompatibleRule", 2, MessageType.WARNING, MessageHandler.UX, false),
INFO_JAR_AND_XML_PROCESSED("info.jarAndXmlProcessed", 2, MessageType.INFO, MessageHandler.UX, true),
INFO_JAR_AND_XML_PROCESSED("info.jarAndXmlProcessed", 2, MessageType.INFO, MessageHandler.UX, true),
ERROR_INTERNAL_UNEXPECTED("error.internal.unexpectedError", 1, MessageType.ERROR, MessageHandler.INTERNAL, false),
ERROR_INTERNAL_MAIN_INVALID_ARGUMENT("error.internal.mainInvalidArgument", 1, MessageType.ERROR, MessageHandler.INTERNAL, false),
ERROR_INTERNAL_JSON_WRITE_FAILED("error.internal.jsonWriteFailed", 1, MessageType.ERROR, MessageHandler.INTERNAL, false),
Expand Down
4 changes: 0 additions & 4 deletions messages/EventKeyTemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ Overall, analyzed %s path(s) from %s entry point(s). Detected %s violation(s).

This message is unused.

# warning.pmd7IncompatibleRule

PMD rule [%s] isn't compatible with PMD 7.0: %s. Resolve these issues to future-proof your rule. If you need help, log an issue on github.com/forcedotcom/sfdx-scanner

# warning.invalidCategorySkipped

Cataloger: Skipping invalid PMD Category file '%s'.
Expand Down
8 changes: 0 additions & 8 deletions messages/describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ the name of the rule

The name of the rule.

# flags.previewPmd7Summary

use PMD version %s to describe PMD and CPD rules

# flags.previewPmd7Description

Uses PMD version %s instead of %s to describe PMD and CPD rules.

# output.noMatchingRules

No rules were found with the name '%s'.
Expand Down
8 changes: 0 additions & 8 deletions messages/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ select rules by engine

Selects rules by engine. Enter multiple engines as a comma-separated list.

# flags.previewPmd7Summary

use PMD version %s to list PMD and CPD rules

# flags.previewPmd7Description

Uses PMD version %s instead of %s to list PMD and CPD rules.

# rulesetDeprecation

The 'ruleset' command parameter is deprecated. Use 'category' instead
Expand Down
8 changes: 0 additions & 8 deletions messages/run-pathless.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ specify location of PMD rule reference XML file to customize rule selection

Specifies the location of the PMD rule reference XML file to customize rule selection.

# flags.previewPmd7Summary

use PMD version %s when running PMD and CPD

# flags.previewPmd7Description

Uses PMD version %s instead of %s when running PMD and CPD engines.

# flags.verboseViolationsSummary

return retire-js violation message details
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
"prepack": "rm -rf lib && tsc -b && oclif manifest && oclif readme && oclif lock && npm shrinkwrap",
"postpack": "rm -f oclif.manifest.json oclif.lock npm-shrinkwrap.json",
"lint-typescript": "eslint ./src --ext .ts --max-warnings 0",
"test": "./gradlew test jacocoTestCoverageVerification && nyc mocha --timeout 10000 --retries 5 \"./test/**/*.test.ts\"",
"test-quiet": "cross-env SFGE_LOGGING=false ./gradlew test jacocoTestCoverageVerification && nyc mocha --timeout 10000 --retries 5 \"./test/**/*.test.ts\"",
"test": "./gradlew test jacocoTestCoverageVerification && nyc mocha --timeout 60000 --retries 5 \"./test/**/*.test.ts\"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we making this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll notice that test-typescript already has a --timeout of 60000 ... so I was updating the others to reflect that change in all the commands. Basically on a given users machine a few tests go over 10 seconds... on my machine 3 tests consistently take 12 to 13 seconds. In the past, Josh updated test-typescript (which is the command he uses locally) to 60 seconds. I personally use yarn test locally to just run all the tests for all subprojects. So increasing this timeout to 60 seconds is the safest thing to do... it allows us to run things locally without tests dying but gives a sanity check for a run away test to stop and fail in our build system.

"test-quiet": "cross-env SFGE_LOGGING=false ./gradlew test jacocoTestCoverageVerification && nyc mocha --timeout 60000 --retries 5 \"./test/**/*.test.ts\"",
"test-cli-messaging": "./gradlew cli-messaging:test cli-messaging:jacocoTestCoverageVerification",
"test-pmd-cataloger": "./gradlew pmd-cataloger:test pmd-cataloger:jacocoTestCoverageVerification",
"test-sfge": "./gradlew sfge:test sfge:jacocoTestCoverageVerification",
Expand Down
75 changes: 13 additions & 62 deletions pmd-cataloger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ dependencies {
exclude("junit")
}
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.google.guava:guava:31.1-jre")
implementation("com.google.guava:guava:33.0.0-jre")

testImplementation("org.mockito:mockito-core:5.2.0")
testImplementation("org.mockito:mockito-core:5.10.0")
testImplementation("org.hamcrest:hamcrest:2.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")

// Used in unit tests
testImplementation(files("$buildDir/../../test/test-jars/apex/testjar-categories-and-rulesets-1.jar"))
Expand Down Expand Up @@ -60,57 +60,10 @@ tasks.register<Delete>("deletePmdCatalogerDist") {
delete(pmdCatalogerDistDir)
}

// ======== DEFINE/UPDATE PMD6 DIST RELATED TASKS =====================================================================
val pmd6DistDir = "$distDir/pmd"
val pmd6Version = "6.55.0"
val pmd6File = "pmd-bin-$pmd6Version.zip"

tasks.register<de.undercouch.gradle.tasks.download.Download>("downloadPmd6") {
src("https://github.com/pmd/pmd/releases/download/pmd_releases%2F${pmd6Version}/${pmd6File}")
dest(buildDir)
overwrite(false)
}

tasks.register<Copy>("installPmd6") {
dependsOn("downloadPmd6")
from(zipTree("$buildDir/$pmd6File"))

// I went to https://github.com/pmd/pmd/tree/pmd_releases/6.55.0 and for each of the languages that we support
// (apex, java, visualforce, xml), I took a look at its direct and indirect dependencies at
// https://central.sonatype.com/artifact/net.sourceforge.pmd/pmd-apex/dependencies
// by selecting the 6.55.0 dropdown and clicking on "Dependencies" and selecting "All Dependencies".
// For completeness, I listed the modules and all their compile time dependencies (direct and indirect).
// Duplicates don't matter since we use setOf.
val pmd6ModulesToInclude = setOf(
// LANGUAGE MODULE DEPENDENCIES (direct and indirect)
"pmd-apex", "animal-sniffer-annotations", "antlr", "antlr-runtime", "antlr4-runtime", "aopalliance", "asm", "cglib", "commons-lang3", "error_prone_annotations", "gson", "j2objc-annotations", "javax.inject", "jcommander", "jol-core", "jsr305", "logback-classic", "logback-core", "pmd-apex-jorje", "pmd-core", "saxon", "slf4j-api", "stringtemplate",
"pmd-java", "antlr4-runtime", "asm", "commons-lang3", "gson", "jcommander", "pmd-core", "saxon",
"pmd-visualforce", "animal-sniffer-annotations", "antlr", "antlr-runtime", "antlr4-runtime", "aopalliance", "asm", "cglib", "commons-lang3", "error_prone_annotations", "gson", "j2objc-annotations", "javax.inject", "jcommander", "jol-core", "jsr305", "logback-classic", "logback-core", "pmd-apex", "pmd-apex-jorje", "pmd-core", "saxon", "slf4j-api", "stringtemplate",
"pmd-xml", "antr4-runtime", "asm", "commons-lang3", "gson", "jcommander", "pmd-core", "saxon"
)

val pmd6JarsToIncludeRegexes = mutableSetOf("""^LICENSE""".toRegex())
pmd6ModulesToInclude.forEach {
pmd6JarsToIncludeRegexes.add("""^$it-.*\.jar""".toRegex())
}

include { details: FileTreeElement -> pmd6JarsToIncludeRegexes.any { it.containsMatchIn(details.file.name) } }
into(pmd6DistDir)
includeEmptyDirs = false
eachFile {
// We drop the parent "pmd-bin-6.55.0" folder and put files directly into our "pmd" folder
relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
}
}

tasks.register<Delete>("deletePmd6Dist") {
delete(pmd6DistDir)
}


// ======== DEFINE/UPDATE PMD7 DIST RELATED TASKS =====================================================================
val pmd7DistDir = "$distDir/pmd7"
val pmd7Version = "7.0.0-rc4"
val pmd7Version = "7.0.0"
val pmd7File = "pmd-dist-$pmd7Version-bin.zip"

tasks.register<de.undercouch.gradle.tasks.download.Download>("downloadPmd7") {
Expand All @@ -123,20 +76,20 @@ tasks.register<Copy>("installPmd7") {
dependsOn("downloadPmd7")
from(zipTree("$buildDir/$pmd7File"))

// I went to https://github.com/pmd/pmd/tree/pmd_releases/7.0.0-rc4 and for each of the languages that we support
// I went to https://github.com/pmd/pmd/tree/pmd_releases/7.0.0 and for each of the languages that we support
// (apex, java, visualforce, xml), I took a look at its direct and indirect dependencies at
// https://central.sonatype.com/artifact/net.sourceforge.pmd/pmd-apex/dependencies
// by selecting the 7.0.0-rc4 dropdown and clicking on "Dependencies" and selecting "All Dependencies".
// by selecting the 7.0.0 dropdown and clicking on "Dependencies" and selecting "All Dependencies".
// For completeness, I listed the modules and all their compile time dependencies (direct and indirect).
// Duplicates don't matter since we use setOf.
val pmd7ModulesToInclude = setOf(
// LANGUAGE MODULE DEPENDENCIES (direct and indirect)
"pmd-apex", "Saxon-HE", "animal-sniffer-annotations", "antlr", "antlr-runtime", "antlr4-runtime", "aopalliance", "apex-parser", "apexlink", "asm", "cglib", "checker-qual", "commons-lang3", "error_prone_annotations", "failureaccess", "geny_2.13", "gson", "guava", "j2objc-annotations", "javax.inject", "jsr305", "jul-to-slf4j", "listenablefuture", "nice-xml-messages", "pcollections", "pkgforce_2.13", "pmd-apex-jorje", "pmd-core", "runforce", "scala-collection-compat_2.13", "scala-json-rpc-upickle-json-serializer_2.13", "scala-json-rpc_2.13", "scala-library", "scala-parallel-collections_2.13", "scala-reflect", "scala-xml_2.13", "slf4j-api", "stringtemplate", "ujson_2.13", "upack_2.13", "upickle-core_2.13", "upickle-implicits_2.13", "upickle_2.13",
"pmd-apex", "Saxon-HE", "annotations", "antlr4-runtime", "apex-parser", "apexlink", "asm", "checker-compat-qual", "checker-qual", "checker-qual", "commons-lang3", "error_prone_annotations", "failureaccess", "flogger", "flogger-system-backend", "geny_2.13", "gson", "gson-extras", "guava", "j2objc-annotations", "jsr250-api", "jsr305", "jul-to-slf4j", "kotlin-stdlib", "kotlin-stdlib-common", "kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8", "listenablefuture", "nice-xml-messages", "pcollections", "pkgforce_2.13", "pmd-core", "runforce", "scala-collection-compat_2.13", "scala-json-rpc-upickle-json-serializer_2.13", "scala-json-rpc_2.13", "scala-library", "scala-parallel-collections_2.13", "scala-reflect", "scala-xml_2.13", "slf4j-api", "summit-ast", "ujson_2.13", "upack_2.13", "upickle-core_2.13", "upickle-implicits_2.13", "upickle_2.13",
"pmd-java", "Saxon-HE", "antlr4-runtime", "asm", "checker-qual", "commons-lang3", "gson", "jul-to-slf4j", "nice-xml-messages", "pcollections", "pmd-core", "slf4j-api",
"pmd-visualforce", "Saxon-HE", "animal-sniffer-annotations", "antlr", "antlr-runtime", "antlr4-runtime", "aopalliance", "apex-parser", "apexlink", "asm", "cglib", "checker-qual", "commons-lang3", "error_prone_annotations", "failureaccess", "geny_2.13", "gson", "guava", "j2objc-annotations", "javax.inject", "jsr305", "jul-to-slf4j", "listenablefuture", "nice-xml-messages", "pcollections", "pkgforce_2.13", "pmd-apex", "pmd-apex-jorje", "pmd-core", "runforce", "scala-collection-compat_2.13", "scala-json-rpc-upickle-json-serializer_2.13", "scala-json-rpc_2.13", "scala-library", "scala-parallel-collections_2.13", "scala-reflect", "scala-xml_2.13", "slf4j-api", "stringtemplate", "ujson_2.13", "upack_2.13", "upickle-core_2.13", "upickle-implicits_2.13", "upickle_2.13",
"pmd-visualforce", "Saxon-HE", "antlr4-runtime", "apex-parser", "apexlink", "asm", "checker-compat-qual", "checker-qual", "commons-lang3", "error_prone_annotations", "failureaccess", "flogger", "flogger-system-backend", "geny_2.13", "gson", "gson-extras", "guava", "j2objc-annotations", "jsr250-api", "jsr305", "jul-to-slf4j", "kotlin-stdlib", "kotlin-stdlib-common", "kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8", "listenablefuture", "nice-xml-messages", "pcollections", "pkgforce_2.13", "pmd-apex", "pmd-core", "runforce", "scala-collection-compat_2.13", "scala-json-rpc-upickle-json-serializer_2.13", "scala-json-rpc_2.13", "scala-library", "scala-parallel-collections_2.13", "scala-reflect", "scala-xml_2.13", "slf4j-api", "summit-ast", "ujson_2.13", "upack_2.13", "upickle-core_2.13", "upickle-implicits_2.13", "upickle_2.13",
"pmd-xml", "Saxon-HE", "antlr4-runtime", "asm", "checker-qual", "commons-lang3", "gson", "jul-to-slf4j", "nice-xml-messages", "pcollections", "pmd-core", "slf4j-api",
// MAIN CLI MODULE DEPENDENCIES (direct and indirect)
"pmd-cli", "Saxon-HE", "antlr4-runtime", "asm", "checker-qual", "commons-lang3", "gson", "jline", "jul-to-slf4j", "nice-xml-messages", "pcollections", "picocli", "pmd-core", "pmd-ui", "progressbar", "slf4j-api", "slf4j-simple",
"pmd-cli", "Saxon-HE", "antlr4-runtime", "asm", "checker-qual", "commons-lang3", "gson", "jline", "jul-to-slf4j", "nice-xml-messages", "pcollections", "picocli", "pmd-core", "progressbar", "slf4j-api", "slf4j-simple",
)
val pmd7JarsToIncludeRegexes = mutableSetOf("""^LICENSE""".toRegex())
pmd7ModulesToInclude.forEach {
Expand All @@ -147,7 +100,7 @@ tasks.register<Copy>("installPmd7") {
into(pmd7DistDir)
includeEmptyDirs = false
eachFile {
// We drop the parent "pmd-bin-7.0.0-rc4" folder and put files directly into our "pmd7" folder
// We drop the parent "pmd-bin-7.0.0" folder and put files directly into our "pmd7" folder
relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
}
}
Expand All @@ -160,13 +113,11 @@ tasks.register<Delete>("deletePmd7Dist") {
// ======== ATTACH TASKS TO ASSEMBLE AND CLEAN ========================================================================
tasks.assemble {
dependsOn("installDist")
dependsOn("installPmd6")
dependsOn("installPmd7")
}

tasks.clean {
dependsOn("deletePmdCatalogerDist")
dependsOn("deletePmd6Dist")
dependsOn("deletePmd7Dist")
}

Expand Down Expand Up @@ -203,7 +154,7 @@ tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = BigDecimal("0.80")
minimum = BigDecimal("0.78")
}
}
}
Expand Down

This file was deleted.

Loading