Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed May 26, 2023
1 parent 863523d commit cf9d386
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 35 deletions.
24 changes: 16 additions & 8 deletions .automation/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2280,14 +2280,22 @@ def move_to_file(file_path, start, end, target_file, keep_in_source=False):
with open(file_path, "w", encoding="utf-8") as file:
file.write(file_content)
logging.info("Updated " + file.name + " between " + start + " and " + end)
bracket_content = (
bracket_content.replace("####", "#THREE#")
.replace("###", "#TWO#")
.replace("##", "#ONE#")
.replace("#THREE#", "###")
.replace("#TWO#", "##")
.replace("#ONE#", "#")
)
if "<!-- install-" in start or "<!-- config-" in start:
bracket_content = (
bracket_content.replace("####", "#TWO#")
.replace("###", "#ONE#")
.replace("#TWO#", "##")
.replace("#ONE#", "#")
)
else:
bracket_content = (
bracket_content.replace("####", "#THREE#")
.replace("###", "#TWO#")
.replace("##", "#ONE#")
.replace("#THREE#", "###")
.replace("#TWO#", "##")
.replace("#ONE#", "#")
)

if not os.path.isfile(target_file):
mdl_disable = "<!-- markdownlint-disable MD013 -->"
Expand Down
6 changes: 3 additions & 3 deletions docs/config-apply-fixes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Use MegaLinter to auto apply corrections on your repository files
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-apply-fixes-section-start -->

## Apply fixes
# Apply fixes

Mega-linter is able to apply fixes provided by linters. To use this capability, you need 3 **env variables** defined at top level

Expand All @@ -17,7 +17,7 @@ Only for GitHub Action Workflow file if you use it:
- **APPLY_FIXES_EVENT**: `all`, `push`, `pull_request`, `none` _(use none in case of use of [Updated sources reporter](reporters/UpdatedSourcesReporter.md))_
- **APPLY_FIXES_MODE**: `commit` to create a new commit and push it on the same branch, or `pull_request` to create a new PR targeting the branch.

### Apply fixes issues
## Apply fixes issues

You may see **github permission errors**, or workflows not run on the new commit.

