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

How to make alive status codes 200/203 (markdown link check) expected behavior for MegaLinter? #1368

Closed
BenjaminEngeset opened this issue Mar 30, 2022 · 5 comments · Fixed by #1369
Labels
question Further information is requested

Comments

@BenjaminEngeset
Copy link
Contributor

Hello project maintainers and contributors,

Using this awesome toolbox in ADO.

Previously when using markdown link check standalone without MegaLinter you could do something like this in a config.json file:

{ "aliveStatusCodes": [ 200, 203 ] }

Then in the YML:

    # - script: |
    #     docker pull github/markdown-link-check:stable
    #     docker run -e RUN_LOCAL=true -e config-file='.azuredevops/actions-config/config.json' -v $(System.DefaultWorkingDirectory):/tmp/lint github/markdown-link-check
    # displayName: 'Check for broken URLs'

How to enforce the same behavior when using MegaLinter?

Currently YML is like this example:

jobs:
  - job: verify_markdown
    timeoutInMinutes: 10
    pool:
      vmImage: ubuntu-latest
    steps:
      - task: DockerInstaller@0
        displayName: Docker Installer
        inputs:
          releaseType: stable

      - script: |
          docker pull megalinter/megalinter:v5
          docker run -v $(System.DefaultWorkingDirectory):/tmp/lint -e GIT_AUTHORIZATION_BEARER=$(System.AccessToken) megalinter/megalinter:v5
   displayName: 'Code Scan using GitHub MegaLinter'

     # Publish the Anchore report as an artifact to Azure Pipelines
      - task: PublishBuildArtifacts@1
        displayName: 'Publish Artifact: MegaLinter Report'
        condition: succeededOrFailed()
        inputs:
          PathtoPublish: '$(System.DefaultWorkingDirectory)/report/'
          ArtifactName: MegaLinterReport  

.mega-linter.yml in the root of repository is like this:

# Configuration file for MegaLinter
# See all available variables at https://megalinter.github.io/configuration/ and in linters documentation

APPLY_FIXES: all # all, none, or list of linter keys
# ENABLE: # If you use ENABLE variable, all other languages/formats/tooling-formats will be disabled by default
# ENABLE_LINTERS: # If you use ENABLE_LINTERS variable, all other linters will be disabled by default
# DISABLE:
  # - COPYPASTE # Uncomment to disable checks of excessive copy-pastes
  # - SPELL # Uncomment to disable checks of spelling mistakes
SHOW_ELAPSED_TIME: true
FILEIO_REPORTER: false
# DISABLE_ERRORS: true # Uncomment if you want MegaLinter to detect errors but not block CI to pass

I see that it is possible to disable it in configuration file for MegaLint like.

DISABLE_LINTERS: MARKDOWN_MARKDOWN_LINK_CHECK

Then its off completely and that is not optimal.

I have tried to search documentation for this, but can't find it. Help me out and I would be really grateful =)

/Benjamin

@BenjaminEngeset BenjaminEngeset added the question Further information is requested label Mar 30, 2022
@BenjaminEngeset BenjaminEngeset changed the title How to make 200 and 203 (markdown link check) expected behavior for MegaLinter? How to make alive status codes 200/203 (markdown link check) expected behavior for MegaLinter? Mar 30, 2022
@nvuillam
Copy link
Member

@bengeset96 if you define a .markdown-link-check.json config file, MegaLinter will find it and use it, so you'll have the same behavior than with standalone markdown-links-check :)

If not defined, a default markdown-links-check config file is used ( see doc -> https://megalinter.github.io/beta/descriptors/markdown_markdown_link_check/ )

203 seems to be a correct return code, so i'll update it to add 203 :)

@BenjaminEngeset
Copy link
Contributor Author

@nvuillam

Awesome, thank you so much! Great 🥇

@nvuillam
Copy link
Member

@bengeset96 you're welcome :)
Please can you confirm that it's ok without defining local .markdown-link-check with megalinter/megalinter:beta ?

@BenjaminEngeset
Copy link
Contributor Author

BenjaminEngeset commented Mar 31, 2022

@nvuillam

I can confirm it is now okay after changing docker image from megalinter:v5 to megalinter:beta.

I have checked each console output from the markdown-link-check manually, and it is not giving me neither 200 or 203 anymore as before.

Evidence from summary as well:

V5:
image

Beta (200 and 203 fixed):
image

@nvuillam
Copy link
Member

Great, thanks for your feedback:)
Official release in v5 should happen this weekend:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants