Skip to content

Commit

Permalink
feature(cli): adds --no-config option (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij authored Feb 17, 2023
1 parent b2fd66e commit 1d0a709
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/use-without-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: No configuration file use case
about: Use this to tell about your use case for running dependency-cruiser without a configuration ile
title: "I use dependency-cruiser without a configuration file. This is why."
---

### Summary

Hi! I do use the dependency-cruiser cli without a configuration file. This is why:

<!-- a short description on how you use it -->
5 changes: 5 additions & 0 deletions bin/dependency-cruise.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ try {
"-c, --config [file]",
"read rules and options from [file] (e.g. .dependency-cruiser.js)"
)
.option(
"--no-config",
"do not use a configuration file. " +
"Overrides any --config option set earlier"
)
.option(
"-T, --output-type <type>",
"output type; e.g. err, err-html, dot, ddot, archi, flat, baseline or json\n(default: err)"
Expand Down
11 changes: 11 additions & 0 deletions doc/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ available in dependency-cruiser configurations.
1. [arguments - files and/ or directories](#arguments---files-and-or-directories)
1. [`--output-type`: specify the output format](#--output-type-specify-the-output-format)
1. [`--config`/ `--validate`: use a configuration with rules and/or options](#--config---validate)
1. [`--no-config`: do not use a configuration file](#--no-config)
1. [`--init`](#--init)
1. [`--metrics`: calculate stability metrics](#--metrics)
1. [`--info`: show what alt-js are supported](#--info-showing-what-alt-js-are-supported)
Expand Down Expand Up @@ -678,6 +679,16 @@ For more information about writing rules see the [tutorial](rules-tutorial.md) a

For an easy set up of both use [--init](#--init)

### `--no-config`

Use this if you don't want to use a configuration file. Overrides any earlier
specified --config (or --validate) option.
> If you actually use this, I'm interested in your use case. Please drop an
> [issue on GitHub](https://github.com/sverweij/dependency-cruiser/issues/new?assignees=&labels=&template=use-without-config.md&title=I+use+dependency-cruiser+without+a+configuration+file.+This+is+why:) or contact me on mastodon
> ([@mcmeadow@mstdn.social](https://mstdn.social/@mcmeadow)) or twitter
> ([@mcmeadow](https://twitter.com/mcmeadow)).

### `--init`

This asks some questions and - depending on the answers - creates a dependency-cruiser
Expand Down
2 changes: 1 addition & 1 deletion src/cli/normalize-cli-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function normalizeKnownViolationsOption(pCliOptions) {
}

function normalizeValidationOption(pCliOptions) {
if (!has(pCliOptions, "validate")) {
if (!pCliOptions.validate) {
return {
validate: false,
};
Expand Down

0 comments on commit 1d0a709

Please sign in to comment.