Expand All @@ -32,7 +32,7 @@ To solve these issues, you can apply one of the following solutions.
- [Create Classic Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token#creating-a-token), then copy the PAT value
- [Define secret variable](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) named **PAT** on your repository, and paste the PAT value

### Notes
## Notes

- You can use [**Updated sources reporter**](reporters/UpdatedSourcesReporter.md) if you don't want fixes to be automatically applied on git branch, but **download them in a zipped file** and manually **extract them in your project**
- If used, **APPLY_FIXES_EVENT** and **APPLY_FIXES_MODE** can not be defined in `.mega-linter.yml`config file, they must be set as environment variables
Expand Down
2 changes: 1 addition & 1 deletion docs/config-cli-lint-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Cli lint mode can be list_of_files, project or files
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-cli-lint-mode-section-start -->

## CLI lint mode
# CLI lint mode

Each linter has a lint mode by default, visible in its MegaLinter documentation ([example](https://megalinter.io/latest/descriptors/repository_trivy/#how-the-linting-is-performed)):

Expand Down
2 changes: 1 addition & 1 deletion docs/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Use config file with auto-completion to customize MegaLinter behavi
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-file-section-start -->

## .mega-linter.yml file
# .mega-linter.yml file

MegaLinter configuration variables are defined in a **.mega-linter.yml** file at the root of the repository or with **environment variables**.
You can see an example config file in this repo: [**.mega-linter.yml**](https://github.com/oxsecurity/megalinter/blob/main/.mega-linter.yml)
Expand Down
2 changes: 1 addition & 1 deletion docs/config-filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Exclude files from linting
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-filtering-section-start -->

## Filter linted files
# Filter linted files

If you need to lint only a folder or exclude some files from linting, you can use optional environment parameters `FILTER_REGEX_INCLUDE` and `FILTER_REGEX_EXCLUDE`
You can apply filters to a single linter by defining variable `<LINTER_KEY>_FILTER_REGEX_INCLUDE` and `<LINTER_KEY>_FILTER_REGEX_EXCLUDE`
Expand Down
2 changes: 1 addition & 1 deletion docs/config-linters.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Every linters has its own variables that can be customized
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-linters-section-start -->

## Linter specific variables
# Linter specific variables

See variables related to a single linter behavior in [linters documentations](supported-linters.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/config-postcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Customize your MegaLinter run by running commands after linters are
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-postcommands-section-start -->

## Post-commands
# Post-commands

MegaLinter can run custom commands after running linters (for example, running additional tests)

Expand Down
2 changes: 1 addition & 1 deletion docs/config-precommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Customize your MegaLinter run by installing linters extensions with
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-precommands-section-start -->

## Pre-commands
# Pre-commands

MegaLinter can run custom commands before running linters (for example, installing an plugin required by one of the linters you use)

Expand Down
2 changes: 1 addition & 1 deletion docs/config-variables-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Hide from linter executables the environment variables that can con
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-variables-security-section-start -->

## Environment variables security
# Environment variables security

MegaLinter runs on a docker image and calls the linters via command line to gather their results.

Expand Down
2 changes: 1 addition & 1 deletion docs/config-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: List of common variables that you can use to customize MegaLinter b
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- config-variables-section-start -->

## Common variables
# Common variables

| **ENV VAR** | **Default Value** | **Notes** |
|----------------------------------------------------------------------|-----------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down
2 changes: 1 addition & 1 deletion docs/install-assisted.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Setup MegaLinter in 5 minutes thanks to its assisted installation t
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-assisted-section-start -->

## Assisted installation
# Assisted installation

Just run `npx mega-linter-runner --install` at the root of your repository and answer questions, it will generate ready to use configuration files for MegaLinter :)

Expand Down
2 changes: 1 addition & 1 deletion docs/install-azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to setup MegaLinter as an Azure Pipelines job
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-azure-section-start -->

## Azure Pipelines
# Azure Pipelines

Use the following Azure Pipelines [YAML template](https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema)

Expand Down
2 changes: 1 addition & 1 deletion docs/install-bitbucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to setup MegaLinter as a Bitbucket Pipelines jo
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-bitbucket-section-start -->

## Bitbucket Pipelines
# Bitbucket Pipelines

1. Create a `bitbucket-pipelines.yml` file on the root directory of your repository

Expand Down
10 changes: 5 additions & 5 deletions docs/install-concourse.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description: Manual instructions to setup MegaLinter as a Concourse job
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-concourse-section-start -->

## Concourse
# Concourse

### Pipeline step
## Pipeline step

Use the following `job.step` in your pipeline template

Expand Down Expand Up @@ -38,7 +38,7 @@ Note: make sure you have `job.plan.get` step which gets `repo` containing your r
cd repo
export DEFAULT_WORKSPACE=$(pwd)
bash -ex /entrypoint.sh
# doing this because concourse doesn't work as other CI systems
## doing this because concourse doesn't work as other CI systems
# params:
# PARALLEL: true
# DISABLE: SPELL
Expand All @@ -49,7 +49,7 @@ Note: make sure you have `job.plan.get` step which gets `repo` containing your r

OR

### Use it as reusable task
## Use it as reusable task

Create reusable concourse task which can be used with multiple pipelines

Expand All @@ -67,7 +67,7 @@ image_resource:
inputs:
- name: repo

# uncomment this if you want reports as task output
## uncomment this if you want reports as task output
# output:
# - name: reports
# path: repo/megalinter-reports
Expand Down
2 changes: 1 addition & 1 deletion docs/install-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to run MegaLinter as a docker image
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-docker-section-start -->

## Docker container
# Docker container

You can also run megalinter with its Docker container, just execute this command:

Expand Down
4 changes: 2 additions & 2 deletions docs/install-drone.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to setup MegaLinter as a Drone CI job
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-drone-section-start -->

## Drone CI
# Drone CI

**Warning: Drone CI support is experimental and is undergoing heavy modifications (see issue [#2047](https://github.com/oxsecurity/megalinter/issues/2047)).**

Expand All @@ -32,7 +32,7 @@ steps:
This uses the [Drone CI docker runner](https://docs.drone.io/pipeline/docker/overview/), so it's needed to install and configure it beforehand on your Drone CI server.
### (Optional) Adjusting trigger rules
## (Optional) Adjusting trigger rules
The Drone CI workflow should trigger automatically for every scenario (push, pull request, sync…) however, you can _optionally_ change this behavior by changing the trigger. For example:
Expand Down
2 changes: 1 addition & 1 deletion docs/install-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to setup MegaLinter in a GitHub Action Workflow
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-github-section-start -->

## GitHub Action
# GitHub Action

1. Create a new file in your repository called `.github/workflows/mega-linter.yml`
2. Copy the [example workflow from below](https://raw.githubusercontent.com/oxsecurity/megalinter/main/TEMPLATES/mega-linter.yml) into that new file, no extra configuration required
Expand Down
2 changes: 1 addition & 1 deletion docs/install-gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to setup MegaLinter as a Gitlab Pipeline job
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-gitlab-section-start -->

## GitLab CI
# GitLab CI

Create or update `.gitlab-ci.yml` file at the root of your repository

Expand Down
2 changes: 1 addition & 1 deletion docs/install-jenkins.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to setup MegaLinter as a Jenkins job
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-jenkins-section-start -->

## Jenkins
# Jenkins

Add the following stage in your Jenkinsfile

Expand Down
2 changes: 1 addition & 1 deletion docs/install-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Manual instructions to run MegaLinter locally on your computer
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-locally-section-start -->

## Run MegaLinter locally
# Run MegaLinter locally

[![Version](https://img.shields.io/npm/v/mega-linter-runner.svg)](https://npmjs.org/package/mega-linter-runner)
[![Downloads/week](https://img.shields.io/npm/dw/mega-linter-runner.svg)](https://npmjs.org/package/mega-linter-runner)
Expand Down
2 changes: 1 addition & 1 deletion docs/install-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: You can use latest release or beta version of MegaLinter, know the
<!-- @generated by .automation/build.py, please don't update manually -->
<!-- install-version-section-start -->

## Which version to use ?
# Which version to use ?

The following instructions examples are using latest MegaLinter stable version (**v6** , always corresponding to the [latest release](https://github.com/oxsecurity/megalinter/releases))

Expand Down

0 comments on commit cf9d386

Please sign in to comment.