todogroup / repolinter

Repolinter, The Open Source Repository Linter
https://todogroup.github.io/repolinter/
Apache License 2.0
421 stars 72 forks source link

chore: update cli yargs config to highlight "ruleset*" options are mutually exclusive. #308

Closed zhaoyuheng200 closed 3 months ago

zhaoyuheng200 commented 11 months ago

This should help clean up the lint function in index.js to not trying to figure out is it a path/url/encoded question.

Motivation

The current design of the lint function in index.js spends much effort trying to figure out how to ingest ruleset config correctly. Adding conflicts in yargs creates a 3-way option exclusion, so we can have better control over CLI option intake.

I have some plan to update the lint function to call a new lintEngine function, so the existing exposed lint function will remain the same, but we'll use a new lintEngine function to separate rulesetPath, rulesetUrl and rulesetEncoded. It would also help separate --allowPaths and future --ignorePaths option, since I don't see an easy way to add the proposed --ignorePaths easily in current setup.

Proposed Changes

Add the conflicts to create a 3-way exclusion.

Test Plan

This should be expected behavior of how customer use the repolinter cli tool, and I'm not testing yargs here. So I didn't add any additional testing. Passed all existing tests.

hyandell commented 4 months ago

LGTM