<commit_before>#!/usr/bin/env bash
set -e
set -o pipefail
set -u
set -x

shopt -s failglob
shopt -s dotglob

BUILD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$BUILD_DIR/ci/common/common.sh"
source "$BUILD_DIR/ci/common/dependencies.sh"
source "$BUILD_DIR/ci/common/deps-repo.sh"
source "$BUILD_DIR/ci/common/doc.sh"
source "$BUILD_DIR/ci/common/neovim.sh"
source "$BUILD_DIR/ci/common/html.sh"
source "$BUILD_DIR/ci/common/badge.sh"

DOC_SUBTREE="/reports/pvs"
REPORTS_DIR="$DOC_DIR/$DOC_SUBTREE"

download_pvs_badge() {
  download_badge \
    "$(cat "$REPORTS_DIR/PVS-studio.err" | grep '^./' | wc -l)" \
    "PVS_analysis" \
    "$DOC_SUBTREE"
}

generate_pvs_report() {
  rm -rf "$REPORTS_DIR"
  mkdir -p "$REPORTS_DIR"

  local index_file="$REPORTS_DIR/index.html"

  (
    cd "$NEOVIM_DIR"

    sh ./scripts/pvscheck.sh --pvs detect

    cd ../neovim-pvs

    # Note: will also copy a binary log with *all* errors, including filtered
    # out. This is intentional.
    cp PVS-studio* "$REPORTS_DIR"
  )
  (
    cd "$REPORTS_DIR"

    local body="<pre>$(cat PVS-studio.err | html_escape)</pre>"

    generate_report "$title" "$body" "$index_file"
  )
}

clone_doc
clone_neovim
generate_pvs_report
download_pvs_badge
commit_doc<commit_msg>Use --pvs-install with --deps --recheck to run in $NEOVIM_DIR<commit_after>#!/usr/bin/env bash
set -e
set -o pipefail
set -u
set -x

shopt -s failglob
shopt -s dotglob

BUILD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$BUILD_DIR/ci/common/common.sh"
source "$BUILD_DIR/ci/common/dependencies.sh"
source "$BUILD_DIR/ci/common/deps-repo.sh"
source "$BUILD_DIR/ci/common/doc.sh"
source "$BUILD_DIR/ci/common/neovim.sh"
source "$BUILD_DIR/ci/common/html.sh"
source "$BUILD_DIR/ci/common/badge.sh"

DOC_SUBTREE="/reports/pvs"
REPORTS_DIR="$DOC_DIR/$DOC_SUBTREE"

download_pvs_badge() {
  download_badge \
    "$(cat "$REPORTS_DIR/PVS-studio.err" | grep '^./' | wc -l)" \
    "PVS_analysis" \
    "$DOC_SUBTREE"
}

generate_pvs_report() {
  rm -rf "$REPORTS_DIR"
  mkdir -p "$REPORTS_DIR"

  local index_file="$REPORTS_DIR/index.html"

  (
    cd "$NEOVIM_DIR"

    sh ./scripts/pvscheck.sh --pvs detect --pvs-install .
    sh ./scripts/pvscheck.sh --deps --recheck .

    # Note: will also copy a binary log with *all* errors, including filtered
    # out. This is intentional.
    cp PVS-studio* "$REPORTS_DIR"
  )
  (
    cd "$REPORTS_DIR"

    local body="<pre>$(cat PVS-studio.err | html_escape)</pre>"

    generate_report "$title" "$body" "$index_file"
  )
}

clone_doc
clone_neovim
generate_pvs_report
download_pvs_badge
commit_doc
{'fraction_non_alphanumeric': 0.16169724770642202, 'fraction_numerical': 0.0007645259938837921, 'mean_word_length': 3.6983842010771992, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2921172', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1055, 'n_words': 204}