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

Version 3.13.5 seems to break when using config file #369

Open
isuftin opened this issue Nov 5, 2024 · 7 comments · May be fixed by #372
Open

Version 3.13.5 seems to break when using config file #369

isuftin opened this issue Nov 5, 2024 · 7 comments · May be fixed by #372

Comments

@isuftin
Copy link

isuftin commented Nov 5, 2024

With version 3.13.5, I am unable to get the utility to properly check links.

markdown-link-check-config.json:

{
  "ignorePatterns": [
    {
      "pattern": "^https://my-repo.com/docker/markdown-link-check/compare/(.*)"
    },
    {
      "pattern": "^https://my-repo.com/docker/markdown-link-check/commit/(.*)"
    }
  ]
}

README2.md:

# Markdown Link Check

[[_TOC_]]

## Purpose

I'm a simple [document][mlc_usage]

[mlc_usage]: https://github.com/tcort/markdown-link-check#usage

Example run:

/data $ markdown-link-check --config markdown-link-check-config.json  --verbose  README2.md

FILE: README2.md
/data $ echo $?
1
/data $ markdown-link-check  --verbose  README2.md

FILE: README2.md
  [✓] https://github.com/tcort/markdown-link-check#usage → Status: 200

  1 links checked.
/data $ echo $?
0
/data $

This seems to be a regression from 3.12.x

@isuftin
Copy link
Author

isuftin commented Nov 5, 2024

Note that this is running in an Alpine Docker container.

/data $ markdown-link-check --version
3.13.5
/data $ cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.19.4
PRETTY_NAME="Alpine Linux v3.19"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
/data $ npm --version
10.9.0
/data $ node --version
v20.18.0

TylerHelmuth added a commit to open-telemetry/opentelemetry-collector-contrib that referenced this issue Nov 6, 2024
#### Description
the changelog workflow has started failing, likely due to regressions in
the tool's latest release. Pinning until fixed

#### Link to tracking issue
probably related to
- tcort/markdown-link-check#369
- tcort/markdown-link-check#370
@erikbosch
Copy link

erikbosch commented Nov 6, 2024

I have observed the same issue for https://github.com/eclipse-kuksa/kuksa-databroker project

With config, "silent" failure for 3.13.5, "success" for 3.12.2

erik@debian6:~/kuksa-databroker$ !2865
sudo npm install -g markdown-link-check

added 8 packages, removed 1 package, and changed 69 packages in 5s

18 packages are looking for funding
  run `npm fund` for details
erik@debian6:~/kuksa-databroker$ markdown-link-check --version
3.13.5
erik@debian6:~/kuksa-databroker$ markdown-link-check -c ~/kuksa-actions/check-markdown/config.json -a 403,200 README.md

FILE: README.md
erik@debian6:~/kuksa-databroker$ echo $?
1
erik@debian6:~/kuksa-databroker$ sudo npm install -g [email protected]

added 1 package, removed 8 packages, and changed 69 packages in 3s

18 packages are looking for funding
  run `npm fund` for details
erik@debian6:~/kuksa-databroker$ markdown-link-check --version
3.12.2
erik@debian6:~/kuksa-databroker$ markdown-link-check -c ~/kuksa-actions/check-markdown/config.json -a 403,200 README.md

FILE: README.md
  [✓] https://github.com/eclipse-kuksa/kuksa-databroker
 ...

  27 links checked.
erik@debian6:~/kuksa-databroker$ echo $?
0
erik@debian6:~/kuksa-databroker$ 

Without config fail, success


erik@debian6:~/kuksa-databroker$ sudo npm install -g markdown-link-check

added 8 packages, removed 1 package, and changed 69 packages in 8s

18 packages are looking for funding
  run `npm fund` for details
erik@debian6:~/kuksa-databroker$ markdown-link-check --version
3.13.5
erik@debian6:~/kuksa-databroker$ markdown-link-check  -a 403,200 README.md

FILE: README.md
  [✓] https://github.com/eclipse-kuksa/kuksa-databroker
...

  27 links checked.
erik@debian6:~/kuksa-databroker$ echo $?
0
erik@debian6:~/kuksa-databroker$ 

Config file for reference

{
    "ignorePatterns": [
      {
        "pattern": "^#"
      },
      {
        "pattern": "%"
      }
    ]
}

@MikeMcC399
Copy link

MikeMcC399 commented Nov 6, 2024

With [email protected] and a package.json script

  check:markdown
    find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check -c md-linkcheck.json

I just get shown the filenames, with no checking

FILE: CHANGELOG.md

FILE: CODE_OF_CONDUCT.md

FILE: CONTRIBUTING.md

FILE: LICENSE.md

FILE: README.md

FILE: docs/MAINTENANCE.md

If I remove the config file -c md-linkcheck.json it all works fine and each hyperlink is listed in the logs.

The config file is the following and it seems these exceptions aren't needed anymore:

{
    "httpHeaders": [
        {
            "urls": [
                "https://github.com/",
                "https://guides.github.com/",
                "https://docs.github.com/",
                "https://help.github.com/",
                "https://support.github.com"
            ],
            "headers": {
                "Accept-Encoding": "zstd, br, gzip, deflate"
            }
        }
    ]
}

@emdneto
Copy link

emdneto commented Nov 6, 2024

michael-burt pushed a commit to michael-burt/opentelemetry-collector-contrib that referenced this issue Nov 7, 2024
#### Description
the changelog workflow has started failing, likely due to regressions in
the tool's latest release. Pinning until fixed

#### Link to tracking issue
probably related to
- tcort/markdown-link-check#369
- tcort/markdown-link-check#370
@smainil
Copy link

smainil commented Nov 7, 2024

to me the issue is here

opts.reporters = config.reporters;

if no reporters parameter is set at command line, it's the default reporter that will be used

input.opts.reporters = program.opts().reporters ?? [ reporters.default ];
but next if we define a config file the reporters are retrieved from the config file and if none is defined, the default reporter set at the beginning is replaced by undefined

@nvuillam
Copy link
Contributor

nvuillam commented Nov 9, 2024

I have the same problem with MegaLinter :(

[markdown-link-check] command: ['markdown-link-check', '--quiet', '-c', '/action/lib/.automation/.markdown-link-check.json', 'markdown_good_1.md', 'markdown_good_2.md']
[markdown-link-check] CWD: /tmp/lint/.automation/test/markdown
[markdown-link-check] result: 1 

https://github.com/oxsecurity/megalinter/actions/runs/11750534244/job/32738969615?pr=4228

nvuillam added a commit to oxsecurity/megalinter that referenced this issue Nov 9, 2024
codeboten added a commit to codeboten/opentelemetry-collector that referenced this issue Nov 20, 2024
This is pinned because of tcort/markdown-link-check#369

Signed-off-by: Alex Boten <[email protected]>
mx-psi pushed a commit to open-telemetry/opentelemetry-collector that referenced this issue Nov 21, 2024
@LegendSebastianoL
Copy link

same here, working perfectly on Mac OS X, but on CI/CD using Node20 in Ubuntu latest in a GH Workflow is failing

davezuch pushed a commit to davezuch/markdown-link-check that referenced this issue Dec 10, 2024
This addresses [Issue#369], where using a config file that doesn't
specify a reporter breaks. We update the code so that when there's a
config without a reporter, we fallback to the default one.

[issue#369]: tcort#369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants