Skip to content

CI: check for source files which should not be executable

Karl Wette requested to merge ANU-CGA/lalsuite:ci-check-executable-files into master

Description

This MR adds a new CI job lint:execute to check for source files which should not be executable. Any files failing this requirement are reported in a Code Quality report. The lint:execute CI job is quick to run (< minute).

The policy on executable files implemented by lint:execute is pretty broad. Basically no source files may be executable except for build system or maintainer scripts, i.e.:

  • 00boot
  • files in the top-level common/ directory
  • files in a conda/ directory
  • files in a debian/ directory
  • files in a gnuscropts/ directory

Below covers some common cases where one might think a file needs to be executable, but actually doesn't:

  • Internal scripts which may occasionally need to be run by a maintainer, e.g. to generate new reference results, can now be run using the internal_scripts_{sh,py} variables:
    • Add include $(top_srcdir)/gnuscripts/lalsuite_test.am to the Makefile.am if not already present
    • Add the name of the non-executable script (with an appropriate extension, e.g. .sh or .py) to the appropriate internal_scripts_{sh,py} variable
    • make <script> will then run <script> in the LALSuite test environment, using the configured version of Python, pointing to the LAL/Python libraries in the source tree, etc.
  • Test scripts do not need to be executable. For example, a shell script test_something should be renamed to test_something.sh, and the build system will then run the script under the system shell (typically sh). Similarly for Python test scripts.
  • Scripts which are installed e.g. with dist_bin_SCRIPTS do not need to be executable; they will be made executable once installed.
  • Scripts which are not installed probably shouldn't be part of LALSuite, as they're not usable by anyone not building from source. I've removed the execute permissions from such scripts but otherwise not done anything with them.

Closes #747 (closed)

API Changes and Justification

Backwards Compatible Changes

  • This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions
  • This change adds new classes/functions/structs/types to a public C header file or Python module

Backwards Incompatible Changes

  • This change modifies an existing class/function/struct/type definition in a public C header file or Python module
  • This change removes an existing class/function/struct/type from a public C header file or Python module

Review Status

n/a

Merge request reports