| 34 | import picocli.CommandLine.Parameters; |
| 35 | |
| 36 | @Command(name = "PolicyPanda 🐼", mixinStandardHelpOptions = true, version = "PolicyPanda 0.2", description = """ |
| 37 | The Policy Panda tries to spot if org/repos follows the requirement |
| 38 | and best practices outlined in https://github.com/commonhaus/foundation/tree/main/policies |
| 39 | """) |
| 40 | public class PolicyPanda extends CommonhausPanda implements Runnable { |
| 41 | static final java.util.logging.Logger log = CommonhausPanda.log; |
| 42 | |
| 43 | enum AgreementType { |
| 44 | DCO, CLA |
| 45 | } |
| 46 | |
| 47 | enum Kind { |
| 48 | SHOULD, MUST, BONUS |
| 49 | } |
| 50 | |
| 51 | @Parameters(index = "0", description = "The organization to check") |
| 52 | private String organization; |
| 53 | |
| 54 | @Option(names = { "-r", |
| 55 | "--repo-regex" }, description = "Specify a regular expression to match repository names", defaultValue = ".*") |
| 56 | private String repoRegex; |
| 57 | |
| 58 | @CommandLine.Option(names = { "-w", |
| 59 | "--working-branch-patterns" }, description = "Specify a regular expression to match working branch names", defaultValue = "main") |
| 60 | private String workingBranchRegex; |
| 61 | |
| 62 | @Option(names = { "-t", |
| 63 | "--type" }, description = "Specify if the project uses DCO or CLA. Valid values: DCO, CLA", defaultValue = "DCO") |
| 64 | private AgreementType agreementType; |
| 65 | |
| 66 | @Option(names = { "-o", |
| 67 | "--output-dir" }, description = "Output directory for all reports", defaultValue = "reports") |
| 68 | private String outputDir; |
| 69 | |
| 70 | @Option(names = { "-p", "--project-id" }, description = "Project ID to use in the YAML") |
| 71 | private String projectId; |
| 72 | |
| 73 | @Option(names = {"-i", |
| 74 | "--include-archived"}, description = "Include repositories in the organization that have been archived", defaultValue = "false") |
| 75 | private boolean includeArchived; |
| 76 | |
| 77 | @Option(names = { "-s", |
| 78 | "--skip-policy-check" }, description = "Skip policy compliance check", defaultValue = "false") |
| 79 | private boolean skipPolicyCheck; |
| 80 | |
| 81 | @Option(names = { "-a", |
| 82 | "--init-asset-discovery" }, description = "Generate asset discovery document (optional/opt-in)", defaultValue = "false") |
| 83 | private boolean runAssetDiscovery; |
| 84 | |
| 85 | @Option(names = { "-g", |
| 86 | "--init-org-settings" }, description = "Generate organization settings report (optional/opt-in)", defaultValue = "false") |
| 87 | private boolean runOrgSettings; |
| 88 | |
| 89 | private final List<Information> checks = new ArrayList<>(); |
| 90 | private GHRepository orgDotGithubRepo; |
| 91 | |
| 92 | public static void main(String[] args) { |
| 93 | int exitCode = new CommandLine(new PolicyPanda()).execute(args); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…