Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Adding discrepency log.
Browse files Browse the repository at this point in the history
  • Loading branch information
BDS-AD\jpiscitelli committed Nov 16, 2017
1 parent 6763c0e commit c14676a
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*/
package com.blackducksoftware.integration.hub.detect.bomtool.packagist

import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component

Expand All @@ -42,6 +44,7 @@ import groovy.transform.TypeChecked
@Component
@TypeChecked
class PackagistParser {
private final Logger logger = LoggerFactory.getLogger(PackagistParser.class)

@Autowired
ExternalIdFactory externalIdFactory
Expand All @@ -60,6 +63,20 @@ class PackagistParser {
List<PackagistDependency> packagistPackages = parsePackages(packagesJson, includeDev)
addToGraph(graph, null, projectPackages, packagistPackages, true)

List<String> allLockPackageNames = packagistPackages.collect { it.name }
projectPackages.each {
if (!allLockPackageNames.contains(it)){
logger.warn("A discrepency exists between the composer.json and the composer.lock - the package '${it}' was in the json but not the lock.");
}
}
packagistPackages.each {
Dependency dependency = convertToDependency(it);
if (!graph.hasDependency(dependency)){
logger.warn("A discrepency exists between the composer.json and the composer.lock - the package '${it.name}' was in the lock but was not included in the json dependency tree.");
}
}


ExternalId projectExternalId;
if (projectName == null || projectVersion == null){
projectExternalId = externalIdFactory.createPathExternalId(Forge.PACKAGIST, sourcePath);
Expand Down

0 comments on commit c14676a

Please sign in to comment.