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

Support ignoring dev dependencies in Node Package analyzer #354

Merged
merged 1 commit into from
Oct 21, 2023
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 @@ -157,7 +157,9 @@ class AnalyzerExtension {
Boolean cpanEnabled
/**
* Sets whether the Node.js Analyzer should be used.
* @deprecated Use nodePackage { enabled = true }
*/
@Deprecated
Boolean nodeEnabled
/**
* Sets whether the NSP Analyzer should be used.
Expand Down Expand Up @@ -186,6 +188,11 @@ class AnalyzerExtension {
*/
NodeAuditExtension nodeAudit = new NodeAuditExtension()

/**
* The configuration extension for the node package settings.
*/
NodePackageExtension nodePackage = new NodePackageExtension()

/**
* The configuration extension for artifactory settings.
*/
Expand Down Expand Up @@ -231,4 +238,13 @@ class AnalyzerExtension {
def nodeAudit(Closure configClosure) {
return project.configure(nodeAudit, configClosure)
}

/**
* Allows programmatic configuration of the node package extension
* @param configClosure the closure to configure the node extension
* @return the node extension
*/
def nodePackage(Closure configClosure) {
return project.configure(nodePackage, configClosure)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of dependency-check-gradle.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2019 Jeremy Long. All Rights Reserved.
*/
package org.owasp.dependencycheck.gradle.extension

/**
* The configuration for the Node Package Analyzer.
*/
@groovy.transform.CompileStatic
class NodePackageExtension {
/**
* Sets whether the Node Package Analyzer should be used.
*/
Boolean enabled
/**
* Sets whether the Node Package Analyzer should skip devDependencies.
*/
Boolean skipDevDependencies
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ abstract class ConfiguredTask extends DefaultTask {
settings.setBooleanIfNotNull(ANALYZER_NUGETCONF_ENABLED, config.analyzers.nugetconfEnabled)


settings.setBooleanIfNotNull(ANALYZER_NODE_PACKAGE_ENABLED, config.analyzers.nodeEnabled)
settings.setBooleanIfNotNull(ANALYZER_NODE_PACKAGE_ENABLED, select(config.analyzers.nodePackage.enabled, config.analyzers.nodeEnabled))
settings.setBooleanIfNotNull(ANALYZER_NODE_PACKAGE_SKIPDEV, config.analyzers.nodePackage.skipDevDependencies)
settings.setBooleanIfNotNull(ANALYZER_NODE_AUDIT_ENABLED, select(config.analyzers.nodeAudit.enabled, config.analyzers.nodeAuditEnabled))
settings.setBooleanIfNotNull(ANALYZER_NODE_AUDIT_USE_CACHE, config.analyzers.nodeAudit.useCache)
settings.setBooleanIfNotNull(ANALYZER_NODE_AUDIT_SKIPDEV, config.analyzers.nodeAudit.skipDevDependencies)
Expand Down
Loading