Examples of InputLocation


Examples of org.apache.maven.model.InputLocation

    }

    private InputLocation getEmptyLocation(MavenProject mavenProject) {
        final InputSource source = new InputSource();
        source.setLocation(mavenProject.getOriginalModel().getPomFile() + "");
        return new InputLocation(0, 0, source);
    }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

    final String version = modelUtil.getVersion(modelObject);
    final String inheritedVersion = modelUtil.getVersion(inheritedModelObject);
    // both have a version, but if they're different, that might be ok.
    // But if they're the same, then one is redundant.
    if (version != null && inheritedVersion != null && inheritedVersion.equals(version)) {
      final InputLocation location = modelUtil.getLocation(modelObject, "version");
      resultCollector.addViolation(mavenProject, this, dependencyDescription + " '" + modelUtil.getKey(modelObject) +
          "' has same version (" + version + ") as " + inheritedDescription, location);
    }
  }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

        final String inceptionYear = mavenProject.getInceptionYear();

        if (StringUtils.isEmpty(inceptionYear)) {
            resultCollector.addViolation(mavenProject, this, "missing <inceptionYear/> information", getEmptyLocation(mavenProject));
        }else if (!inceptionYear.matches("\\d{4}")){
            InputLocation location = mavenProject.getOriginalModel().getLocation("inceptionYear");
            resultCollector.addViolation(mavenProject, this, "format of <inceptionYear/> information is wrong, only 4 digits allowed", location);
        }
    }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

    }

    private InputLocation getEmptyLocation(MavenProject mavenProject) {
        final InputSource source = new InputSource();
        source.setLocation(mavenProject.getOriginalModel().getPomFile() + "");
        return new InputLocation(0, 0, source);
    }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

    @Override
    public void invoke(MavenProject mavenProject, Map<String, Object> models, ResultCollector resultCollector) {
        final List<License> licenses = mavenProject.getLicenses();

        if (licenses.isEmpty()) {
            InputLocation location = mavenProject.getOriginalModel().getLocation("licences");
            resultCollector.addViolation(mavenProject, this, "missing <licenses/> information", location == null ? getEmptyLocation(mavenProject) : location);
        } else {
            for (License license : licenses) {
                if (StringUtils.isEmpty(license.getName())) {
                    resultCollector.addViolation(mavenProject, this, "missing <name> in <license/> information", license.getLocation(""));
View Full Code Here

Examples of org.apache.maven.model.InputLocation

    }

    private InputLocation getEmptyLocation(MavenProject mavenProject) {
        final InputSource source = new InputSource();
        source.setLocation(mavenProject.getOriginalModel().getPomFile() + "");
        return new InputLocation(0, 0, source);
    }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

   
    for (final Map.Entry<Object,VersionProperty> entry : versionPropertyByObject.entrySet()) {
      final VersionProperty versionProperty = entry.getValue();
      for (final String propertyName : versionProperty.getPropertyNames()) {
        if (propertyName.equals("version")) {
          final InputLocation location = modelUtil.getLocation(entry.getKey(), "version");
          resultCollector.addViolation(mavenProject, this, "Use '${project.version}' instead of '${version}'", location);
        }
      }
    }
  }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

  }

  @Test
  public void shouldFindSuppressionImmediatelyAfterClosingTag() {
    Assert.assertEquals("<!-- NoLint:Identifier shouldFindSuppressionImmediatelyAfterClosingTag -->",
        violationSuppressor.findSuppressionComment(new Violation(DUMMY_MAVEN_PROJECT, RULE, DUMMY_MESSAGE, new InputLocation(17, 16, source))));
  }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

  }

  @Test
  public void shouldFindSuppressionOnNextLine() {
    Assert.assertEquals("<!-- NOLINT:IDENTIFIER shouldFindSuppressionOnNextLine -->",
        violationSuppressor.findSuppressionComment(new Violation(DUMMY_MAVEN_PROJECT, RULE, DUMMY_MESSAGE, new InputLocation(18, 19, source))));
  }
View Full Code Here

Examples of org.apache.maven.model.InputLocation

  }
 
  @Test
  public void shouldFindSuppressionAfterBlankLine() {
    Assert.assertEquals("<!-- NOLINT:IDENTIFIER shouldFindSuppressionAfterBlankLine -->",
        violationSuppressor.findSuppressionComment(new Violation(DUMMY_MAVEN_PROJECT, RULE, DUMMY_MESSAGE, new InputLocation(20, 16, source))));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.