code: public List<AbstractPatternRule> loadPatternRules(String filename) throws IOException {
      PatternRuleLoader ruleLoader = new PatternRuleLoader();
      try (InputStream is = this.getClass().getResourceAsStream(filename)) {
        if (is == null) {
          // happens for external rules plugged in as an XML file or testing files:
          if (filename.contains("-test-")) {
            // ignore, for testing
            return Collections.emptyList();
          } else {
            return ruleLoader.getRules(new File(filename));
          }
        } else {
          return ruleLoader.getRules(is, filename);
        }
      }
    }
docs: Load pattern rules from an XML file. Use {@link #addRule(Rule)} to add these
  rules to the checking process.
  @param filename path to an XML file in the classpath or in the filesystem - the classpath is checked first
  @return a List of {@link PatternRule} objects