File: codestyle.yml

package info (click to toggle)
mpich 4.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 423,384 kB
  • sloc: ansic: 1,088,434; cpp: 71,364; javascript: 40,763; f90: 22,829; sh: 17,463; perl: 14,773; xml: 14,418; python: 10,265; makefile: 9,246; fortran: 8,008; java: 4,355; asm: 324; ruby: 176; lisp: 19; php: 8; sed: 4
file content (70 lines) | stat: -rw-r--r-- 2,390 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
jobs:
  # Check that commit title matches code style guidelines
  - job: commit_title
    displayName: commit title
    pool:
      name: MLNX
      demands:
      - ucx_docker -equals yes
    steps:
      - checkout: self
        clean: true
        fetchDepth: 100

      - bash: |
          set -eE
          BASE_SOURCEVERSION=$(git rev-parse HEAD^)
          range="$BASE_SOURCEVERSION..$(Build.SourceVersion)"
          ok=1
          for sha1 in `git log $range --format="%h"`
          do
              title=`git log -1 --format="%s" $sha1`
              if echo $title | grep -qP '^Merge |^[0-9A-Z/_\-]*: \w'
              then
                  echo "Good commit title: '$title'"
              else
                  echo "Bad commit title: '$title'"
                  ok=0
              fi
          done
          if [ $ok -ne 1 ]
          then
              url="https://github.com/openucx/ucx/wiki/Guidance-for-contributors#general-guidelines"
              echo "##vso[task.logissue type=error]Bad commit title(s), see $url for more info."
              echo "##vso[task.complete result=Failed;]"
          fi
        condition: eq(variables['Build.Reason'], 'PullRequest')

  # Check that the code is formatted according to the code style guidelines
  - job: format
    displayName: format code
    pool:
      name: MLNX
      demands:
      - ucx_docker -equals yes
    container: fedora
    steps:
      - checkout: self
        clean: true
        fetchDepth: 100

      - bash: |
          source ./buildlib/az-helpers.sh
          set -x
          git log -1 HEAD
          git log -1 HEAD^
          BASE_SOURCEVERSION=$(git rev-parse HEAD^)
          echo "Checking code format on diff ${BASE_SOURCEVERSION}..${BUILD_SOURCEVERSION}"
          git-clang-format --diff ${BASE_SOURCEVERSION} ${BUILD_SOURCEVERSION} > format.patch
          echo "Generated patch file:"
          cat format.patch
          if [ "`cat format.patch`" = "no modified files to format" ]; then
              exit
          fi
          git apply format.patch
          if ! git diff --quiet --exit-code
          then
              url="https://github.com/openucx/ucx/wiki/Code-style-checking"
              azure_complete_with_issues "Code is not formatted according to the code style, see $url for more info."
          fi
        condition: eq(variables['Build.Reason'], 'PullRequest')