Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config option hinders verbose flag output when used together #403

Open
nadimchakra opened this issue Jan 31, 2025 · 0 comments
Open

Config option hinders verbose flag output when used together #403

nadimchakra opened this issue Jan 31, 2025 · 0 comments

Comments

@nadimchakra
Copy link

nadimchakra commented Jan 31, 2025

How to replicate

Add a config.json
Add a README.md

Run markdown-link-check -v README.md (You will see files checked list)

Run markdown-link-check -c config.json -v README.json ( You will only see FILE: README.md )

if (opts.config) {
        let config = await loadConfig(opts.config);

        const originalOpts = {...opts};
        console.log("originalOpts", originalOpts);

        opts.ignorePatterns = config.ignorePatterns;
        opts.replacementPatterns = config.replacementPatterns;
        opts.httpHeaders = config.httpHeaders;
        opts.timeout = config.timeout;
        opts.ignoreDisable = config.ignoreDisable;
        opts.retryOn429 = config.retryOn429;
        opts.retryCount = config.retryCount;
        opts.fallbackRetryDelay = config.fallbackRetryDelay;
        opts.aliveStatusCodes = config.aliveStatusCodes;
        opts.reporters = config.reporters;
    }

    console.log("opts", opts);

the following log ->

FILE: README.md

originalOpts {
  baseUrl: 'file:///workspace',
  showProgressBar: false,
  quiet: false,
  verbose: true,
  retryOn429: false,
  aliveStatusCodes: undefined,
  reporters: [ [AsyncFunction: defaultReporter] ],
  config: 'config.json',
  projectBaseUrl: 'file:///workspace'
}
opts {
  baseUrl: 'file:///workspace',
  showProgressBar: false,
  quiet: false,
  verbose: true,
  retryOn429: true,
  aliveStatusCodes: [ 200, 206 ],
  reporters: undefined,
  config: 'config.json',
  projectBaseUrl: 'file:///workspace',
  ignorePatterns: [ { pattern: '^http://example.net' } ],
  replacementPatterns: [
    {
      pattern: '^.attachments',
      replacement: 'file://some/conventional/folder/.attachments'
    },
    { pattern: '^/', replacement: '{{BASEURL}}/' },
    { pattern: '%20', replacement: '-', global: true },
    {
      pattern: 'images/(?<filename>.*)',
      replacement: 'assets/$<filename>'
    }
  ],
  httpHeaders: [ { urls: [Array], headers: [Object] } ],
  timeout: '20s',
  ignoreDisable: undefined,
  retryCount: 5,
  fallbackRetryDelay: '30s'
}

opts.reporters = config.reporters is setting reporters to undefined which is causing an issue.
This is most probably a bug since we cant set reporters in config.json lol

nadimchakra added a commit to nadimchakra/markdown-link-check that referenced this issue Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant