[Git][NTPsec/ntpsec][master] Set up default configuration for LGTM analysis.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Sep 2 13:49:36 UTC 2020



Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
e91d6e5c by Eric S. Raymond at 2020-09-02T09:49:32-04:00
Set up default configuration for LGTM analysis.

- - - - -


2 changed files:

- README.adoc
- + lgtm.template.yml


Changes:

=====================================
README.adoc
=====================================
@@ -22,6 +22,8 @@ README.adoc::	This file.
 
 VERSION::	The version stamp, to be used by scripts and programs.
 
+lgtm.template.yml:: Configuration file for LGTM code analysis
+
 attic/::	Directory containing source code that is *not* part of a
 		normal installation. Things can disappear from here at any
 		time.


=====================================
lgtm.template.yml
=====================================
@@ -0,0 +1,399 @@
+##########################################################################################
+# Customize file classifications.                                                        #
+# Results from files under any classifier will be excluded from LGTM                     #
+# statistics.                                                                            #
+##########################################################################################
+
+##########################################################################################
+# Use the `path_classifiers` block to define changes to the default classification of    #
+# files.                                                                                 #
+##########################################################################################
+
+path_classifiers:
+  docs:
+    # Identify the top-level file called `generate_javadoc.py` as documentation-related.
+    - generate_javadoc.py
+  test:
+    # Override LGTM's default classification of test files by excluding all files.
+    - exclude: /
+    # Classify all files in the top-level directories test/ and testsuites/ as test code.
+    - test
+    - testsuites
+    # Classify all files with suffix `.test` as test code.
+    #        Note: use only forward slash / as a path separator.
+    #        Use ** to indicate an arbitrary parent path.
+    #        Use * to indicate any sequence of characters excluding /.
+    #        Always enclose the expression in double quotes if it includes *.
+    - "**/*.test"
+    # Refine the classifications above by excluding files in test/util/.
+    - exclude: test/util
+  # The default behavior is to tag all files created during the
+  # build as `generated`. Results are hidden for generated code. You can tag 
+  # further files as being generated by adding them to the `generated` section.
+  generated:
+    # Exclude all `*.c` files under the `ui/` directory from classification as 
+    # generated code.
+    - exclude: ui/**/*.c
+    # By default, all files not checked into the repository are considered to be
+    # 'generated'.
+  # The default behavior is to tag library code as `library`. Results are hidden 
+  # for library code. You can tag further files as being library code by adding them
+  # to the `library` section.
+  library:
+    - exclude: path/to/libary/code/**/*.c
+  # The default behavior is to tag template files as `template`. Results are hidden 
+  # for template files. You can tag further files as being template files by adding 
+  # them to the `template` section.
+  template:
+    - exclude: path/to/template/code/**/*.c
+  # Define your own category, for example: 'some_custom_category'.
+  some_custom_category:
+    # Classify all files in the top-level directory tools/ (or the top-level file 
+    # called tools).
+    - tools
+
+#########################################################################################
+# Use the `queries` block to change the default display of query results.               #
+#########################################################################################
+
+queries:
+  # Start by hiding the results of all queries.
+  - exclude: "*"
+  # Then include all queries tagged 'security' and 'correctness', and with a severity of
+  # 'error'.
+  - include:           
+      tags:
+        - "security"
+        - "correctness"           
+      severity: "error"
+  # Specifically hide the results of two queries.
+  - exclude: cpp/use-of-goto
+  - exclude: java/equals-on-unrelated-types
+  # Refine by including the `java/command-line-injection` query.
+  - include: java/command-line-injection
+
+#########################################################################################
+# Define changes to the default code extraction process.                                #
+# Each block configures the extraction of a single language, and modifies actions in a  #
+# named step. Every named step includes automatic default actions,                      #
+# except for the 'prepare' step. The steps are performed in the following sequence:     #
+# prepare                                                                               #
+# after_prepare                                                                         #
+# configure (C/C++ only)                                                                #
+# python_setup (Python only)                                                            #
+# before_index                                                                          #
+# index                                                                                 #
+##########################################################################################
+
+#########################################################################################
+# Environment variables available to the steps:                                         #
+#########################################################################################
+
+# LGTM_SRC
+#   The root of the source tree.
+# LGTM_WORKSPACE
+#   An existing (initially empty) folder outside the source tree.
+#   Used for temporary download and setup commands.
+
+#########################################################################################
+# Use the extraction block to define changes to the default code extraction process     #
+# for one or more languages. The settings for each language are defined in a child      #
+# block, with one or more steps.                                                        #
+#########################################################################################
+
+extraction: 
+  # Define settings for C/C++ analysis
+  #####################################
+  cpp:
+    # The `prepare` step exists for customization on LGTM.com only.
+    # prepare:
+    #   # The `packages` section is valid for LGTM.com only. It names Ubuntu packages to
+    #   # be installed.
+    #   packages:
+    #     - libxml2-dev
+    #     - libxslt1-dev
+    # Add an `after-prepare` step if you need to run commands after the prepare step.
+    # Each command should be listed on a separate line.
+    # This step is useful for C/C++ analysis where you want to prepare the environment
+    # for the `configure` step without changing the default behavior for that step. 
+    after_prepare:
+      - export GNU_MAKE=make
+      - export GIT=true
+    # The `configure` step generates build configuration files which the `index` step
+    # then uses to build the codebase.
+    configure:
+      command:
+        - ./prepare_deps
+    # Optional step. You should add a `before_index` step if you need to run commands
+    # before the `index` step.
+    before_index:
+      - export BOOST_DIR=$LGTM_SRC/boost
+      - export GTEST_DIR=$LGTM_SRC/googletest
+      - export HUNSPELL_DIR=$LGTM_SRC/hunspell
+      - export CRYPTOPP_DIR=$LGTM_SRC/cryptopp
+    # The `index` step builds the code and extracts information during the build
+    # process.
+    index:
+      # Override the autobuild process by specifying a list of custom build commands
+      # to use instead. 
+      build_command:
+        - $GNU_MAKE -j2 -s
+      # Specify that all project or solution files should be used for extraction.
+      # Default: false.
+      all_solutions: true
+      # Specify a list of one or more project or solution files for extraction.
+      # Default: LGTM chooses the file closest to the root of the repository (this may
+      # fail if there are multiple candidates).
+      solution: 
+        - myProject.sln
+      # Specify MSBuild settings
+      msbuild:
+        # Specify a list of additional arguments to MSBuild. Default: empty.
+        arguments: /p:Platform=x64 /p:Configuration=Release
+        # Specify the MSBuild configuration to use, for example, debug or release.
+        # Default: read from the solution file or files.
+        configuration:
+        # Specify the platform to target, for example: x86, x64, or Any CPU.
+        # Default: read from the solution file or files.
+        platform:
+        # Specify the MSBuild target. Default: rebuild.
+        target:
+      # Specify whether or not to perform a NuGet restore for extraction. Default: true.
+      nuget_restore: false
+      # Specify a version of Microsoft Visual Studio to use for MSBuild or any custom
+      # build commands (build_command). For example:
+      #    10 for Visual Studio 2010
+      #    12 for Visual Studio 2012
+      #    14 for Visual Studio 2015
+      #    15 for Visual Studio 2017
+      # Default: read from project files.
+      vstools_version: 10
+
+  # Define settings for C# analysis
+  ##################################
+  csharp:
+    # The `prepare` step exists for customization on LGTM.com only.
+    # prepare:
+    #   packages:
+    #     - example_package
+    # Add an `after-prepare` step if you need to run commands after the `prepare` step.
+    # Each command should be listed on a separate line.
+    after_prepare:
+      - export PATH=$LGTM_WORKSPACE/tools:$PATH
+    # The `index` step builds the code and extracts information during the build
+    # process.
+    index:
+      # Specify that all project or solution files should be used for extraction.
+      # Default: false.
+      all_solutions: true
+      # Specify a list of one or more project or solution files for extraction.
+      # Default: LGTM chooses the file closest to the root of the repository (this may
+      # fail if there are multiple candidates).
+      solution: 
+        - myProject.sln
+      # Override the autobuild process by specifying a list of custom build commands
+      # to use instead. 
+      build_command:
+        - ./example-compile-all.sh
+      # By default, LGTM analyzes the code by building it. You can override this,
+      # and tell LGTM not to build the code. Beware that this can lead
+      # to less accurate results.
+      buildless: true
+      # Specify .NET Core settings.
+      dotnet:
+        # Specify additional arguments to `dotnet build`.
+        # Default: empty.
+        arguments: "example_arg"
+        # Specify the version of .NET Core SDK to use.
+        # Default: The version installed on the build machine.
+        version: 2.1
+      # Specify MSBuild settings.
+      msbuild:
+        # Specify a list of additional arguments to MSBuild. Default: empty.
+        arguments: /P:WarningLevel=2
+        # Specify the MSBuild configuration to use, for example, debug or release.
+        # Default: read from the solution file or files.
+        configuration: release
+        # Specify the platform to target, for example: x86, x64, or Any CPU.
+        # Default: read from the solution file or files.
+        platform: x86
+        # Specify the MSBuild target. Default: rebuild.
+        target: notest
+      # Specify whether or not to perform a NuGet restore for extraction. Default: true.
+      nuget_restore: false
+      # Specify a version of Microsoft Visual Studio to use for MSBuild or any custom
+      # build commands (build_command). For example:
+      #    10 for Visual Studio 2010
+      #    12 for Visual Studio 2012
+      #    14 for Visual Studio 2015
+      #    15 for Visual Studio 2017
+      # Default: read from project files
+      vstools_version: 10
+      # Specify additional options for the extractor,
+      # for example --fast to perform a faster extraction that produces a smaller 
+      # database.
+      extractor: "--fast"
+
+  # Define settings for Go analysis
+  ##################################
+  go:
+    # The `prepare` step exists for customization on LGTM.com only.
+    # prepare:
+    #   packages:
+    #     - example_package
+    # Add an `after-prepare` step if you need to run commands after the `prepare` step.
+    # Each command should be listed on a separate line.
+    after_prepare:
+      - export PATH=$LGTM_WORKSPACE/tools:$PATH
+    # The `index` step builds the code and extracts information during the build
+    # process.
+    index:
+      # Override the autobuild process by specifying a list of custom build commands
+      # to use instead.
+      build_command:
+        - ./compile-all.sh
+
+  # Define settings for Java analysis
+  ####################################
+  java:
+    # The `prepare` step exists for customization on LGTM.com only.
+    # prepare:
+    #   packages:
+    #     - example_package
+    # Add an `after-prepare` step if you need to run commands after the prepare step.
+    # Each command should be listed on a separate line.
+    after_prepare:
+      - export PATH=$LGTM_WORKSPACE/tools:$PATH
+    # The `index` step extracts information from the files in the codebase.
+    index:
+      # Specify Gradle settings.
+      gradle:
+        # Specify the required Gradle version.
+        # Default: determined automatically.
+        version: 4.4
+      # Override the autobuild process by specifying a list of custom build commands
+      # to use instead. 
+      build_command: ./compile-all.sh
+      # Specify the Java version required to build the project.
+      java_version: 11
+      # Specify whether to extract Java .properties files
+      # Default: false
+      properties_files: true
+      # Specify Maven settings.
+      maven:
+        # Specify the path (absolute or relative) of a Maven settings file to use.
+        # Default: Maven uses a settings file in the default location, if it exists.
+        settings_file: /opt/share/settings.xml
+        # Specify the path of a Maven toolchains file.
+        # Default: Maven uses a toolchains file in the default location, if it exists.
+        toolchains_file: /opt/share/toolchains.xml
+        # Specify the required Maven version.
+        # Default: the Maven version is determined automatically, where feasible.
+        version: 3.5.2
+      # Specify how XML files should be extracted:
+      #   all = extract all XML files.
+      #   default = only extract XML files named `AndroidManifest.xml`, `pom.xml`, and `web.xml`.
+      #   disabled = do not extract any XML files.
+      xml_mode: all
+
+  # Define settings for JavaScript analysis
+  ##########################################
+  javascript:
+    # The `prepare` step exists for customization on LGTM.com only.
+    # prepare:
+    #   packages:
+    #     - example_package
+    # Add an `after-prepare` step if you need to run commands after the prepare step.
+    # Each command should be listed on a separate line.
+    after_prepare:
+      - export PATH=$LGTM_WORKSPACE/tools:$PATH
+    # The `index` step extracts information from the files in the codebase.
+    index:
+      # Specify a list of files and folders to extract.
+      # Default: The project root directory.
+      include:
+        - src/js
+      # Specify a list of files and folders to exclude from extraction.
+      exclude:
+        - thirdparty/lib
+      # You can add additional file types for LGTM to extract, by mapping file 
+      # extensions (including the leading dot) to file types. The usual 
+      # include/exclude patterns apply, so, for example, `.jsm` files under
+      # `thirdparty/lib` will not be extracted.
+      filetypes:
+        ".jsm": "js"
+        ".tmpl": "html"
+      # Specify a list of glob patterns to include/exclude files from extraction; this 
+      # is applied on top of the include/exclude paths from above; patterns are 
+      # processed in the same way as for path classifiers above.
+      # Default: include all files with known extensions (such as .js, .ts and .html),
+      # but exclude files ending in `-min.js` or `.min.js` and folders named `node_modules`
+      # or `bower_components`
+      filters:
+        # exclude any *.ts files anywhere.
+        - exclude: "**/*.ts"
+        # but include *.ts files under src/js/typescript.
+        - include: "src/js/typescript/**/*.ts"
+      # Specify how TypeScript files should be extracted:
+      #   none = exclude all TypeScript files.
+      #   basic = extract syntactic information from TypeScript files.
+      #   full = extract syntactic and type information from TypeScript files.
+      # Default: full.
+      typescript: basic
+      # By default, LGTM doesn't extract any XML files. You can override this by 
+      # using the `xml_mode` property and setting it to `all`.
+      xml_mode: all
+
+  # Define settings for Python analysis
+  ######################################
+  python:
+    # The `prepare` step exists for customization on LGTM.com only.
+    # prepare:
+    #   # The `packages` section is valid for LGTM.com only. It names packages to
+    #   # be installed.
+    #   packages: libpng-dev
+    # This step is useful for Python analysis where you want to prepare the 
+    # environment for the `python_setup` step without changing the default behavior 
+    # for that step.
+    after_prepare:
+      - export PATH=$LGTM_WORKSPACE/tools:$PATH
+      # This sets up the Python interpreter and virtual environment, ready for the 
+      # `index` step to extract the codebase.
+    python_setup:
+      # Specify packages that should NOT be installed despite being mentioned in the
+      # requirements.txt file.
+      # Default: no package marked for exclusion.
+      exclude_requirements:
+        - pywin32
+      # Specify a list of pip packages to install.
+      # If any of these packages cannot be installed, the extraction will fail.
+      requirements:
+        - Pillow
+      # Specify a list of requirements text files to use to set up the environment,
+      # or false for none. Default: any requirements.txt, test-requirements.txt,
+      # and similarly named files identified in the codebase are used.
+      requirements_files:
+        - required-packages.txt
+      # Specify a setup.py file to use to set up the environment, or false for none.
+      # Default: any setup.py files identified in the codebase are used in preference
+      # to any requirements text files.
+      setup_py: new-setup.py
+      # Override the version of the Python interpreter used for setup and extraction
+      # Default: Python 3.
+      version: 2
+    # Optional step. You should add a `before_index` step if you need to run commands
+    # before the `index` step.
+    before_index:
+      - antlr4 -Dlanguage=Python3 Grammar.g4
+    # The `index` step extracts information from the files in the codebase.
+    index:
+      # Specify a list of files and folders to exclude from extraction.
+      # Default: Git submodules and Subversion externals.
+      exclude:
+        - legacy-implementation
+        - thirdparty/libs
+      filters:
+       - exclude: "**/documentation/examples/snippets/*.py"
+       - include: "**/documentation/examples/test_application/*"
+      include:
+        - example/to/include



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/e91d6e5c26bc9cb99e899bd754322a5d6f89b2e7

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/e91d6e5c26bc9cb99e899bd754322a5d6f89b2e7
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20200902/b6ea45dd/attachment-0001.htm>


More information about the vc mailing list