diff --git a/.github/workflows/basic_checks.yml b/.github/workflows/basic_checks.yml new file mode 100644 index 0000000..ad0057e --- /dev/null +++ b/.github/workflows/basic_checks.yml @@ -0,0 +1,269 @@ +# This workflow performs the checks like license check, +# doxygen, unit tests etc. +name: Basic Checks + +on: + pull_request: + workflow_dispatch: + push: + branches: + - master + +jobs: + license-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:master-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: install dependencies + shell: bash + run: | + pip install scancode-toolkit + + - + name: license check + run: | + set -x + mkdir -p SCANCODE + + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ + | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) + echo $? + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ + | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \ + | ( grep -v '^tools/test/toolchains/api_test.py' || true ) \ + | while read file; do cp --parents "${file}" SCANCODE; done + ls SCANCODE + scancode -l --json-pp scancode.json SCANCODE + python ./tools/test/ci/scancode-evaluate.py scancode.json || true + cat scancode-evaluate.log + COUNT=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true + if [ $COUNT = 0 ]; then + echo "License check OK"; + true; + else + echo "License check failed, please review license issues found in files"; + false; + fi + + include-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:master-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: include check + run: | + # checks mbed.h is not included in MbedOS files except in tests + ! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \ + ':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \ + ':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' \ + ':!*events/tests/*' ':!*drivers/tests/*' + + style-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:master-latest + + steps: + + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: UTF-8 Check + run: | + # Make sure we're not introducing any text which is not UTF-8 encoded + git diff origin/${GITHUB_BASE_REF} -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' ) + + + - + name: astyle checks + run: | + set -x + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ + | ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \ + | ( grep -v -f .codecheckignore || true ) \ + | while read file; do astyle -n --options=.astylerc "${file}"; done + git diff --exit-code --diff-filter=d --color + + + docs-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:master-latest + + steps: + + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: spell checks + run: | + set -x + ./tools/test/ci/doxy-spellchecker/spell.sh drivers .codecheckignore + ./tools/test/ci/doxy-spellchecker/spell.sh platform .codecheckignore + ./tools/test/ci/doxy-spellchecker/spell.sh events .codecheckignore + ./tools/test/ci/doxy-spellchecker/spell.sh rtos .codecheckignore + ./tools/test/ci/doxy-spellchecker/spell.sh connectivity/netsocket .codecheckignore + + - + name: doxygen + run: | + set -x + ccache -s + mkdir BUILD + # Assert that the Doxygen build produced no warnings. + # The strange command below asserts that the Doxygen command had an + # output of zero length + doxygen doxyfile_options 2>&1 + # Once Mbed OS has been fixed, enable the full test by replacing the top line with this: + # - ( ! doxygen doxyfile_options 2>&1 | grep . ) + # Assert that all binary libraries are named correctly + # The strange command below asserts that there are exactly 0 libraries + # that do not start with lib + find "(" -name "*.a" -or -name "*.ar" ")" -and -not -name "lib*" | + tee BUILD/badlibs | + sed -e "s/^/Bad library name found: /" && [ ! -s BUILD/badlibs ] + # Assert that all assembler files are named correctly + # The strange command below asserts that there are exactly 0 libraries + # that do end with .s + find -name "*.s" | tee BUILD/badasm | + sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ] + + python-tests: + # these tests run in 3.7, hence running in vm not in pre-built docker + runs-on: ubuntu-latest + steps: + - + name: Checkout repo + uses: actions/checkout@v2 + + + - uses: actions/setup-python@v2 + with: + python-version: '3.7' + + - + name: install dependencies + run: | + pip install -r requirements.txt + pip install mock==2.0.0 attrs==19.1.0 pytest==3.3.0 'pylint>=1.9,<2' 'hypothesis>=3,<4' 'coverage>=4.5,<5' + + - + name: pytest + run: | + set -x + coverage run -a -m pytest tools/test + python tools/test/pylint.py + coverage run -a tools/project.py -S | sed -n '/^Total/p' + coverage html + + pin-validation: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:master-latest + steps: + - + name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: validate pins + run: | + set -x + git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} \ + | ( grep '.*[\\|\/]PinNames.h$' || true ) \ + | while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vvvfp "${file}"; done + git diff --exit-code --diff-filter=d --color + + cmake-checks: + env: + NAME: mbed-test-mode-check + ROOT: tools/cmake/tests/mbed_test_mode/ + TOOLCHAIN: GCC_ARM + TARGET_NAME: K64F + PROFILE: develop + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:master-latest + steps: + - + name: Checkout repo + uses: actions/checkout@v2 + + - + name: cmake build + run: | + set -x + mbedtools configure -p ${{ env.ROOT}} -t ${{ env.TOOLCHAIN }} -m ${{ env.TARGET_NAME }} --mbed-os-path . + cmake -S ${{env.ROOT}} -B ${{ env.ROOT }}/cmake_build/${{env.TARGET_NAME}}/${{ env.PROFILE }}/${{ env.TOOLCHAIN }}/ -GNinja -DCMAKE_BUILD_TYPE=${{ env.PROFILE }} + cmake --build ${{ env.ROOT }}/cmake_build/${{ env.TARGET_NAME }}/${{ env.PROFILE }}/${{ env.TOOLCHAIN }}/ + + - + name: cmake unittest + run: | + set -x + ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON --test-command ctest + gcovr --gcov-executable gcov -r . ./build -s -e ".*\.h" --exclude-directories=${GITHUB_WORKSPACE}/build/UNITTESTS --exclude-directories=${GITHUB_WORKSPACE}/build/_deps + ccache -s + + # Reject any changes to tools that would require a re-release of the + # tools for the online compiler. + frozen-tools-check: + runs-on: ubuntu-latest + container: + image: ghcr.io/armmbed/mbed-os-env:master-latest + steps: + - + name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - + name: frozen tool check + run: | + set -x + git diff --name-only origin/${GITHUB_BASE_REF} \ + | egrep \ + -e "^tools/build_api*" \ + -e "^tools/config*" \ + -e "^tools/export*" \ + -e "^tools/notifier*" \ + -e "^tools/paths*" \ + -e "^tools/resources*" \ + -e "^tools/targets*" \ + -e "^tools/toolchains*" \ + -e "^tools/utils*" \ + -e "^$" > output.log | true + frozen_files=`cat output.log` + + if [ -z "$frozen_files" ]; then + echo "Success!"; + else + echo -e "Failure: Frozen files were modified\n$frozen_files"; + echo -e "Please see https://os.mbed.com/blog/entry/Introducing-the-new-Mbed-Tools/" \ + "\nfor why we've frozen the legacy tools."; + false; + fi diff --git a/.mergify.yml b/.mergify.yml index 41edccc..0062487 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -35,10 +35,17 @@ remove: ['needs: review', 'needs: CI'] # From needs: review to needs: work - CI failure - - name: "label needs: work when travis-ci failed" + - name: "label needs: work when GitHub Actions jobs have failed" conditions: - # Travis failing - - status-failure~=Travis CI - Pull Request + # GitHub Actions are failing + - check-failure=license-check + - check-failure=include-check + - check-failure=style-check + - check-failure=docs-check + - check-failure=python-tests + - check-failure=pin-validation + - check-failure=cmake-checks + - check-failure=frozen-tools-check - "label!=mergify skip" actions: label: @@ -49,7 +56,7 @@ - name: "label needs: work when Jenkins CI failed - pr head" conditions: # Jenkins CI failing - - status-failure~=continuous-integration/jenkins/pr-head + - check-failure~=continuous-integration/jenkins/pr-head - "label!=mergify skip" actions: label: @@ -60,7 +67,7 @@ - name: "label needs: work when Jenkins CI failed - any of the pipeline" conditions: # Jenkins CI failing - any of the pipeline - - status-failure~=^jenkins-ci + - check-failure~=^jenkins-ci - "label!=mergify skip" actions: label: @@ -80,11 +87,18 @@ # No conflict with the base branch - -conflict - # CI green policy, at least Travis should be green - - status-success~=Travis CI - Pull Request + # CI green policy, at least GitHub Actions jobs should be green + - check-success=license-check + - check-success=include-check + - check-success=style-check + - check-success=docs-check + - check-success=python-tests + - check-success=pin-validation + - check-success=cmake-checks + - check-success=frozen-tools-check # new CI needs to be done (neutral does not work, lets check if it failed or passed, if none, we need to run again) - - -status-success~=continuous-integration/jenkins/pr-head - - -status-failure~=continuous-integration/jenkins/pr-head + - -check-success~=continuous-integration/jenkins/pr-head + - -check-failure~=continuous-integration/jenkins/pr-head actions: label: add: ['needs: CI'] @@ -132,11 +146,19 @@ - "#changes-requested-reviews-by=0" # CI green policy - - status-success~=Travis CI - Pull Request + - check-success=license-check + - check-success=include-check + - check-success=style-check + - check-success=docs-check + - check-success=python-tests + - check-success=pin-validation + - check-success=cmake-checks + - check-success=frozen-tools-check + # Internal Jenkins - we rely on PR head to provide status - - status-success~=continuous-integration/jenkins/pr-head + - check-success~=continuous-integration/jenkins/pr-head # any of the jenkins pipeline needs to be green. We rely on not failure means all good (if skipped or executed) - - -status-failure~=^jenkins-ci + - -check-failure~=^jenkins-ci actions: label: add: ['ready for merge'] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 57c8c2b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,341 +0,0 @@ -# Copyright (c) 2013-2019 Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the License); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an AS IS BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -language: sh -os: linux -dist: focal - - -env: - global: - - deps_url="https://mbed-os-ci-public.s3-eu-west-1.amazonaws.com/jenkins-ci/deps" - - deps_dir="${HOME}/.cache/deps" - -cache: - pip: true - ccache: true - directories: - - ${HOME}/.cache/deps - -before_install: - - source tools/test/travis-ci/functions.sh - -addons: - apt: - sources: - - sourceline: 'deb https://apt.kitware.com/ubuntu/ focal main' - key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc' - packages: - - cmake - - ninja-build - - gcovr - - libncursesw5 - - g++-7 - -matrix: - include: - - ### Basic Tests ### - - &basic-vm - stage: "Basic" - name: "file attributes" - env: NAME=gitattributestest - script: - - git diff --exit-code - - - <<: *basic-vm - name: "license check" - env: NAME=licence_check - language: python - python: 3.6.8 # scancode-toolkit v3.1.1 requires v3.6.8 - install: - # workaround for https://github.com/ARMmbed/mbed-os/issues/13322 - - pip install pdfminer.six==20200517 - - pip install scancode-toolkit==3.1.1 - before_script: - - mkdir -p SCANCODE - - mkdir -p SCANCODE_NEW_FILES - # Fetch the base branch to compare against - - git fetch origin "${TRAVIS_BRANCH}" --depth=1 - script: - # scancode does not support list of files, only one file or directory - # we use SCANCODE directory for all changed files (their copies with full tree) - - >- - git diff --name-only --diff-filter=ad FETCH_HEAD..HEAD \ - | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \ - | ( grep -v '^tools/test/toolchains/api_test.py' || true ) \ - | while read file; do cp --parents "${file}" SCANCODE; done - - scancode -l --json-pp scancode.json SCANCODE - - python ./tools/test/travis-ci/scancode-evaluate.py scancode.json || true - # run the same but for new files. All new files must have SPDX - - >- - git diff --name-only --diff-filter=A FETCH_HEAD..HEAD \ - | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \ - | ( grep -v '^tools/test/toolchains/api_test.py' || true ) \ - | while read file; do cp --parents "${file}" SCANCODE_NEW_FILES; done - - scancode -l --json-pp scancode_new_files.json SCANCODE_NEW_FILES - - python ./tools/test/travis-ci/scancode-evaluate.py scancode_new_files.json || true - - cat scancode-evaluate.log - - COUNT=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true - - python ./tools/test/travis-ci/scancode-evaluate.py scancode_new_files.json - - cat scancode-evaluate.log - - COUNT_NEW_FILES=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true - - | - if [ $COUNT == 0 ] && [ $COUNT_NEW_FILES == 0 ]; then - echo "License check OK"; - true; - elif [ $COUNT_NEW_FILES != 0 ]; then - echo "License check failed, new files with the license issues found"; - false; - else - echo "License check failed, please review license issues found in modified files"; - false; - fi - - - <<: *basic-vm - name: "UTF-8 Check" - script: - # Make sure we're not introducing any text which is not UTF-8 encoded - - git diff $TRAVIS_BRANCH...HEAD -U0 | ( grep -a '^+' || true ) | ( ! grep -axv '.*' ) - - - <<: *basic-vm - name: "include check" - env: NAME=include_check - script: - - | - ! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \ - ':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \ - ':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' \ - ':!*events/tests/*' ':!*drivers/tests/*' - - ### Docs Tests ### - - &docs-vm - stage: "Docs" - name: "astyle" - env: NAME=astyle - install: - - >- - curl -L0 https://mbed-os-ci-public.s3-eu-west-1.amazonaws.com/jenkins-ci/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz; - mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD; - cd BUILD/astyle/build/gcc; - make; - export PATH="${PWD}/bin:${PATH}"; - cd - - - astyle --version - # Fetch the base branch to compare against - - git fetch origin "${TRAVIS_BRANCH}" --depth=1 - script: - - >- - git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ - | ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \ - | ( grep -v -f .codecheckignore || true ) \ - | while read file; do astyle -n --options=.astylerc "${file}"; done - - git diff --exit-code --diff-filter=d --color - - - <<: *docs-vm - name: "spellcheck" - env: NAME=doxy-spellcheck - install: - - source_pkg aspell - script: - # TODO: run checks on all directories once all mispellings are fixed - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers .codecheckignore - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform .codecheckignore - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh events .codecheckignore - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos .codecheckignore - - ./tools/test/travis-ci/doxy-spellchecker/spell.sh connectivity/netsocket .codecheckignore - - - <<: *docs-vm - name: "doxygen" - env: NAME=docs - install: - # Build doxygen - - > - (git clone --depth=1 --single-branch --branch Release_1_8_14 https://github.com/doxygen/doxygen; - cd doxygen; - mkdir build; - cd build; - cmake -G "Unix Makefiles" ..; - make; - sudo make install) - # Create BUILD directory for tests - - ccache -s - - mkdir BUILD - script: - # Assert that the Doxygen build produced no warnings. - # The strange command below asserts that the Doxygen command had an - # output of zero length - - doxygen doxyfile_options 2>&1 - # Once Mbed OS has been fixed, enable the full test by replacing the top line with this: - # - ( ! doxygen doxyfile_options 2>&1 | grep . ) - # Assert that all binary libraries are named correctly - # The strange command below asserts that there are exactly 0 libraries - # that do not start with lib - - > - find "(" -name "*.a" -or -name "*.ar" ")" -and -not -name "lib*" | - tee BUILD/badlibs | - sed -e "s/^/Bad library name found: /" && [ ! -s BUILD/badlibs ] - # Assert that all assembler files are named correctly - # The strange command below asserts that there are exactly 0 libraries - # that do end with .s - - > - find -name "*.s" | tee BUILD/badasm | - sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ] - - ### Python Tests ### - - &pytools-vm - stage: "Pytest" - name: "tools-py35" - env: NAME=tools-py3.5 - language: python - python: 3.7 - install: - # Install gcc - - source_pkg gcc - - arm-none-eabi-gcc --version - # Install additional python modules - - python --version - - |- - tr -d ' ' >> requirements.txt <<< " - mock==2.0.0 - attrs==19.1.0 - pytest==3.3.0 - pylint>=1.9,<2 - hypothesis>=3,<4 - coverage>=4.5,<5 - " - - pip install --upgrade pip - - pip install -r requirements.txt - - pip list --verbose - script: - # Run local testing on tools - - PYTHONPATH=. coverage run -a -m pytest tools/test - - python tools/test/pylint.py - - coverage run -a tools/project.py -S | sed -n '/^Total/p' - - coverage html - - - &extended-vm - stage: "Pin validation" - name: "pinvalidate" - env: NAME=pinvalidate - language: python - python: 3.7 - install: - # Install python modules - - pip install --upgrade pip - - pip install tabulate argparse - - pip list --verbose - # Fetch the base branch to compare against - - git fetch origin "${TRAVIS_BRANCH}" --depth=1 - script: - - >- - git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ - | ( grep '.*[\\|\/]PinNames.h$' || true ) \ - | while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vvvfp "${file}"; done - - git diff --exit-code --diff-filter=d --color - - ### CMake Check ### - - &cmake-vm - stage: "CMake Check" - name: "Backward compatiblity check - MBED_TEST_MODE" - env: NAME=mbed-test-mode-check ROOT=tools/cmake/tests/mbed_test_mode/ TOOLCHAIN=GCC_ARM TARGET_NAME=K64F PROFILE=develop - language: python - python: 3.8 - install: - # Hide Travis-preinstalled CMake - # The Travis-preinstalled CMake is unfortunately not installed via apt, so we - # can't replace it with an apt-supplied version very easily. Additionally, we - # can't permit the Travis-preinstalled copy to survive, as the Travis default - # path lists the Travis CMake install location ahead of any place where apt - # would install CMake to. Instead of apt removing or upgrading to a new CMake - # version, we must instead delete the Travis copy of CMake. - - sudo rm -rf /usr/local/cmake* - # Setup ccache - - ccache -o compiler_check=content - - ccache -M 1G - - pushd /usr/lib/ccache - - sudo ln -s ../../bin/ccache arm-none-eabi-gcc - - sudo ln -s ../../bin/ccache arm-none-eabi-g++ - - export PATH="/usr/lib/ccache:$PATH" - - popd - # Install arm-none-eabi-gcc - - pushd /home/travis/build && mkdir arm-gcc && cd arm-gcc - - curl -L0 "https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2?revision=05382cca-1721-44e1-ae19-1e7c3dc96118&la=en&hash=D7C9D18FCA2DD9F894FD9F3C3DC9228498FA281A" --output gcc-arm-none-eabi-9-2020-q2-update.tar.bz2 - - tar xf gcc-arm-none-eabi-9-2020-q2-update.tar.bz2 - - export PATH="$PATH:${PWD}/gcc-arm-none-eabi-9-2020-q2-update/bin" - - popd - - arm-none-eabi-gcc --version - # Install python modules - - pip install --upgrade mbed-tools - - pip install -r tools/cmake/requirements.txt - script: - - mbedtools configure -p ${ROOT} -t ${TOOLCHAIN} -m ${TARGET_NAME} --mbed-os-path . - - cmake -S ${ROOT} -B ${ROOT}/cmake_build/${TARGET_NAME}/${PROFILE}/${TOOLCHAIN}/ -GNinja -DCMAKE_BUILD_TYPE=${PROFILE} - - cmake --build ${ROOT}/cmake_build/${TARGET_NAME}/${PROFILE}/${TOOLCHAIN}/ - - ### Mbed OS unittest ### - - &cmake-build-run-unittest - stage: "CMake" - name: "CMake unittest build" - env: NAME=cmake_unittest - install: - # Hide Travis-preinstalled CMake - # The Travis-preinstalled CMake is unfortunately not installed via apt, so we - # can't replace it with an apt-supplied version very easily. Additionally, we - # can't permit the Travis-preinstalled copy to survive, as the Travis default - # path lists the Travis CMake install location ahead of any place where apt - # would install CMake to. Instead of apt removing or upgrading to a new CMake - # version, we must instead delete the Travis copy of CMake. - - sudo rm -rf /usr/local/cmake* - script: - - echo ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7 --test-command ctest - - ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7 --test-command ctest - - gcovr --gcov-executable gcov-7 -r . ./build -s -e ".*\.h" --exclude-directories=$TRAVIS_BUILD_DIR/build/UNITTESTS --exclude-directories=$TRAVIS_BUILD_DIR/build/_deps - - ccache -s - - ### Frozen tools check ### - - &frozen-tools-vm - stage: "Frozen tools check" - name: "Frozen tools check" - env: NAME=frozen_tools_check - before_script: - # Fetch the base branch to compare against - - git fetch origin "${TRAVIS_BRANCH}" --depth=1 - script: - # Reject any changes to tools that would require a re-release of the - # tools for the online compiler. - - >- - frozen_files=`\ - git diff --name-only FETCH_HEAD..HEAD \ - | egrep \ - -e "^tools/build_api*" \ - -e "^tools/config*" \ - -e "^tools/export*" \ - -e "^tools/notifier*" \ - -e "^tools/paths*" \ - -e "^tools/resources*" \ - -e "^tools/targets*" \ - -e "^tools/toolchains*" \ - -e "^tools/utils*" \ - -e "^$"` - if [ -z "$frozen_files" ]; then - echo "Success!"; - else - echo -e "Failure: Frozen files were modified\n$frozen_files"; - echo -e "Please see https://os.mbed.com/blog/entry/Introducing-the-new-Mbed-Tools/" \ - "\nfor why we've frozen the legacy tools."; - false; - fi diff --git a/README.md b/README.md index e4cfea0..503d271 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,12 @@ [![Mbed OS][mbed-os-logo]][mbed-os-link] -[![Build status release][mbed-travis-release-svg]][mbed-travis-release] -[![Build status master][mbed-travis-master-svg]][mbed-travis-master] +[![Build status master][mbed-master-svg]][mbed-master] [![Tools coverage status][mbed-coveralls-tools-svg]][mbed-coveralls-tools] [mbed-os-logo]: logo.png [mbed-os-link]: https://www.mbed.com/en/platform/mbed-os/ -[mbed-travis-master]: https://travis-ci.org/ARMmbed/mbed-os -[mbed-travis-master-svg]: https://travis-ci.org/ARMmbed/mbed-os.svg?branch=master -[mbed-travis-release]: https://travis-ci.org/ARMmbed/mbed-os/branches -[mbed-travis-release-svg]: https://travis-ci.org/ARMmbed/mbed-os.svg?branch=latest +[mbed-master]: https://github.com/ARMmbed/mbed-os/actions/workflows/basic_checks.yml +[mbed-master-svg]: https://github.com/ARMmbed/mbed-os/actions/workflows/basic_checks.yml/badge.svg [mbed-coveralls-tools]: https://coveralls.io/github/ARMmbed/mbed-os?branch=master [mbed-coveralls-tools-svg]: https://coveralls.io/repos/github/ARMmbed/mbed-os/badge.svg?branch=master diff --git a/tools/test/ci/doxy-spellchecker/en.dat b/tools/test/ci/doxy-spellchecker/en.dat new file mode 100644 index 0000000..ec2555e --- /dev/null +++ b/tools/test/ci/doxy-spellchecker/en.dat @@ -0,0 +1,6 @@ +name en +charset iso8859-1 +soundslike en +affix en +special ' -*- 0 *** 1 *** 2 *** 3 *** 4 *** 5 *** 6 *** 7 *** 8 *** 9 *** < *** > *** _ *** +#repl-table en_affix.dat diff --git a/tools/test/ci/doxy-spellchecker/en_affix.dat b/tools/test/ci/doxy-spellchecker/en_affix.dat new file mode 100644 index 0000000..e753407 --- /dev/null +++ b/tools/test/ci/doxy-spellchecker/en_affix.dat @@ -0,0 +1,226 @@ +# +# This affix file is based on Ispell, which is under the following +# copyright: +# +# Copyright 1992, 1993, 1999, 2000, 2001, Geoff Kuenning, Claremont, CA +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions, and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions, and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All modifications to the source code must be clearly marked as +# such. Binary redistributions based on modified source code +# must be clearly marked as modified versions in the documentation +# and/or other materials provided with the distribution. +# (Clause 4 removed with permission from Geoff Kuenning.) +# 5. The name of Geoff Kuenning may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +SET ISO8859-1 +TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ' + +PFX A Y 1 +PFX A 0 re . + +PFX I Y 1 +PFX I 0 in . + +PFX U Y 1 +PFX U 0 un . + +PFX C Y 1 +PFX C 0 de . + +PFX E Y 1 +PFX E 0 dis . + +PFX F Y 1 +PFX F 0 con . + +PFX K Y 1 +PFX K 0 pro . + +SFX V N 2 +SFX V e ive e +SFX V 0 ive [^e] + +SFX N Y 3 +SFX N e ion e +SFX N y ication y +SFX N 0 en [^ey] + +SFX X Y 3 +SFX X e ions e +SFX X y ications y +SFX X 0 ens [^ey] + +SFX H N 2 +SFX H y ieth y +SFX H 0 th [^y] + +SFX Y Y 1 +SFX Y 0 ly . + +SFX G Y 2 +SFX G e ing e +SFX G 0 ing [^e] + +SFX J Y 2 +SFX J e ings e +SFX J 0 ings [^e] + +SFX D Y 4 +SFX D 0 d e +SFX D y ied [^aeiou]y +SFX D 0 ed [^ey] +SFX D 0 ed [aeiou]y + +SFX T N 4 +SFX T 0 st e +SFX T y iest [^aeiou]y +SFX T 0 est [aeiou]y +SFX T 0 est [^ey] + +SFX R Y 4 +SFX R 0 r e +SFX R y ier [^aeiou]y +SFX R 0 er [aeiou]y +SFX R 0 er [^ey] + +SFX Z Y 4 +SFX Z 0 rs e +SFX Z y iers [^aeiou]y +SFX Z 0 ers [aeiou]y +SFX Z 0 ers [^ey] + +SFX S Y 4 +SFX S y ies [^aeiou]y +SFX S 0 s [aeiou]y +SFX S 0 es [sxzh] +SFX S 0 s [^sxzhy] + +SFX P Y 3 +SFX P y iness [^aeiou]y +SFX P 0 ness [aeiou]y +SFX P 0 ness [^y] + +SFX M Y 1 +SFX M 0 's . + +SFX B Y 3 +SFX B 0 able [^aeiou] +SFX B 0 able ee +SFX B e able [^aeiou]e + +SFX L Y 1 +SFX L 0 ment . + +REP 88 +REP a ei +REP ei a +REP a ey +REP ey a +REP ai ie +REP ie ai +REP are air +REP are ear +REP are eir +REP air are +REP air ere +REP ere air +REP ere ear +REP ere eir +REP ear are +REP ear air +REP ear ere +REP eir are +REP eir ere +REP ch te +REP te ch +REP ch ti +REP ti ch +REP ch tu +REP tu ch +REP ch s +REP s ch +REP ch k +REP k ch +REP f ph +REP ph f +REP gh f +REP f gh +REP i igh +REP igh i +REP i uy +REP uy i +REP i ee +REP ee i +REP j di +REP di j +REP j gg +REP gg j +REP j ge +REP ge j +REP s ti +REP ti s +REP s ci +REP ci s +REP k cc +REP cc k +REP k qu +REP qu k +REP kw qu +REP o eau +REP eau o +REP o ew +REP ew o +REP oo ew +REP ew oo +REP ew ui +REP ui ew +REP oo ui +REP ui oo +REP ew u +REP u ew +REP oo u +REP u oo +REP u oe +REP oe u +REP u ieu +REP ieu u +REP ue ew +REP ew ue +REP uff ough +REP oo ieu +REP ieu oo +REP ier ear +REP ear ier +REP ear air +REP air ear +REP w qu +REP qu w +REP z ss +REP ss z +REP shun tion +REP shun sion +REP shun cion diff --git a/tools/test/ci/doxy-spellchecker/en_phonet.dat b/tools/test/ci/doxy-spellchecker/en_phonet.dat new file mode 100644 index 0000000..3987f9c --- /dev/null +++ b/tools/test/ci/doxy-spellchecker/en_phonet.dat @@ -0,0 +1 @@ +version 1.1 diff --git a/tools/test/ci/doxy-spellchecker/ignore.en.pws b/tools/test/ci/doxy-spellchecker/ignore.en.pws new file mode 100644 index 0000000..fbc768b --- /dev/null +++ b/tools/test/ci/doxy-spellchecker/ignore.en.pws @@ -0,0 +1,125 @@ +personal_ws-1.1 en 1600 utf-8 +_code_ +unconfigured +mbed +rtos +malloc +mutex +tx +rx +wi +fi +rr +sd +pc +vtable +nmemb +relloc +printf +arg +scanf +fclose +fputs +usb +or'd +MMmmpp +multithread +multithreaded +initializer +lookup +startup +unreferenced +singleshot +multishot +inlined +allocator +parameterized +XORed +unbuffered +sizeof +stringification +interoperability +memcpy +nack +mbit +retval +dequeue +assertation +destructor +destructors +constructor +constructors +ctor +dtor +dereference +ptr +templated +templatize +accessor +init +deleters +decrement +increment +deinitialize +deinitializes +atomicity +pointee +entrancy +Systick +noop +deassert +deasserts +deasserted +getter +setter +preallocated +excludable +ascii +IPv +param +struct +typedef +typedefs +onboard +enum +endian +emac +emacs +json +noncopyable +sendto +gethostbyname +multicast +multicasts +singleshot +multishot +sa +tparam +retarget +TCPSocket +UDPSocket +Socket +unregister +deinit +auth +pppapi +pbuf +nak +reqs +xmit +pppd +pppdebug +ppp +api +uart +chrono +Hinnant +Vin +Vref +ssid +instantiation +instantiations +KVStore +_doxy_ +nothrow +conf diff --git a/tools/test/ci/doxy-spellchecker/spell.sh b/tools/test/ci/doxy-spellchecker/spell.sh new file mode 100755 index 0000000..e94ae52 --- /dev/null +++ b/tools/test/ci/doxy-spellchecker/spell.sh @@ -0,0 +1,128 @@ +#!/bin/bash -eu +# mbed Microcontroller Library +# Copyright (c) 2018 ARM Limited +# SPDX-License-Identifier: Apache-2.0 + +set -o pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +ERRORS=0 + +# Loops use here strings to allow them to run in the main shell and modify the correct version of +# the error counter global variable +while read file; do + echo "${file}" + res=$(awk '/\/\*\*/,/\*\//' "${file}" | cut -d '/' -f2 | sed 's/0x[^ ]*//' | sed 's/[0-9]*//g') + + # Select a token to begin on, then a formating option such as strip all text between the start + # and end token, strip an entire line containing the start token, or strip a portion of a line + # containing the start token. Select an appropiate end token. The tokens and formats are index + # matched. + start_tokens=( "/@code" + "/addtogroup" + "ingroup" + "defgroup" + "<" + "()" + ) + + formats=( 'strip_between' + 'strip_between' + 'strip_line' + 'strip_line' + 'strip_between_sameline' + 'strip_token' + ) + + end_tokens=( "/@endcode" + "/\*" + "" + "" + ">" + "" + ) + + # Stripping strings between tokens P1-P2 and P3-P4 inclusively ran into issues depending + # on if the tokens were on the same line or not. + #_________________________________________ + # Don't remove this P1 remove me P2 + # Keep me + # P3 + # Remove me too please + # P4 + # Keep me too + # Still here P1 But this shouldn't be P2 + #_________________________________________ + # + # Opted for having two separate formats. In particular this formatting issue came up when + # trying to strip the code segments and template type arguments between '<, >' as the multiline + # sed command would strip the entire line, causing the removal string to span across the entire file + # when trying to match the next end token (above format when stripping everything between P1 and P2 + # would end up with just "Don't remove this" and the rest of the file stripped). + + for ((i=0;i<${#start_tokens[@]};++i)); do + filter="" + if [[ "${formats[i]}" == 'strip_between' ]]; then + filter=$(<<< "${res}" sed "${start_tokens[i]}/,${end_tokens[i]}/d") + elif [[ "${formats[i]}" == 'strip_between_sameline' ]]; then + filter=$(<<< "${res}" sed -e "s/"${start_tokens[i]}".*"${end_tokens[i]}"//") + elif [[ "${formats[i]}" == 'strip_line' ]]; then + filter=$(<<< "${res}" sed "/"${start_tokens[i]}"/ d") + elif [[ "${formats[i]}" == 'strip_token' ]]; then + filter=$(<<< "${res}" sed "s/"${start_tokens[i]}"//g") + fi + + if [ "${filter}" != "" ]; then + res=${filter} + fi + done + + if [ "${2:-}" == "-vv" ]; then + echo "${res}" + fi + + prev_err=("") + while read err; do + if [ $(echo "${res}" | grep "${err}" | wc -l) -eq $(grep "${err}" "${file}" | wc -l) ]; then + # Do not count all caps words as errors (RTOS, WTI, etc) or plural versions (APNs/MTD's) + if ! [[ ${err} =~ ^[A-Z]+$ || ${err} =~ ^[A-Z]+s$ || ${err} =~ ^[A-Z]+\'s$ ]]; then + + # Disregard camelcase/underscored words. Hex was stripped at the beginning + if ! echo "${err}" | grep --quiet -E '[a-z]{1,}[A-Z]|_'; then + + # The grep command to fetch the line numbers will report all instances, do not + # list repeated error words found from aspell in each file + if ! [[ ${prev_err[*]} =~ "${err}" ]]; then + prev_err+=("${err}") + + if [ ${#prev_err[@]} -eq 2 ]; then + echo "=================================" + echo "Errors: " + fi + + while read ln; do + echo "${ln} ${err}" + ERRORS=$((ERRORS + 1)) + done <<< "$(grep -n "${err}" "${file}" | cut -d ' ' -f1)" + fi + fi + fi + fi + done <<< "$(echo "${res}" | aspell list -C --ignore-case -p "${DIR}"/ignore.en.pws --local-data-dir "${DIR}")" + + if [ ${#prev_err[@]} -ne 1 ]; then + echo "_________________________________" + fi + +# ${1}: directory to check +# ${2}: file containing a list of paths (regex) to exclude +done < <(find "${1}" -type d -iname "*target*" -prune -o -name '*.h' -print | grep -v -f "${2}") + +echo "----------------------------------------------------------------------------------" +echo "Total Errors Found: ${ERRORS}" + +if [ ${ERRORS} -ne 0 ]; then + echo "If any of the failed words should be considered valid please add them to the ignore.en.pws file"\ + "found in tools/test/ci/doxy-spellchecker between the _code_ and _doxy_ tags." + exit 1 +fi diff --git a/tools/test/ci/scancode-evaluate.py b/tools/test/ci/scancode-evaluate.py new file mode 100644 index 0000000..e650fc9 --- /dev/null +++ b/tools/test/ci/scancode-evaluate.py @@ -0,0 +1,182 @@ +""" +SPDX-License-Identifier: Apache-2.0 + +Copyright (c) 2020 Arm Limited. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations +""" + +import argparse +import json +import logging +import os.path +import re +import sys +from enum import Enum + +MISSING_LICENSE_TEXT = "Missing license header" +MISSING_PERMISSIVE_LICENSE_TEXT = "Non-permissive license" +MISSING_SPDX_TEXT = "Missing SPDX license identifier" + +userlog = logging.getLogger("scancode-evaluate") + + +class ReturnCode(Enum): + """Return codes.""" + + SUCCESS = 0 + ERROR = -1 + + +def init_logger(): + """Initialise the logger.""" + userlog.setLevel(logging.INFO) + userlog.addHandler( + logging.FileHandler( + os.path.join(os.getcwd(), 'scancode-evaluate.log'), mode='w' + ) + ) + + +def path_leaf(path): + """Return the leaf of a path.""" + head, tail = os.path.split(path) + # Ensure the correct file name is returned if the file ends with a slash + return tail or os.path.basename(head) + + +def has_permissive_text_in_scancode_output(scancode_output_data_file_licenses): + """Returns true if at least one license in the scancode output is permissive""" + return any( + scancode_output_data_file_license['category'] == 'Permissive' + for scancode_output_data_file_license in scancode_output_data_file_licenses + ) + + +def has_spdx_text_in_scancode_output(scancode_output_data_file_licenses): + """Returns true if at least one license in the scancode output has the spdx identifier.""" + return any( + 'spdx' in scancode_output_data_file_license['matched_rule']['identifier'] + for scancode_output_data_file_license in scancode_output_data_file_licenses + ) + + +def has_spdx_text_in_analysed_file(scanned_file_content): + """Returns true if the file analysed by ScanCode contains SPDX identifier.""" + return bool(re.findall("SPDX-License-Identifier:?", scanned_file_content)) + + +def has_binary_license(scanned_file_content): + """Returns true if the file analysed by ScanCode contains a Permissive Binary License.""" + return bool(re.findall("Permissive Binary License", scanned_file_content)) + + +def get_file_text(scancode_output_data_file): + """Returns file text for scancode output file""" + file_path = os.path.abspath(scancode_output_data_file['path']) + try: + with open(file_path, 'r') as read_file: + return read_file.read() + except UnicodeDecodeError: + userlog.warning("Unable to decode file text in: %s" % file_path) + # Ignore files that cannot be decoded + + +def license_check(scancode_output_path): + """Check licenses in the scancode json file for specified directory. + + This function does not verify if file exists, should be done prior the call. + + Args: + scancode_output_path: path to the scancode json output file (output from scancode --license --json-pp) + + Returns: + 0 if nothing found + >0 - count how many license issues found + ReturnCode.ERROR.value if any error in file licenses found + """ + + license_offenders = [] + spdx_offenders = [] + try: + with open(scancode_output_path, 'r') as read_file: + scancode_output_data = json.load(read_file) + except json.JSONDecodeError as jex: + userlog.warning("JSON could not be decoded, Invalid JSON in body: %s", jex) + return ReturnCode.ERROR.value + + if 'files' not in scancode_output_data: + userlog.warning("Missing `files` attribute in %s" % (scancode_output_path)) + return ReturnCode.ERROR.value + + for scancode_output_data_file in scancode_output_data['files']: + if scancode_output_data_file['type'] != 'file': + continue + + if not scancode_output_data_file['licenses']: + scancode_output_data_file['fail_reason'] = MISSING_LICENSE_TEXT + license_offenders.append(scancode_output_data_file) + # check the next file in the scancode output + continue + + if not has_permissive_text_in_scancode_output(scancode_output_data_file['licenses']): + scanned_file_content = get_file_text(scancode_output_data_file) + if not (scanned_file_content and has_binary_license(scanned_file_content)): + scancode_output_data_file['fail_reason'] = MISSING_PERMISSIVE_LICENSE_TEXT + license_offenders.append(scancode_output_data_file) + + if not has_spdx_text_in_scancode_output(scancode_output_data_file['licenses']): + # Scancode does not recognize license notice in Python file headers. + # Issue: https://github.com/nexB/scancode-toolkit/issues/1913 + # Therefore check if the file tested by ScanCode actually has a licence notice. + scanned_file_content = get_file_text(scancode_output_data_file) + + if not scanned_file_content: + continue + elif not has_spdx_text_in_analysed_file(scanned_file_content): + scancode_output_data_file['fail_reason'] = MISSING_SPDX_TEXT + spdx_offenders.append(scancode_output_data_file) + + if license_offenders: + userlog.warning("Found files with missing license details, please review and fix") + for offender in license_offenders: + userlog.warning("File: %s reason: %s" % (path_leaf(offender['path']), offender['fail_reason'])) + if spdx_offenders: + userlog.warning("Found files with missing SPDX identifier, please review and fix") + for offender in spdx_offenders: + userlog.warning("File: %s reason: %s" % (path_leaf(offender['path']), offender['fail_reason'])) + return len(license_offenders) + + +def parse_args(): + """Parse command line arguments.""" + parser = argparse.ArgumentParser(description="License check.") + parser.add_argument( + 'scancode_output_path', + help="scancode-toolkit output json file" + ) + return parser.parse_args() + + +if __name__ == "__main__": + init_logger() + args = parse_args() + if os.path.isfile(args.scancode_output_path): + sys.exit( + ReturnCode.SUCCESS.value + if license_check(args.scancode_output_path) == 0 + else ReturnCode.ERROR.value + ) + else: + userlog.warning("Could not find the scancode json file") + sys.exit(ReturnCode.ERROR.value) diff --git a/tools/test/ci/scancode_evaluate_test.py b/tools/test/ci/scancode_evaluate_test.py new file mode 100644 index 0000000..dc5b8fb --- /dev/null +++ b/tools/test/ci/scancode_evaluate_test.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python +# Copyright (c) 2020 Arm Limited and Contributors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +import importlib +import os +import pytest + +license_check = importlib.import_module("scancode-evaluate").license_check + +STUBS_PATH = os.path.join( + os.path.abspath(os.path.join(os.path.dirname(__file__))), "scancode_test" +) + +HEADER_WITHOUT_SPDX = "/* Copyright (C) Arm Limited, Inc - All Rights Reserved\ + * Unauthorized copying of this. file, via any medium is strictly prohibited\ + * Proprietary and confidential\ + */" + +HEADER_WITH_SPDX = "/* mbed Microcontroller Library\ + * Copyright (c) 2006-2013 ARM Limited\ + *\ + * SPDX-License-Identifier: Apache-2.0\ + * Licensed under the Apache License, Version 2.0 (the \"License\");\ + * you may not use this file except in compliance with the License.\ + * You may obtain a copy of the License at\ + *\ + * http://www.apache.org/licenses/LICENSE-2.0\ + *\ + * Unless required by applicable law or agreed to in writing, software\ + * distributed under the License is distributed on an \"AS IS\" BASIS,\ + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\ + * See the License for the specific language governing permissions and\ + * limitations under the License.\ + */" + +HEADER_WITH_BINARY_LICENSE = "/*\ + * Copyright (c) 2019, Arm Limited, All Rights Reserved\ + * SPDX-License-Identifier: LicenseRef-PBL\ + *\ + * This file and the related binary are licensed under the\ + * Permissive Binary License, Version 1.0 (the \"License\");\ + * you may not use these files except in compliance with the License.\ + *\ + */" + +@pytest.fixture() +def create_scanned_files(): + """Create stub files. + test3.h missing license notice + test4.h with license notice + test5.h with license notice + test6.h with permissive binary license + """ + file_paths = [ + os.path.join(STUBS_PATH, "test3.h"), + os.path.join(STUBS_PATH, "test4.h"), + os.path.join(STUBS_PATH, "test5.h"), + os.path.join(STUBS_PATH, "test6.h") + ] + for file_path in file_paths: + with open(file_path, "w") as new_file: + if file_path in [os.path.join(STUBS_PATH, "test3.h")]: + new_file.write(HEADER_WITHOUT_SPDX) + elif file_path in [os.path.join(STUBS_PATH, "test6.h")]: + new_file.write(HEADER_WITH_BINARY_LICENSE) + else: + new_file.write(HEADER_WITH_SPDX) + yield + for file_path in file_paths: + os.remove(file_path) + + +class TestScancodeEvaluate: + + def test_missing_files_attribute(self): + """ Missing `files` attribute in JSON. + @inputs scancode_test/scancode_test_1.json + @outputs -1 + """ + assert license_check(os.path.join(STUBS_PATH, "scancode_test_1.json")) == -1 + + def test_various_combinations_permissive_license_with_spdx(self): + """ Various combinations where at least one license in + a file is permissive and has spdx in the match.identifier + attribute. + @inputs scancode_test/scancode_test_2.json + @outputs 0 + """ + assert license_check(os.path.join(STUBS_PATH, "scancode_test_2.json")) == 0 + + def test_missing_license_permissive_license_and_spdx(self, create_scanned_files): + """ Test four files scanned with various issues. + test.h: Missing license text (error count += 1) + test3.h: Missing `Permissive` license text and `spdx` in match.identifier and not in file tested by ScanCode (error count += 1) + test4.h: Missing `Permissive` license text and `spdx` in match.identifier but found in file tested by ScanCode (error count += 1) + test5.h: Missing `spdx` in match.identifier but found in file tested by ScanCode. (error count += 0) + test6.h: Matching `spdx` in match.identifier but Permissive Binary License header (error count += 0) + @inputs scancode_test/scancode_test_2.json + @output 3 + """ + assert license_check(os.path.join(STUBS_PATH, "scancode_test_3.json")) == 3 + + def test_permissive_license_no_spdx(self, create_scanned_files): + """ Multiple `Permissive` licenses in one file but none with `spdx` in + match.identifier and not in file tested by ScanCode (error count += 0) + @inputs scancode_test/scancode_test_2.json + @outputs 0 + """ + assert license_check(os.path.join(STUBS_PATH, "scancode_test_4.json")) == 0 \ No newline at end of file diff --git a/tools/test/ci/scancode_test/scancode_test_1.json b/tools/test/ci/scancode_test/scancode_test_1.json new file mode 100644 index 0000000..4810c61 --- /dev/null +++ b/tools/test/ci/scancode_test/scancode_test_1.json @@ -0,0 +1,7 @@ +{ + "headers": [ + { + "tool_name": "scancode test fail" + } + ] +} diff --git a/tools/test/ci/scancode_test/scancode_test_2.json b/tools/test/ci/scancode_test/scancode_test_2.json new file mode 100644 index 0000000..6ed5948 --- /dev/null +++ b/tools/test/ci/scancode_test/scancode_test_2.json @@ -0,0 +1,782 @@ +{ + "headers":[ + { + "tool_name":"scancode-toolkit", + "tool_version":"3.1.1", + "options":{ + "input":[ + "test.h", + "test2.h", + "test3.h", + "test4.h", + "test5.h", + "test6.h", + "test7.h", + "test8.h" + ], + "--json-pp":"scancode.json", + "--license":true + }, + "notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", + "start_timestamp":"2020-10-01T135040.106260", + "end_timestamp":"2020-10-01T135047.793497", + "message":null, + "errors":[ + + ], + "extra_data":{ + "files_count":8 + } + } + ], + "files":[ + { + "path":"tools/test/ci/scancode_test/test.h", + "type":"file", + "licenses":[ + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":2, + "end_line":2, + "matched_rule":{ + "identifier":"spdx-license-identifier: bsd-new", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":8, + "end_line":8, + "matched_rule":{ + "identifier":"bsd-new_360.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":4, + "matched_length":4, + "match_coverage":100.0, + "rule_relevance":100.0 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":11, + "end_line":11, + "matched_rule":{ + "identifier":"bsd-new_10.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100.0 + } + } + ], + "license_expressions":[ + "bsd-new", + "bsd-new", + "bsd-new" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test2.h", + "type":"file", + "licenses":[ + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":2, + "end_line":2, + "matched_rule":{ + "identifier":"spdx-license-identifier: bsd-new", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":8, + "end_line":8, + "matched_rule":{ + "identifier":"bsd-new_360.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":4, + "matched_length":4, + "match_coverage":100.0, + "rule_relevance":100.0 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":11, + "end_line":11, + "matched_rule":{ + "identifier":"bsd-new_10.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100.0 + } + } + ], + "license_expressions":[ + "bsd-new", + "bsd-new", + "bsd-new" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test3.h", + "type":"file", + "licenses":[ + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":2, + "end_line":2, + "matched_rule":{ + "identifier":"spdx-license-identifier: bsd-new", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":8, + "end_line":8, + "matched_rule":{ + "identifier":"bsd-new_360.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":4, + "matched_length":4, + "match_coverage":100.0, + "rule_relevance":100.0 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":11, + "end_line":11, + "matched_rule":{ + "identifier":"bsd-new_10.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100.0 + } + } + ], + "license_expressions":[ + "bsd-new", + "bsd-new", + "bsd-new" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test4.h", + "type":"file", + "licenses":[ + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":2, + "end_line":2, + "matched_rule":{ + "identifier":"spdx-license-identifier: bsd-new", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":8, + "end_line":8, + "matched_rule":{ + "identifier":"bsd-new_360.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":4, + "matched_length":4, + "match_coverage":100.0, + "rule_relevance":100.0 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":11, + "end_line":11, + "matched_rule":{ + "identifier":"bsd-new_10.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100.0 + } + } + ], + "license_expressions":[ + "bsd-new", + "bsd-new", + "bsd-new" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test5.c", + "type":"file", + "licenses":[ + { + "key":"apache-2.0", + "score":89.58, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":17, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"3-seq", + "rule_length":96, + "matched_length":86, + "match_coverage":89.58, + "rule_relevance":100.0 + } + }, + { + "key":"apache-2.0", + "score":100.0, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":5, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + } + ], + "license_expressions":[ + "apache-2.0", + "apache-2.0" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test6.c", + "type":"file", + "licenses":[ + { + "key":"apache-2.0", + "score":89.58, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":17, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"3-seq", + "rule_length":96, + "matched_length":86, + "match_coverage":89.58, + "rule_relevance":100.0 + } + }, + { + "key":"apache-2.0", + "score":100.0, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":5, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + } + ], + "license_expressions":[ + "apache-2.0", + "apache-2.0" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test7.c", + "type":"file", + "licenses":[ + { + "key":"apache-2.0", + "score":89.58, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":17, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"3-seq", + "rule_length":96, + "matched_length":86, + "match_coverage":89.58, + "rule_relevance":100.0 + } + }, + { + "key":"apache-2.0", + "score":100.0, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":5, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + } + ], + "license_expressions":[ + "apache-2.0", + "apache-2.0" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test8.c", + "type":"file", + "licenses":[ + { + "key":"apache-2.0", + "score":89.58, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":17, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"3-seq", + "rule_length":96, + "matched_length":86, + "match_coverage":89.58, + "rule_relevance":100.0 + } + }, + { + "key":"apache-2.0", + "score":100.0, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":5, + "end_line":5, + "matched_rule":{ + "identifier":"spdx-license-identifier: apache-2.0", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + } + ], + "license_expressions":[ + "apache-2.0", + "apache-2.0" + ], + "scan_errors":[ + + ] + } + ] +} diff --git a/tools/test/ci/scancode_test/scancode_test_3.json b/tools/test/ci/scancode_test/scancode_test_3.json new file mode 100644 index 0000000..01dcbe2 --- /dev/null +++ b/tools/test/ci/scancode_test/scancode_test_3.json @@ -0,0 +1,220 @@ +{ + "headers":[ + { + "tool_name":"scancode-toolkit", + "tool_version":"3.1.1", + "options":{ + "input":[ + "tools/test/ci/scancode_test/test.h", + "tools/test/ci/scancode_test/test2.h", + "tools/test/ci/scancode_test/test3.h", + "tools/test/ci/scancode_test/test4.h", + "tools/test/ci/scancode_test/test5.h" + ], + "--json-pp":"scancode.json", + "--license":true + }, + "notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", + "start_timestamp":"2020-10-01T135040.106260", + "end_timestamp":"2020-10-01T135047.793497", + "message":null, + "errors":[ + + ], + "extra_data":{ + "files_count":5 + } + } + ], + "files":[ + { + "path":"tools/test/ci/scancode_test/test.h", + "type":"file", + "licenses":[ + + ], + "license_expressions":[ + + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test3.h", + "type":"file", + "licenses":[ + { + "key":"proprietary-license", + "score":77.0, + "name":"Proprietary License", + "short_name":"Proprietary License", + "category":"Proprietary Free", + "is_exception":false, + "owner":"Unspecified", + "homepage_url":null, + "text_url":"", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:proprietary-license", + "spdx_license_key":null, + "spdx_url":"", + "start_line":2, + "end_line":3, + "matched_rule":{ + "identifier":"proprietary_12.RULE", + "license_expression":"proprietary-license", + "licenses":[ + "proprietary-license" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":14, + "matched_length":14, + "match_coverage":100.0, + "rule_relevance":77 + } + } + ], + "license_expressions":[ + "proprietary-license" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test4.h", + "type":"file", + "licenses":[ + { + "key":"proprietary-license", + "score":77.0, + "name":"Proprietary License", + "short_name":"Proprietary License", + "category":"Proprietary Free", + "is_exception":false, + "owner":"Unspecified", + "homepage_url":null, + "text_url":"", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:proprietary-license", + "spdx_license_key":null, + "spdx_url":"", + "start_line":2, + "end_line":3, + "matched_rule":{ + "identifier":"proprietary_12.RULE", + "license_expression":"proprietary-license", + "licenses":[ + "proprietary-license" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":14, + "matched_length":14, + "match_coverage":100.0, + "rule_relevance":77 + } + } + ], + "license_expressions":[ + "proprietary-license" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test5.h", + "type":"file", + "licenses":[ + { + "key":"apache-2.0", + "score":100.0, + "name":"Apache License 2.0", + "short_name":"Apache 2.0", + "category":"Permissive", + "is_exception":false, + "owner":"Apache Software Foundation", + "homepage_url":"http://www.apache.org/licenses/", + "text_url":"http://www.apache.org/licenses/LICENSE-2.0", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", + "spdx_license_key":"Apache-2.0", + "spdx_url":"https://spdx.org/licenses/Apache-2.0", + "start_line":4, + "end_line":14, + "matched_rule":{ + "identifier":"apache-2.0_7.RULE", + "license_expression":"apache-2.0", + "licenses":[ + "apache-2.0" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":85, + "matched_length":85, + "match_coverage":100.0, + "rule_relevance":100 + } + } + ], + "license_expressions":[ + "apache-2.0" + ], + "scan_errors":[ + + ] + }, + { + "path":"tools/test/ci/scancode_test/test6.h", + "type":"file", + "licenses":[ + { + "key": "unknown-spdx", + "score": 100.0, + "name": "Unknown SPDX license detected but not recognized", + "short_name": "unknown SPDX", + "category": "Unstated License", + "is_exception": false, + "owner": "Unspecified", + "homepage_url": null, + "text_url": "", + "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:unknown-spdx", + "spdx_license_key": null, + "spdx_url": "", + "start_line": 3, + "end_line": 3, + "matched_rule": { + "identifier": "spdx-license-identifier: unknown-spdx", + "license_expression": "unknown-spdx", + "licenses": [ + "unknown-spdx" + ], + "is_license_text": false, + "is_license_notice": false, + "is_license_reference": false, + "is_license_tag": true, + "matcher": "1-spdx-id", + "rule_length": 1, + "matched_length": 1, + "match_coverage": 100.0, + "rule_relevance": 100 + } + } + ], + "license_expressions":[ + "unknown-spdx" + ], + "scan_errors":[ + + ] + } + ] +} diff --git a/tools/test/ci/scancode_test/scancode_test_4.json b/tools/test/ci/scancode_test/scancode_test_4.json new file mode 100644 index 0000000..e17537b --- /dev/null +++ b/tools/test/ci/scancode_test/scancode_test_4.json @@ -0,0 +1,170 @@ +{ + "headers":[ + { + "tool_name":"scancode-toolkit", + "tool_version":"3.1.1", + "options":{ + "input":[ + "test4.h" + ], + "--json-pp":"scancode.json", + "--license":true + }, + "notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", + "start_timestamp":"2020-10-01T135040.106260", + "end_timestamp":"2020-10-01T135047.793497", + "message":null, + "errors":[ + + ], + "extra_data":{ + "files_count":1 + } + } + ], + "files":[ + { + "path":"tools/test/ci/scancode_test/test3.h", + "type":"file", + "licenses":[ + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":2, + "end_line":2, + "matched_rule":{ + "identifier":"sprdx-license-identifier: bsd-new", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":false, + "is_license_tag":true, + "matcher":"1-spdx-id", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":8, + "end_line":8, + "matched_rule":{ + "identifier":"bsd-new_360.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":4, + "matched_length":4, + "match_coverage":100.0, + "rule_relevance":100.0 + } + }, + { + "key":"elastic-license-2018", + "score":72.22, + "name":"Elastic License Agreement 2018", + "short_name":"Elastic License 2018", + "category":"Source-available", + "is_exception":false, + "owner":"Elastic", + "homepage_url":"https://github.com/elastic/elasticsearch/blob/0d8aa7527e242fbda9d84867ab8bc955758eebce/licenses/ELASTIC-LICENSE.txt", + "text_url":"https://github.com/elastic/elasticsearch/blob/0d8aa7527e242fbda9d84867ab8bc955758eebce/licenses/ELASTIC-LICENSE.txt", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:elastic-license-2018", + "spdx_license_key":null, + "spdx_url":"", + "start_line":9, + "end_line":10, + "matched_rule":{ + "identifier":"elastic_1.RULE", + "license_expression":"elastic-license-2018", + "licenses":[ + "elastic-license-2018" + ], + "is_license_text":false, + "is_license_notice":true, + "is_license_reference":false, + "is_license_tag":false, + "matcher":"3-seq", + "rule_length":18, + "matched_length":13, + "match_coverage":72.22, + "rule_relevance":100.0 + } + }, + { + "key":"bsd-new", + "score":100.0, + "name":"BSD-3-Clause", + "short_name":"BSD-3-Clause", + "category":"Permissive", + "is_exception":false, + "owner":"Regents of the University of California", + "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", + "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", + "spdx_license_key":"BSD-3-Clause", + "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", + "start_line":11, + "end_line":11, + "matched_rule":{ + "identifier":"bsd-new_10.RULE", + "license_expression":"bsd-new", + "licenses":[ + "bsd-new" + ], + "is_license_text":false, + "is_license_notice":false, + "is_license_reference":true, + "is_license_tag":false, + "matcher":"2-aho", + "rule_length":3, + "matched_length":3, + "match_coverage":100.0, + "rule_relevance":100.0 + } + } + ], + "license_expressions":[ + "bsd-new", + "bsd-new", + "elastic-license-2018", + "bsd-new" + ], + "scan_errors":[ + + ] + } + ] +} diff --git a/tools/test/travis-ci/doxy-spellchecker/en.dat b/tools/test/travis-ci/doxy-spellchecker/en.dat deleted file mode 100644 index ec2555e..0000000 --- a/tools/test/travis-ci/doxy-spellchecker/en.dat +++ /dev/null @@ -1,6 +0,0 @@ -name en -charset iso8859-1 -soundslike en -affix en -special ' -*- 0 *** 1 *** 2 *** 3 *** 4 *** 5 *** 6 *** 7 *** 8 *** 9 *** < *** > *** _ *** -#repl-table en_affix.dat diff --git a/tools/test/travis-ci/doxy-spellchecker/en_affix.dat b/tools/test/travis-ci/doxy-spellchecker/en_affix.dat deleted file mode 100644 index e753407..0000000 --- a/tools/test/travis-ci/doxy-spellchecker/en_affix.dat +++ /dev/null @@ -1,226 +0,0 @@ -# -# This affix file is based on Ispell, which is under the following -# copyright: -# -# Copyright 1992, 1993, 1999, 2000, 2001, Geoff Kuenning, Claremont, CA -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions, and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. All modifications to the source code must be clearly marked as -# such. Binary redistributions based on modified source code -# must be clearly marked as modified versions in the documentation -# and/or other materials provided with the distribution. -# (Clause 4 removed with permission from Geoff Kuenning.) -# 5. The name of Geoff Kuenning may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS 'AS IS' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# - -SET ISO8859-1 -TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ' - -PFX A Y 1 -PFX A 0 re . - -PFX I Y 1 -PFX I 0 in . - -PFX U Y 1 -PFX U 0 un . - -PFX C Y 1 -PFX C 0 de . - -PFX E Y 1 -PFX E 0 dis . - -PFX F Y 1 -PFX F 0 con . - -PFX K Y 1 -PFX K 0 pro . - -SFX V N 2 -SFX V e ive e -SFX V 0 ive [^e] - -SFX N Y 3 -SFX N e ion e -SFX N y ication y -SFX N 0 en [^ey] - -SFX X Y 3 -SFX X e ions e -SFX X y ications y -SFX X 0 ens [^ey] - -SFX H N 2 -SFX H y ieth y -SFX H 0 th [^y] - -SFX Y Y 1 -SFX Y 0 ly . - -SFX G Y 2 -SFX G e ing e -SFX G 0 ing [^e] - -SFX J Y 2 -SFX J e ings e -SFX J 0 ings [^e] - -SFX D Y 4 -SFX D 0 d e -SFX D y ied [^aeiou]y -SFX D 0 ed [^ey] -SFX D 0 ed [aeiou]y - -SFX T N 4 -SFX T 0 st e -SFX T y iest [^aeiou]y -SFX T 0 est [aeiou]y -SFX T 0 est [^ey] - -SFX R Y 4 -SFX R 0 r e -SFX R y ier [^aeiou]y -SFX R 0 er [aeiou]y -SFX R 0 er [^ey] - -SFX Z Y 4 -SFX Z 0 rs e -SFX Z y iers [^aeiou]y -SFX Z 0 ers [aeiou]y -SFX Z 0 ers [^ey] - -SFX S Y 4 -SFX S y ies [^aeiou]y -SFX S 0 s [aeiou]y -SFX S 0 es [sxzh] -SFX S 0 s [^sxzhy] - -SFX P Y 3 -SFX P y iness [^aeiou]y -SFX P 0 ness [aeiou]y -SFX P 0 ness [^y] - -SFX M Y 1 -SFX M 0 's . - -SFX B Y 3 -SFX B 0 able [^aeiou] -SFX B 0 able ee -SFX B e able [^aeiou]e - -SFX L Y 1 -SFX L 0 ment . - -REP 88 -REP a ei -REP ei a -REP a ey -REP ey a -REP ai ie -REP ie ai -REP are air -REP are ear -REP are eir -REP air are -REP air ere -REP ere air -REP ere ear -REP ere eir -REP ear are -REP ear air -REP ear ere -REP eir are -REP eir ere -REP ch te -REP te ch -REP ch ti -REP ti ch -REP ch tu -REP tu ch -REP ch s -REP s ch -REP ch k -REP k ch -REP f ph -REP ph f -REP gh f -REP f gh -REP i igh -REP igh i -REP i uy -REP uy i -REP i ee -REP ee i -REP j di -REP di j -REP j gg -REP gg j -REP j ge -REP ge j -REP s ti -REP ti s -REP s ci -REP ci s -REP k cc -REP cc k -REP k qu -REP qu k -REP kw qu -REP o eau -REP eau o -REP o ew -REP ew o -REP oo ew -REP ew oo -REP ew ui -REP ui ew -REP oo ui -REP ui oo -REP ew u -REP u ew -REP oo u -REP u oo -REP u oe -REP oe u -REP u ieu -REP ieu u -REP ue ew -REP ew ue -REP uff ough -REP oo ieu -REP ieu oo -REP ier ear -REP ear ier -REP ear air -REP air ear -REP w qu -REP qu w -REP z ss -REP ss z -REP shun tion -REP shun sion -REP shun cion diff --git a/tools/test/travis-ci/doxy-spellchecker/en_phonet.dat b/tools/test/travis-ci/doxy-spellchecker/en_phonet.dat deleted file mode 100644 index 3987f9c..0000000 --- a/tools/test/travis-ci/doxy-spellchecker/en_phonet.dat +++ /dev/null @@ -1 +0,0 @@ -version 1.1 diff --git a/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws b/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws deleted file mode 100644 index fbc768b..0000000 --- a/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws +++ /dev/null @@ -1,125 +0,0 @@ -personal_ws-1.1 en 1600 utf-8 -_code_ -unconfigured -mbed -rtos -malloc -mutex -tx -rx -wi -fi -rr -sd -pc -vtable -nmemb -relloc -printf -arg -scanf -fclose -fputs -usb -or'd -MMmmpp -multithread -multithreaded -initializer -lookup -startup -unreferenced -singleshot -multishot -inlined -allocator -parameterized -XORed -unbuffered -sizeof -stringification -interoperability -memcpy -nack -mbit -retval -dequeue -assertation -destructor -destructors -constructor -constructors -ctor -dtor -dereference -ptr -templated -templatize -accessor -init -deleters -decrement -increment -deinitialize -deinitializes -atomicity -pointee -entrancy -Systick -noop -deassert -deasserts -deasserted -getter -setter -preallocated -excludable -ascii -IPv -param -struct -typedef -typedefs -onboard -enum -endian -emac -emacs -json -noncopyable -sendto -gethostbyname -multicast -multicasts -singleshot -multishot -sa -tparam -retarget -TCPSocket -UDPSocket -Socket -unregister -deinit -auth -pppapi -pbuf -nak -reqs -xmit -pppd -pppdebug -ppp -api -uart -chrono -Hinnant -Vin -Vref -ssid -instantiation -instantiations -KVStore -_doxy_ -nothrow -conf diff --git a/tools/test/travis-ci/doxy-spellchecker/spell.sh b/tools/test/travis-ci/doxy-spellchecker/spell.sh deleted file mode 100755 index 4296852..0000000 --- a/tools/test/travis-ci/doxy-spellchecker/spell.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash -eu -# mbed Microcontroller Library -# Copyright (c) 2018 ARM Limited -# SPDX-License-Identifier: Apache-2.0 - -set -o pipefail - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -ERRORS=0 - -# Loops use here strings to allow them to run in the main shell and modify the correct version of -# the error counter global variable -while read file; do - echo "${file}" - res=$(awk '/\/\*\*/,/\*\//' "${file}" | cut -d '/' -f2 | sed 's/0x[^ ]*//' | sed 's/[0-9]*//g') - - # Select a token to begin on, then a formating option such as strip all text between the start - # and end token, strip an entire line containing the start token, or strip a portion of a line - # containing the start token. Select an appropiate end token. The tokens and formats are index - # matched. - start_tokens=( "/@code" - "/addtogroup" - "ingroup" - "defgroup" - "<" - "()" - ) - - formats=( 'strip_between' - 'strip_between' - 'strip_line' - 'strip_line' - 'strip_between_sameline' - 'strip_token' - ) - - end_tokens=( "/@endcode" - "/\*" - "" - "" - ">" - "" - ) - - # Stripping strings between tokens P1-P2 and P3-P4 inclusively ran into issues depending - # on if the tokens were on the same line or not. - #_________________________________________ - # Don't remove this P1 remove me P2 - # Keep me - # P3 - # Remove me too please - # P4 - # Keep me too - # Still here P1 But this shouldn't be P2 - #_________________________________________ - # - # Opted for having two separate formats. In particular this formatting issue came up when - # trying to strip the code segments and template type arguments between '<, >' as the multiline - # sed command would strip the entire line, causing the removal string to span across the entire file - # when trying to match the next end token (above format when stripping everything between P1 and P2 - # would end up with just "Don't remove this" and the rest of the file stripped). - - for ((i=0;i<${#start_tokens[@]};++i)); do - filter="" - if [[ "${formats[i]}" == 'strip_between' ]]; then - filter=$(<<< "${res}" sed "${start_tokens[i]}/,${end_tokens[i]}/d") - elif [[ "${formats[i]}" == 'strip_between_sameline' ]]; then - filter=$(<<< "${res}" sed -e "s/"${start_tokens[i]}".*"${end_tokens[i]}"//") - elif [[ "${formats[i]}" == 'strip_line' ]]; then - filter=$(<<< "${res}" sed "/"${start_tokens[i]}"/ d") - elif [[ "${formats[i]}" == 'strip_token' ]]; then - filter=$(<<< "${res}" sed "s/"${start_tokens[i]}"//g") - fi - - if [ "${filter}" != "" ]; then - res=${filter} - fi - done - - if [ "${2:-}" == "-vv" ]; then - echo "${res}" - fi - - prev_err=("") - while read err; do - if [ $(echo "${res}" | grep "${err}" | wc -l) -eq $(grep "${err}" "${file}" | wc -l) ]; then - # Do not count all caps words as errors (RTOS, WTI, etc) or plural versions (APNs/MTD's) - if ! [[ ${err} =~ ^[A-Z]+$ || ${err} =~ ^[A-Z]+s$ || ${err} =~ ^[A-Z]+\'s$ ]]; then - - # Disregard camelcase/underscored words. Hex was stripped at the beginning - if ! echo "${err}" | grep --quiet -E '[a-z]{1,}[A-Z]|_'; then - - # The grep command to fetch the line numbers will report all instances, do not - # list repeated error words found from aspell in each file - if ! [[ ${prev_err[*]} =~ "${err}" ]]; then - prev_err+=("${err}") - - if [ ${#prev_err[@]} -eq 2 ]; then - echo "=================================" - echo "Errors: " - fi - - while read ln; do - echo "${ln} ${err}" - ERRORS=$((ERRORS + 1)) - done <<< "$(grep -n "${err}" "${file}" | cut -d ' ' -f1)" - fi - fi - fi - fi - done <<< "$(echo "${res}" | aspell list -C --ignore-case -p "${DIR}"/ignore.en.pws --local-data-dir "${DIR}")" - - if [ ${#prev_err[@]} -ne 1 ]; then - echo "_________________________________" - fi - -# ${1}: directory to check -# ${2}: file containing a list of paths (regex) to exclude -done < <(find "${1}" -type d -iname "*target*" -prune -o -name '*.h' -print | grep -v -f "${2}") - -echo "----------------------------------------------------------------------------------" -echo "Total Errors Found: ${ERRORS}" - -if [ ${ERRORS} -ne 0 ]; then - echo "If any of the failed words should be considered valid please add them to the ignore.en.pws file"\ - "found in tools/test/travis-ci/doxy-spellchecker between the _code_ and _doxy_ tags." - exit 1 -fi diff --git a/tools/test/travis-ci/functions.sh b/tools/test/travis-ci/functions.sh deleted file mode 100644 index 91b588a..0000000 --- a/tools/test/travis-ci/functions.sh +++ /dev/null @@ -1,213 +0,0 @@ -#!/bin/bash -euf -# -# Copyright (c) 2013-2018 Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the License); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an AS IS BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o pipefail - - -# -# Helper functions for printing status information. -# Uses 'echo' instead of 'printf' due to Travis CI stdout sync issues. -# -info() { echo -e "I: ${1}"; } -die() { echo -e "E: ${1}" 1>&2; exit "${2:-1}"; } - - -# -# Sets the GitHub job status for a given commit. -# -set_status() -{ - local job_name="${NAME}" - local payload="" - - payload=$(<<< " - { - 'state': '${1}', - 'description': '${2}', - 'context': 'travis-ci/${job_name}', - 'target_url': 'https://travis-ci.org/${TRAVIS_REPO_SLUG}/jobs/${TRAVIS_JOB_ID}' - }" tr "'" '"') - - curl --silent --output /dev/null --user "${MBED_BOT}" --request POST \ - "https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA:-${TRAVIS_COMMIT}}" \ - --data @- <<< "${payload}" -} - - -# -# Sources a pre-compiled GCC installation from AWS, installing the archive by -# extracting and prepending the executable directory to PATH. -# Ccache is enabled for `arm-none-eabi-`. -# -# Note: Expects 'deps_url' and 'deps_dir' to already be defined. -# -_install_gcc_and_ccache() -{ - # Enable Ccache in Travis - ccache -o compiler_check=content - ccache -M 1G - pushd /usr/lib/ccache - sudo ln -s ../../bin/ccache arm-none-eabi-gcc - sudo ln -s ../../bin/ccache arm-none-eabi-g++ - export "PATH=/usr/lib/ccache:${PATH}" - popd - - # Legacy Mbed build tool passes a new time stamp in commmand line argument - # every time mbed-os is built. This causes ccache cache miss. But there is a - # provision to read the time stamp from environment variable - # (MBED_BUILD_TIMESTAMP). Setting this variable to a fixed value improves - # ccache cache hits. - export "MBED_BUILD_TIMESTAMP=0" - - # Ignore shellcheck warnings: Variables defined in .travis.yml - # shellcheck disable=SC2154 - local url="${deps_url}/gcc9-linux.tar.bz2" - - # shellcheck disable=SC2154 - local gcc_path="${deps_dir}/gcc/gcc-arm-none-eabi-9-2019-q4-major" - - local archive="gcc.tar.bz2" - - info "URL: ${url}" - - if [ ! -d "${deps_dir}/gcc" ]; then - - info "Downloading archive" - curl --location "${url}" --output "${deps_dir}/${archive}" - ls -al "${deps_dir}" - - info "Extracting 'gcc'" - mkdir -p "${deps_dir}/gcc" - tar -xf "${deps_dir}/${archive}" -C "${deps_dir}/gcc" - rm "${deps_dir}/${archive}" - - fi - - info "Installing 'gcc'" - export "PATH=${PATH}:${gcc_path}/bin" -} - - -# -# Downloads a list of packages from AWS, really fast. -# -_fetch_deps() -{ - local pkg="${1}" - local dep_list="${2}" - local pid_list="" - - local PID; - - info "Fetching '${pkg}' archives" - - while read -r dep; do - - curl --location "${deps_url}/${dep}.deb" \ - --output "${deps_dir}/${dep}.deb" \ - || die "Download failed ('${dep}')" \ - && info "Fetched ${deps_url}/${dep}.deb" & - - PID=$! - pid_list="${pid_list} ${PID}" - - done <<< "${dep_list}" - - # Ignoring shellcheck warning, since we need to allow parameter expansion to - # turn the list string into parametesr. - # shellcheck disable=SC2086 - wait ${pid_list} - - info "Fetch completed." -} - - -# -# Installs a list of Debian packages, fetching them if not locally found. -# -_install_deps() -{ - local pkg="${1}" - local dep_list="${2}" - local first_dep="" - - # Assume that if the first package isn't cached, none are. - first_dep=$(<<< "${dep_list}" head -n1) - [ ! -f "${deps_dir}/${first_dep}.deb" ] && _fetch_deps "${pkg}" "${dep_list}" - - # Install dependencies - info "Installing '${pkg}' packages" - - # Ignore shellcheck warnings: Word splitting is specifically used to build - # command in one go, and expression non-expansion - # is intentional. - # shellcheck disable=SC2046 disable=SC2016 - sudo dpkg -i $(<<< "${dep_list}" sed -e 's_^ *__' -e 's_^\(.*\)$_'"${deps_dir}"'/\1.deb_' | tr $'\n' ' ') -} - - -# -# Wrapper for installing a given package. -# -source_pkg() -{ - # Debian dependencies needed for a single package. - local aspell_deps="aspell - aspell-en - dictionaries-common - libaspell15" - - local libfuse_deps="libfuse-dev - libpcre3-dev - libpcre32-3 - libpcrecpp0v5 - libselinux1-dev - libsepol1-dev - libc-bin" - - local pkg="${1}" - - case "${pkg}" in - - "fuse" ) - # 'fuse' does not require an 'apt-get update' to install in Travis CI, so - # there's no reason to upload it or its dependencies into AWS. - sudo apt-get -o=dir::cache="${deps_dir}/apt-get" install fuse \ - || die "Installation failed" - ;; - - "aspell" ) - _install_deps aspell "${aspell_deps}" \ - || die "Installation failed" - ;; - "libfuse-dev" ) - _install_deps libfuse-dev "${libfuse_deps}" \ - || die "Installation failed" - ;; - - "gcc" ) - _install_gcc_and_ccache \ - || die "Installation failed" - ;; - - * ) - die "Package not supported: '${pkg}'" - ;; - - esac -} diff --git a/tools/test/travis-ci/scancode-evaluate.py b/tools/test/travis-ci/scancode-evaluate.py deleted file mode 100644 index e650fc9..0000000 --- a/tools/test/travis-ci/scancode-evaluate.py +++ /dev/null @@ -1,182 +0,0 @@ -""" -SPDX-License-Identifier: Apache-2.0 - -Copyright (c) 2020 Arm Limited. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations -""" - -import argparse -import json -import logging -import os.path -import re -import sys -from enum import Enum - -MISSING_LICENSE_TEXT = "Missing license header" -MISSING_PERMISSIVE_LICENSE_TEXT = "Non-permissive license" -MISSING_SPDX_TEXT = "Missing SPDX license identifier" - -userlog = logging.getLogger("scancode-evaluate") - - -class ReturnCode(Enum): - """Return codes.""" - - SUCCESS = 0 - ERROR = -1 - - -def init_logger(): - """Initialise the logger.""" - userlog.setLevel(logging.INFO) - userlog.addHandler( - logging.FileHandler( - os.path.join(os.getcwd(), 'scancode-evaluate.log'), mode='w' - ) - ) - - -def path_leaf(path): - """Return the leaf of a path.""" - head, tail = os.path.split(path) - # Ensure the correct file name is returned if the file ends with a slash - return tail or os.path.basename(head) - - -def has_permissive_text_in_scancode_output(scancode_output_data_file_licenses): - """Returns true if at least one license in the scancode output is permissive""" - return any( - scancode_output_data_file_license['category'] == 'Permissive' - for scancode_output_data_file_license in scancode_output_data_file_licenses - ) - - -def has_spdx_text_in_scancode_output(scancode_output_data_file_licenses): - """Returns true if at least one license in the scancode output has the spdx identifier.""" - return any( - 'spdx' in scancode_output_data_file_license['matched_rule']['identifier'] - for scancode_output_data_file_license in scancode_output_data_file_licenses - ) - - -def has_spdx_text_in_analysed_file(scanned_file_content): - """Returns true if the file analysed by ScanCode contains SPDX identifier.""" - return bool(re.findall("SPDX-License-Identifier:?", scanned_file_content)) - - -def has_binary_license(scanned_file_content): - """Returns true if the file analysed by ScanCode contains a Permissive Binary License.""" - return bool(re.findall("Permissive Binary License", scanned_file_content)) - - -def get_file_text(scancode_output_data_file): - """Returns file text for scancode output file""" - file_path = os.path.abspath(scancode_output_data_file['path']) - try: - with open(file_path, 'r') as read_file: - return read_file.read() - except UnicodeDecodeError: - userlog.warning("Unable to decode file text in: %s" % file_path) - # Ignore files that cannot be decoded - - -def license_check(scancode_output_path): - """Check licenses in the scancode json file for specified directory. - - This function does not verify if file exists, should be done prior the call. - - Args: - scancode_output_path: path to the scancode json output file (output from scancode --license --json-pp) - - Returns: - 0 if nothing found - >0 - count how many license issues found - ReturnCode.ERROR.value if any error in file licenses found - """ - - license_offenders = [] - spdx_offenders = [] - try: - with open(scancode_output_path, 'r') as read_file: - scancode_output_data = json.load(read_file) - except json.JSONDecodeError as jex: - userlog.warning("JSON could not be decoded, Invalid JSON in body: %s", jex) - return ReturnCode.ERROR.value - - if 'files' not in scancode_output_data: - userlog.warning("Missing `files` attribute in %s" % (scancode_output_path)) - return ReturnCode.ERROR.value - - for scancode_output_data_file in scancode_output_data['files']: - if scancode_output_data_file['type'] != 'file': - continue - - if not scancode_output_data_file['licenses']: - scancode_output_data_file['fail_reason'] = MISSING_LICENSE_TEXT - license_offenders.append(scancode_output_data_file) - # check the next file in the scancode output - continue - - if not has_permissive_text_in_scancode_output(scancode_output_data_file['licenses']): - scanned_file_content = get_file_text(scancode_output_data_file) - if not (scanned_file_content and has_binary_license(scanned_file_content)): - scancode_output_data_file['fail_reason'] = MISSING_PERMISSIVE_LICENSE_TEXT - license_offenders.append(scancode_output_data_file) - - if not has_spdx_text_in_scancode_output(scancode_output_data_file['licenses']): - # Scancode does not recognize license notice in Python file headers. - # Issue: https://github.com/nexB/scancode-toolkit/issues/1913 - # Therefore check if the file tested by ScanCode actually has a licence notice. - scanned_file_content = get_file_text(scancode_output_data_file) - - if not scanned_file_content: - continue - elif not has_spdx_text_in_analysed_file(scanned_file_content): - scancode_output_data_file['fail_reason'] = MISSING_SPDX_TEXT - spdx_offenders.append(scancode_output_data_file) - - if license_offenders: - userlog.warning("Found files with missing license details, please review and fix") - for offender in license_offenders: - userlog.warning("File: %s reason: %s" % (path_leaf(offender['path']), offender['fail_reason'])) - if spdx_offenders: - userlog.warning("Found files with missing SPDX identifier, please review and fix") - for offender in spdx_offenders: - userlog.warning("File: %s reason: %s" % (path_leaf(offender['path']), offender['fail_reason'])) - return len(license_offenders) - - -def parse_args(): - """Parse command line arguments.""" - parser = argparse.ArgumentParser(description="License check.") - parser.add_argument( - 'scancode_output_path', - help="scancode-toolkit output json file" - ) - return parser.parse_args() - - -if __name__ == "__main__": - init_logger() - args = parse_args() - if os.path.isfile(args.scancode_output_path): - sys.exit( - ReturnCode.SUCCESS.value - if license_check(args.scancode_output_path) == 0 - else ReturnCode.ERROR.value - ) - else: - userlog.warning("Could not find the scancode json file") - sys.exit(ReturnCode.ERROR.value) diff --git a/tools/test/travis-ci/scancode_evaluate_test.py b/tools/test/travis-ci/scancode_evaluate_test.py deleted file mode 100644 index dc5b8fb..0000000 --- a/tools/test/travis-ci/scancode_evaluate_test.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2020 Arm Limited and Contributors. All rights reserved. -# -# SPDX-License-Identifier: Apache-2.0 -import importlib -import os -import pytest - -license_check = importlib.import_module("scancode-evaluate").license_check - -STUBS_PATH = os.path.join( - os.path.abspath(os.path.join(os.path.dirname(__file__))), "scancode_test" -) - -HEADER_WITHOUT_SPDX = "/* Copyright (C) Arm Limited, Inc - All Rights Reserved\ - * Unauthorized copying of this. file, via any medium is strictly prohibited\ - * Proprietary and confidential\ - */" - -HEADER_WITH_SPDX = "/* mbed Microcontroller Library\ - * Copyright (c) 2006-2013 ARM Limited\ - *\ - * SPDX-License-Identifier: Apache-2.0\ - * Licensed under the Apache License, Version 2.0 (the \"License\");\ - * you may not use this file except in compliance with the License.\ - * You may obtain a copy of the License at\ - *\ - * http://www.apache.org/licenses/LICENSE-2.0\ - *\ - * Unless required by applicable law or agreed to in writing, software\ - * distributed under the License is distributed on an \"AS IS\" BASIS,\ - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\ - * See the License for the specific language governing permissions and\ - * limitations under the License.\ - */" - -HEADER_WITH_BINARY_LICENSE = "/*\ - * Copyright (c) 2019, Arm Limited, All Rights Reserved\ - * SPDX-License-Identifier: LicenseRef-PBL\ - *\ - * This file and the related binary are licensed under the\ - * Permissive Binary License, Version 1.0 (the \"License\");\ - * you may not use these files except in compliance with the License.\ - *\ - */" - -@pytest.fixture() -def create_scanned_files(): - """Create stub files. - test3.h missing license notice - test4.h with license notice - test5.h with license notice - test6.h with permissive binary license - """ - file_paths = [ - os.path.join(STUBS_PATH, "test3.h"), - os.path.join(STUBS_PATH, "test4.h"), - os.path.join(STUBS_PATH, "test5.h"), - os.path.join(STUBS_PATH, "test6.h") - ] - for file_path in file_paths: - with open(file_path, "w") as new_file: - if file_path in [os.path.join(STUBS_PATH, "test3.h")]: - new_file.write(HEADER_WITHOUT_SPDX) - elif file_path in [os.path.join(STUBS_PATH, "test6.h")]: - new_file.write(HEADER_WITH_BINARY_LICENSE) - else: - new_file.write(HEADER_WITH_SPDX) - yield - for file_path in file_paths: - os.remove(file_path) - - -class TestScancodeEvaluate: - - def test_missing_files_attribute(self): - """ Missing `files` attribute in JSON. - @inputs scancode_test/scancode_test_1.json - @outputs -1 - """ - assert license_check(os.path.join(STUBS_PATH, "scancode_test_1.json")) == -1 - - def test_various_combinations_permissive_license_with_spdx(self): - """ Various combinations where at least one license in - a file is permissive and has spdx in the match.identifier - attribute. - @inputs scancode_test/scancode_test_2.json - @outputs 0 - """ - assert license_check(os.path.join(STUBS_PATH, "scancode_test_2.json")) == 0 - - def test_missing_license_permissive_license_and_spdx(self, create_scanned_files): - """ Test four files scanned with various issues. - test.h: Missing license text (error count += 1) - test3.h: Missing `Permissive` license text and `spdx` in match.identifier and not in file tested by ScanCode (error count += 1) - test4.h: Missing `Permissive` license text and `spdx` in match.identifier but found in file tested by ScanCode (error count += 1) - test5.h: Missing `spdx` in match.identifier but found in file tested by ScanCode. (error count += 0) - test6.h: Matching `spdx` in match.identifier but Permissive Binary License header (error count += 0) - @inputs scancode_test/scancode_test_2.json - @output 3 - """ - assert license_check(os.path.join(STUBS_PATH, "scancode_test_3.json")) == 3 - - def test_permissive_license_no_spdx(self, create_scanned_files): - """ Multiple `Permissive` licenses in one file but none with `spdx` in - match.identifier and not in file tested by ScanCode (error count += 0) - @inputs scancode_test/scancode_test_2.json - @outputs 0 - """ - assert license_check(os.path.join(STUBS_PATH, "scancode_test_4.json")) == 0 \ No newline at end of file diff --git a/tools/test/travis-ci/scancode_test/scancode_test_1.json b/tools/test/travis-ci/scancode_test/scancode_test_1.json deleted file mode 100644 index 4810c61..0000000 --- a/tools/test/travis-ci/scancode_test/scancode_test_1.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "headers": [ - { - "tool_name": "scancode test fail" - } - ] -} diff --git a/tools/test/travis-ci/scancode_test/scancode_test_2.json b/tools/test/travis-ci/scancode_test/scancode_test_2.json deleted file mode 100644 index c86c33e..0000000 --- a/tools/test/travis-ci/scancode_test/scancode_test_2.json +++ /dev/null @@ -1,782 +0,0 @@ -{ - "headers":[ - { - "tool_name":"scancode-toolkit", - "tool_version":"3.1.1", - "options":{ - "input":[ - "test.h", - "test2.h", - "test3.h", - "test4.h", - "test5.h", - "test6.h", - "test7.h", - "test8.h" - ], - "--json-pp":"scancode.json", - "--license":true - }, - "notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", - "start_timestamp":"2020-10-01T135040.106260", - "end_timestamp":"2020-10-01T135047.793497", - "message":null, - "errors":[ - - ], - "extra_data":{ - "files_count":8 - } - } - ], - "files":[ - { - "path":"tools/test/travis-ci/scancode_test/test.h", - "type":"file", - "licenses":[ - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":2, - "end_line":2, - "matched_rule":{ - "identifier":"spdx-license-identifier: bsd-new", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":8, - "end_line":8, - "matched_rule":{ - "identifier":"bsd-new_360.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":4, - "matched_length":4, - "match_coverage":100.0, - "rule_relevance":100.0 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":11, - "end_line":11, - "matched_rule":{ - "identifier":"bsd-new_10.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100.0 - } - } - ], - "license_expressions":[ - "bsd-new", - "bsd-new", - "bsd-new" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test2.h", - "type":"file", - "licenses":[ - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":2, - "end_line":2, - "matched_rule":{ - "identifier":"spdx-license-identifier: bsd-new", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":8, - "end_line":8, - "matched_rule":{ - "identifier":"bsd-new_360.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":4, - "matched_length":4, - "match_coverage":100.0, - "rule_relevance":100.0 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":11, - "end_line":11, - "matched_rule":{ - "identifier":"bsd-new_10.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100.0 - } - } - ], - "license_expressions":[ - "bsd-new", - "bsd-new", - "bsd-new" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test3.h", - "type":"file", - "licenses":[ - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":2, - "end_line":2, - "matched_rule":{ - "identifier":"spdx-license-identifier: bsd-new", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":8, - "end_line":8, - "matched_rule":{ - "identifier":"bsd-new_360.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":4, - "matched_length":4, - "match_coverage":100.0, - "rule_relevance":100.0 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":11, - "end_line":11, - "matched_rule":{ - "identifier":"bsd-new_10.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100.0 - } - } - ], - "license_expressions":[ - "bsd-new", - "bsd-new", - "bsd-new" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test4.h", - "type":"file", - "licenses":[ - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":2, - "end_line":2, - "matched_rule":{ - "identifier":"spdx-license-identifier: bsd-new", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":8, - "end_line":8, - "matched_rule":{ - "identifier":"bsd-new_360.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":4, - "matched_length":4, - "match_coverage":100.0, - "rule_relevance":100.0 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":11, - "end_line":11, - "matched_rule":{ - "identifier":"bsd-new_10.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100.0 - } - } - ], - "license_expressions":[ - "bsd-new", - "bsd-new", - "bsd-new" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test5.c", - "type":"file", - "licenses":[ - { - "key":"apache-2.0", - "score":89.58, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":17, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"3-seq", - "rule_length":96, - "matched_length":86, - "match_coverage":89.58, - "rule_relevance":100.0 - } - }, - { - "key":"apache-2.0", - "score":100.0, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":5, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - } - ], - "license_expressions":[ - "apache-2.0", - "apache-2.0" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test6.c", - "type":"file", - "licenses":[ - { - "key":"apache-2.0", - "score":89.58, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":17, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"3-seq", - "rule_length":96, - "matched_length":86, - "match_coverage":89.58, - "rule_relevance":100.0 - } - }, - { - "key":"apache-2.0", - "score":100.0, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":5, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - } - ], - "license_expressions":[ - "apache-2.0", - "apache-2.0" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test7.c", - "type":"file", - "licenses":[ - { - "key":"apache-2.0", - "score":89.58, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":17, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"3-seq", - "rule_length":96, - "matched_length":86, - "match_coverage":89.58, - "rule_relevance":100.0 - } - }, - { - "key":"apache-2.0", - "score":100.0, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":5, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - } - ], - "license_expressions":[ - "apache-2.0", - "apache-2.0" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test8.c", - "type":"file", - "licenses":[ - { - "key":"apache-2.0", - "score":89.58, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":17, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"3-seq", - "rule_length":96, - "matched_length":86, - "match_coverage":89.58, - "rule_relevance":100.0 - } - }, - { - "key":"apache-2.0", - "score":100.0, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":5, - "end_line":5, - "matched_rule":{ - "identifier":"spdx-license-identifier: apache-2.0", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - } - ], - "license_expressions":[ - "apache-2.0", - "apache-2.0" - ], - "scan_errors":[ - - ] - } - ] -} diff --git a/tools/test/travis-ci/scancode_test/scancode_test_3.json b/tools/test/travis-ci/scancode_test/scancode_test_3.json deleted file mode 100644 index 5c5dc9d..0000000 --- a/tools/test/travis-ci/scancode_test/scancode_test_3.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "headers":[ - { - "tool_name":"scancode-toolkit", - "tool_version":"3.1.1", - "options":{ - "input":[ - "tools/test/travis-ci/scancode_test/test.h", - "tools/test/travis-ci/scancode_test/test2.h", - "tools/test/travis-ci/scancode_test/test3.h", - "tools/test/travis-ci/scancode_test/test4.h", - "tools/test/travis-ci/scancode_test/test5.h" - ], - "--json-pp":"scancode.json", - "--license":true - }, - "notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", - "start_timestamp":"2020-10-01T135040.106260", - "end_timestamp":"2020-10-01T135047.793497", - "message":null, - "errors":[ - - ], - "extra_data":{ - "files_count":5 - } - } - ], - "files":[ - { - "path":"tools/test/travis-ci/scancode_test/test.h", - "type":"file", - "licenses":[ - - ], - "license_expressions":[ - - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test3.h", - "type":"file", - "licenses":[ - { - "key":"proprietary-license", - "score":77.0, - "name":"Proprietary License", - "short_name":"Proprietary License", - "category":"Proprietary Free", - "is_exception":false, - "owner":"Unspecified", - "homepage_url":null, - "text_url":"", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:proprietary-license", - "spdx_license_key":null, - "spdx_url":"", - "start_line":2, - "end_line":3, - "matched_rule":{ - "identifier":"proprietary_12.RULE", - "license_expression":"proprietary-license", - "licenses":[ - "proprietary-license" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":14, - "matched_length":14, - "match_coverage":100.0, - "rule_relevance":77 - } - } - ], - "license_expressions":[ - "proprietary-license" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test4.h", - "type":"file", - "licenses":[ - { - "key":"proprietary-license", - "score":77.0, - "name":"Proprietary License", - "short_name":"Proprietary License", - "category":"Proprietary Free", - "is_exception":false, - "owner":"Unspecified", - "homepage_url":null, - "text_url":"", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:proprietary-license", - "spdx_license_key":null, - "spdx_url":"", - "start_line":2, - "end_line":3, - "matched_rule":{ - "identifier":"proprietary_12.RULE", - "license_expression":"proprietary-license", - "licenses":[ - "proprietary-license" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":14, - "matched_length":14, - "match_coverage":100.0, - "rule_relevance":77 - } - } - ], - "license_expressions":[ - "proprietary-license" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test5.h", - "type":"file", - "licenses":[ - { - "key":"apache-2.0", - "score":100.0, - "name":"Apache License 2.0", - "short_name":"Apache 2.0", - "category":"Permissive", - "is_exception":false, - "owner":"Apache Software Foundation", - "homepage_url":"http://www.apache.org/licenses/", - "text_url":"http://www.apache.org/licenses/LICENSE-2.0", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:apache-2.0", - "spdx_license_key":"Apache-2.0", - "spdx_url":"https://spdx.org/licenses/Apache-2.0", - "start_line":4, - "end_line":14, - "matched_rule":{ - "identifier":"apache-2.0_7.RULE", - "license_expression":"apache-2.0", - "licenses":[ - "apache-2.0" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":85, - "matched_length":85, - "match_coverage":100.0, - "rule_relevance":100 - } - } - ], - "license_expressions":[ - "apache-2.0" - ], - "scan_errors":[ - - ] - }, - { - "path":"tools/test/travis-ci/scancode_test/test6.h", - "type":"file", - "licenses":[ - { - "key": "unknown-spdx", - "score": 100.0, - "name": "Unknown SPDX license detected but not recognized", - "short_name": "unknown SPDX", - "category": "Unstated License", - "is_exception": false, - "owner": "Unspecified", - "homepage_url": null, - "text_url": "", - "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:unknown-spdx", - "spdx_license_key": null, - "spdx_url": "", - "start_line": 3, - "end_line": 3, - "matched_rule": { - "identifier": "spdx-license-identifier: unknown-spdx", - "license_expression": "unknown-spdx", - "licenses": [ - "unknown-spdx" - ], - "is_license_text": false, - "is_license_notice": false, - "is_license_reference": false, - "is_license_tag": true, - "matcher": "1-spdx-id", - "rule_length": 1, - "matched_length": 1, - "match_coverage": 100.0, - "rule_relevance": 100 - } - } - ], - "license_expressions":[ - "unknown-spdx" - ], - "scan_errors":[ - - ] - } - ] -} diff --git a/tools/test/travis-ci/scancode_test/scancode_test_4.json b/tools/test/travis-ci/scancode_test/scancode_test_4.json deleted file mode 100644 index 04d041c..0000000 --- a/tools/test/travis-ci/scancode_test/scancode_test_4.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "headers":[ - { - "tool_name":"scancode-toolkit", - "tool_version":"3.1.1", - "options":{ - "input":[ - "test4.h" - ], - "--json-pp":"scancode.json", - "--license":true - }, - "notice":"Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.", - "start_timestamp":"2020-10-01T135040.106260", - "end_timestamp":"2020-10-01T135047.793497", - "message":null, - "errors":[ - - ], - "extra_data":{ - "files_count":1 - } - } - ], - "files":[ - { - "path":"tools/test/travis-ci/scancode_test/test3.h", - "type":"file", - "licenses":[ - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":2, - "end_line":2, - "matched_rule":{ - "identifier":"sprdx-license-identifier: bsd-new", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":false, - "is_license_tag":true, - "matcher":"1-spdx-id", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":8, - "end_line":8, - "matched_rule":{ - "identifier":"bsd-new_360.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":4, - "matched_length":4, - "match_coverage":100.0, - "rule_relevance":100.0 - } - }, - { - "key":"elastic-license-2018", - "score":72.22, - "name":"Elastic License Agreement 2018", - "short_name":"Elastic License 2018", - "category":"Source-available", - "is_exception":false, - "owner":"Elastic", - "homepage_url":"https://github.com/elastic/elasticsearch/blob/0d8aa7527e242fbda9d84867ab8bc955758eebce/licenses/ELASTIC-LICENSE.txt", - "text_url":"https://github.com/elastic/elasticsearch/blob/0d8aa7527e242fbda9d84867ab8bc955758eebce/licenses/ELASTIC-LICENSE.txt", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:elastic-license-2018", - "spdx_license_key":null, - "spdx_url":"", - "start_line":9, - "end_line":10, - "matched_rule":{ - "identifier":"elastic_1.RULE", - "license_expression":"elastic-license-2018", - "licenses":[ - "elastic-license-2018" - ], - "is_license_text":false, - "is_license_notice":true, - "is_license_reference":false, - "is_license_tag":false, - "matcher":"3-seq", - "rule_length":18, - "matched_length":13, - "match_coverage":72.22, - "rule_relevance":100.0 - } - }, - { - "key":"bsd-new", - "score":100.0, - "name":"BSD-3-Clause", - "short_name":"BSD-3-Clause", - "category":"Permissive", - "is_exception":false, - "owner":"Regents of the University of California", - "homepage_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "text_url":"http://www.opensource.org/licenses/BSD-3-Clause", - "reference_url":"https://enterprise.dejacode.com/urn/urn:dje:license:bsd-new", - "spdx_license_key":"BSD-3-Clause", - "spdx_url":"https://spdx.org/licenses/BSD-3-Clause", - "start_line":11, - "end_line":11, - "matched_rule":{ - "identifier":"bsd-new_10.RULE", - "license_expression":"bsd-new", - "licenses":[ - "bsd-new" - ], - "is_license_text":false, - "is_license_notice":false, - "is_license_reference":true, - "is_license_tag":false, - "matcher":"2-aho", - "rule_length":3, - "matched_length":3, - "match_coverage":100.0, - "rule_relevance":100.0 - } - } - ], - "license_expressions":[ - "bsd-new", - "bsd-new", - "elastic-license-2018", - "bsd-new" - ], - "scan_errors":[ - - ] - } - ] -}