<commit_before>name: Lint

on:
  push:
    branches:
    - main
  pull_request:

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
    - uses: pre-commit/action@v2.0.0

  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Python
        uses: actions/setup-python@v1
        with:
          python-version: 3.8.x
          architecture: x64
      - name: Fetch ParlAI
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
      - name: Fix git
        run: |
          set -eux
          git fetch origin main
          if [[ "${{ github.event_name }}" == "pull_request" ]]; then
            git branch -f main origin/main
          fi
      - name: Run flake8
        run: |
          set -eux
          pip install -q flake8 flake8-bugbear flake8-black docformatter==1.3.0 black==19.3b0
          python setup.py develop --no-deps  # get our custom flake8 errors
          python -c 'import parlai'
          flake8 --version
          bash autoformat.sh -c -f | tee ${GITHUB_WORKSPACE}/output-annotations.txt
      - name: Add annotations
        uses: pytorch/add-annotations-github-action@master
        with:
          check_name: 'lint'
          linter_output_path: 'output-annotations.txt'
          commit_sha: ${{ github.event.pull_request.head.sha }}
          regex: '^(?<filename>.*?):(?<lineNumber>\d+):(?<columnNumber>\d+): (?<errorCode>\w+\d+) (?<errorDesc>.*)'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  mypy:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Python
        uses: actions/setup-python@v1
        with:
          python-version: 3.8.x
          architecture: x64
      - name: Fetch ParlAI
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
      - name: Fix git
        run: |
          set -eux<commit_msg>[lint] Fix failure to provide red checks for lint (#4608)<commit_after>name: Lint

on:
  push:
    branches:
    - main
  pull_request:

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
    - uses: pre-commit/action@v2.0.0

  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Python
        uses: actions/setup-python@v1
        with:
          python-version: 3.8.x
          architecture: x64
      - name: Fetch ParlAI
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
      - name: Fix git
        run: |
          set -eux
          git fetch origin main
          if [[ "${{ github.event_name }}" == "pull_request" ]]; then
            git branch -f main origin/main
          fi
      - name: Run flake8
        run: |
          set -eux
          pip install -q flake8 flake8-bugbear flake8-black docformatter==1.3.0 black==22.3.0
          python setup.py develop --no-deps  # get our custom flake8 errors
          python -c 'import parlai'
          flake8 --version
          bash autoformat.sh -c -f | tee ${GITHUB_WORKSPACE}/output-annotations.txt
      - name: Add annotations
        uses: pytorch/add-annotations-github-action@master
        with:
          check_name: 'lint'
          linter_output_path: 'output-annotations.txt'
          commit_sha: ${{ github.event.pull_request.head.sha }}
          regex: '^(?<filename>.*?):(?<lineNumber>\d+):(?<columnNumber>\d+): (?<errorCode>\w+\d+) (?<errorDesc>.*)'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Failure check
        run: |
          if [ "$(cat ${GITHUB_WORKSPACE}/output-annotations.txt | wc -l)" != "0" ]
          then
            exit 1
          fi

  mypy:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Python
        uses: actions/setup-python@v1
        with:
          python-version: 3.8.x
          architecture: x64
      - name: Fetch ParlAI
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
      - name: Fix git
        run: |
          set -eux
{'fraction_non_alphanumeric': 0.12241541353383459, 'fraction_numerical': 0.01644736842105263, 'mean_word_length': 1.7218670076726343, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4119676', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1378, 'n_words': 314}