Skip to content

Commit

Permalink
#1092 parent 0.59.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 13, 2022
1 parent a33b127 commit c2d778d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Expand Up @@ -33,7 +33,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<parent>
<groupId>com.jcabi</groupId>
<artifactId>parent</artifactId>
<version>0.57.2</version>
<version>0.59.0</version>
</parent>
<groupId>com.qulice</groupId>
<artifactId>qulice</artifactId>
Expand Down Expand Up @@ -96,6 +96,11 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.9.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
1 change: 1 addition & 0 deletions qulice-checkstyle/pom.xml
Expand Up @@ -152,6 +152,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<excludes combine.children="append">
<exclude>checkstyle:/src/test/resources/com/qulice/checkstyle/.*</exclude>
<exclude>pmd:.*/src/test/resources/.*</exclude>
<exclude>dependencies:org.antlr</exclude>
<exclude>xml:/src/main/resources/com/qulice/checkstyle/checks.xml</exclude>
<exclude>xml:/src/test/resources/com/qulice/checkstyle/ChecksTest/.*</exclude>
</excludes>
Expand Down
Expand Up @@ -50,6 +50,7 @@
* Validator of dependencies.
*
* @since 0.3
* @checkstyle ReturnCountCheck (100 line)
*/
final class DependenciesValidator implements MavenValidator {

Expand All @@ -62,13 +63,14 @@ final class DependenciesValidator implements MavenValidator {
public void validate(final MavenEnvironment env)
throws ValidationException {
final Collection<String> excludes = env.excludes("dependencies");
if (!env.outdir().exists()
|| "pom".equals(env.project().getPackaging())
|| excludes.contains(".*")
) {
if (!env.outdir().exists() || "pom".equals(env.project().getPackaging())) {
Logger.info(this, "No dependency analysis in this project");
return;
}
if (excludes.contains(".*")) {
Logger.info(this, "Dependency analysis suppressed in the project via pom.xml");
return;
}
final Collection<String> unused = Collections2.filter(
DependenciesValidator.unused(env),
Predicates.not(new DependenciesValidator.ExcludePredicate(excludes))
Expand All @@ -93,6 +95,13 @@ public void validate(final MavenEnvironment env)
StringUtils.join(used, DependenciesValidator.SEP)
);
}
if (!used.isEmpty() || !unused.isEmpty()) {
Logger.info(
this,
// @checkstyle LineLength (1 line)
"You can suppress this message by <exclude>dependencies:...</exclude> in pom.xml, where <...> is what the dependency name starts with (not a regular expression!)"
);
}
final int failures = used.size() + unused.size();
if (failures > 0) {
throw new ValidationException(
Expand Down

0 comments on commit c2d778d

Please sign in to comment.