abuild-lint

A linting utility for Alpine Linux APKBUILDs

git clone https://git.8pit.net/abuild-lint.git

  1.Dd March 13 2018
  2.Dt ABUILD-LINT 1
  3.Os
  4.Sh NAME
  5.Nm abuild-lint
  6.Nd Linting utility for Alpine Linux APKBUILDs
  7.Sh SYNOPSIS
  8.Nm abuild-lint
  9.Ar aport ...
 10.Sh DESCRIPTION
 11The
 12.Nm
 13utility parses Alpine Linux APKBUILDs and checks them for style
 14mistakes. The
 15.Ar aport
 16which should be checked can be specified as a path to an APKBUILD
 17or as a path to a directory containing an APKBUILD. If no
 18.Ar aport
 19is specified
 20.Nm
 21searches for an APKBUILD file in the current directory.
 22.Pp
 23Regarding the checks
 24.Nm
 25differentiates between local declaration and global declaration. Global
 26declaration are the ones made outside of function and local ones are the
 27ones made inside a function. Additionally, the terms metadata variables
 28and metadata functions are used in the following section. The term
 29metadata variables refers to variables declared in an APKBUILD which are
 30picked up and parsed by
 31.Xr abuild 1
 32directly, an example for this is the
 33.Va pkgname
 34variable. The metadata functions refers to functions called from
 35.Xr abuild 1 ,
 36an example for this is the
 37.Fn build
 38function.
 39.Sh PERFORMED CHECKS
 40This section is a list of all checks performed by
 41.Nm
 42sorted alphabetically.
 43.\" Add a subsection for each error from errors.go
 44.Ss Address comment
 45Check if comments expected to contain a valid
 46.Em RFC 5322
 47address (maintainer and contributor comments) actually contain one.
 48.Ss Address separator
 49Checks if comments expected to contain a valid address separate the
 50address from the comment prefix with an
 51.Xr ascii 7
 52space character.
 53.Ss Amount of maintainer comments
 54Checks if more than one maintainer comment is present.
 55.Ss Contributor comment order
 56Checks if all contributor comments are declared before the maintainer
 57comment.
 58.Ss Comment prefixes
 59Checks if all comments start with an
 60.Xr ascii 7
 61space character.
 62.Ss Forbidden Bashisms
 63Checks for
 64.Xr bash 1
 65extensions which are not allowed to be used.
 66.Ss Function order
 67Checks if all declared function are declared in the same order they are
 68called by
 69.Xr abuild 1 .
 70.Ss Global command substitutions
 71Checks that command substitutions are not used outside of functions.
 72.Ss Globally declared variables
 73Checks if all globally declared non-metadata variables are prefixed with
 74a single underscore character.
 75.Ss Locally declared variables
 76Checks if all locally declared variables are declared using the special
 77.Em local
 78keyword.
 79.Ss Long parameter expansions
 80Checks if all long parameter expansions of the form
 81.Em ${varname}
 82can't be replaced by a short parameter expansion of the form
 83.Em $varname .
 84.Ss Maintainer comment
 85Checks that a maintainer comment is present.
 86.Ss Maintainer comment order
 87Checks that the maintainer comment is declared before the first variable
 88assignment.
 89.Ss Missing metadata variable
 90Checks if all required metadata variables where defined.
 91.Ss Post function declaration metadata
 92Checks if checksum metadata is declared after the last function
 93declaration.
 94.Ss Pre function declaration metadata
 95Checks if all metadata variables (except checksums) are declared before
 96the first function declaration.
 97.Ss Repeated contributor comment
 98Checks if all declared contributor comments have a unique
 99.Em RFC 5233
100address.
101.Ss Unused variables
102Checks if all declared non-metadata variables are actually used
103somewhere in the APKBUILD.
104.Sh EXIT STATUS
105If
106.Nm
107didn't find any style violations in the given
108.Ar aports
109it exits with exit status zero. If an error occurred or if a style
110violation was found in one of the given
111.Ar aports
112.Nm
113exits with a non-zero exit status.
114.Sh SEE ALSO
115.Xr abuild 1 ,
116.Xr APKBUILD 5