code: protected RuleSet readRules(MavenProject rootModule) throws MojoExecutionException {
          List<RuleSource> sources = new ArrayList<>();
          PluginRepository pluginRepository = pluginRepositoryProvider.getPluginRepository();
          if (rulesUrl != null) {
              getLog().debug("Retrieving rules from URL " + rulesUrl.toString());
              sources.add(new UrlRuleSource(rulesUrl));
          } else {
              // read rules from rules directory
              addRuleFiles(sources, ProjectResolver.getRulesDirectory(rootModule, rulesDirectory));
              if (rulesDirectories != null) {
                  for (String directory : rulesDirectories) {
                      addRuleFiles(sources, ProjectResolver.getRulesDirectory(rootModule, directory));
                  }
              }
              List<RuleSource> ruleSources = pluginRepository.getRulePluginRepository().getRuleSources();
              sources.addAll(ruleSources);
          }
          Collection<RuleParserPlugin> ruleParserPlugins;
          try {
              ruleParserPlugins = pluginRepository.getRuleParserPluginRepository().getRuleParserPlugins(getRuleConfiguration());
          } catch (RuleException e) {
              throw new MojoExecutionException("Cannot get rules rule source reader plugins.", e);        }
          try {
              RuleParser ruleParser = new RuleParser(ruleParserPlugins);
              return ruleParser.parse(sources);
          } catch (RuleException e) {
              throw new MojoExecutionException("Cannot read rules.", e);
          }
      }
docs: Reads the available rules from the rules directory and deployed catalogs.
  
  @return A rule set. .
  @throws MojoExecutionException If the rules cannot be read.