Skip to content

Commit

Permalink
Various linter fixes (#4013)
Browse files Browse the repository at this point in the history
* Linter: Perform a full lint on push to ci-debug

* Linter: MD fixes

* Linter: Python fixes

* Linter: Ruby fixes

* Linter: SQL fixes and disable sql-lint

sql-lint isn't suited for static use

* Linter: HTML fixes

* Linter: Lua fixes
  • Loading branch information
terryburton authored Mar 22, 2021
1 parent 7c7c730 commit 2ea43e1
Show file tree
Hide file tree
Showing 48 changed files with 1,165 additions and 1,137 deletions.
11 changes: 6 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ about: Used to report a defect in server source code, default configuration file

See [here](https://github.com/FreeRADIUS/freeradius-server/blob/master/doc/source/bugs.md) for debugging instructions and how to obtain backtraces.

# Defect
## How to reproduce the issue
## Defect

### How to reproduce the issue

A clear and concise list of steps describing how to describe the issue.
## Output of ``[radiusd|freeradius] -X`` showing issue occurring

### Output of ``[radiusd|freeradius] -X`` showing issue occurring
_(you may need to run ``[radiusd|freeradius] -fxx -l stdout`` if using eg RADIUS with TLS)_

```text
COPY/PASTE OUTPUT HERE (WITHIN BACKTICKS). NO PASTEBIN (ET AL) LINKS!
```
## Full backtrace from LLDB or GDB
### Full backtrace from LLDB or GDB

```text
COPY/PASTE OUTPUT HERE (WITHIN BACKTICKS). NO PASTEBIN (ET AL) LINKS!
Expand Down
84 changes: 43 additions & 41 deletions .github/PULL_REQUEST_TEMPLATE/dictionary.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,89 @@ name: Dictionary updates
about: Used to submit changes for vendor dictionaries or standards dictionaries
---

For dictionary changes please open pull requests for both the `master` and `v3.0.x` branches
following the submission checklists below.
# Dictionary updates

*Note: The attribute referencing syntax in `master` has changed. When referencing nested
attributes such as VSAs or TLVs the complete path is used. The reference string
for the `Option-Request` attribute in the example below would be
`Vendor-Specific.CableLabs.Option-Request`.
This is why attribute prefixes are NOT used in the `master` branch.*
For dictionary changes please open pull requests for both the `master` and
`v3.0.x` branches following the submission checklists below.

# Submission checklist `master` branch
*Note: The attribute referencing syntax in `master` has changed. When
referencing nested attributes such as VSAs or TLVs the complete path is used.
The reference string for the `Option-Request` attribute in the example below
would be `Vendor-Specific.CableLabs.Option-Request`. This is why attribute
prefixes are NOT used in the `master` branch.*

## Submission checklist `master` branch

- [ ] Vendor prefix ***NOT*** added for `vendor` attributes

**Good**
```text
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE Option-Request 1 octets
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE Option-Request 1 octets
```
**Bad**
```text
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE CableLabs-Option-Request 1 octets
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE CableLabs-Option-Request 1 octets
```
- [ ] Parent prefix ***NOT*** added for `tlv` attributes

**Good**
```text
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE AKM-Suite .1 octets
ATTRIBUTE Cipher .2 byte
ATTRIBUTE Anonce .3 octets
ATTRIBUTE EAPOL-Key-Frame .4 octets
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE AKM-Suite .1 octets
ATTRIBUTE Cipher .2 byte
ATTRIBUTE Anonce .3 octets
ATTRIBUTE EAPOL-Key-Frame .4 octets
```
**Bad**
```text
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE DPSK-Params-AKM-Suite .1 octets
ATTRIBUTE DPSK-Params-Cipher .2 byte
ATTRIBUTE DPSK-Params-Anonce .3 octets
ATTRIBUTE DPSK-Params-EAPOL-Key-Frame .4 octets
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE DPSK-Params-AKM-Suite .1 octets
ATTRIBUTE DPSK-Params-Cipher .2 byte
ATTRIBUTE DPSK-Params-Anonce .3 octets
ATTRIBUTE DPSK-Params-EAPOL-Key-Frame .4 octets
```
- [ ] Dictionary tested by starting the server with the new dictionary loaded (`radiusd -C`).
- [ ] Dictionary run through [format.pl](https://github.com/FreeRADIUS/freeradius-server/blob/master/scripts/dict/format.pl) (`scripts/dict/format.pl <path to dictionary>`).
- [ ] **New dictionaries only** - Dictionary added to the include list in the top level `dictionary` file of the protocol dictionary.


# Submission checklist `v3.0.x` branch
## Submission checklist `v3.0.x` branch
- [ ] Vendor prefix added for `vendor` attributes

**Good**
```text
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE CableLabs-Option-Request 1 octets
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE CableLabs-Option-Request 1 octets
```
**Bad**
```text
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE Option-Request 1 octets
VENDOR CableLabs 4491
BEGIN-VENDOR CableLabs
ATTRIBUTE Option-Request 1 octets
```

- [ ] Parent prefix added for `tlv` attributes

**Good**
```text
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE DPSK-Params-AKM-Suite .1 octets
ATTRIBUTE DPSK-Params-Cipher .2 byte
ATTRIBUTE DPSK-Params-Anonce .3 octets
ATTRIBUTE DPSK-Params-EAPOL-Key-Frame .4 octets
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE DPSK-Params-AKM-Suite .1 octets
ATTRIBUTE DPSK-Params-Cipher .2 byte
ATTRIBUTE DPSK-Params-Anonce .3 octets
ATTRIBUTE DPSK-Params-EAPOL-Key-Frame .4 octets
```
**Bad**
```text
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE AKM-Suite .1 octets
ATTRIBUTE Cipher .2 byte
ATTRIBUTE Anonce .3 octets
ATTRIBUTE EAPOL-Key-Frame .4 octets
ATTRIBUTE DPSK-Params 153 tlv
ATTRIBUTE AKM-Suite .1 octets
ATTRIBUTE Cipher .2 byte
ATTRIBUTE Anonce .3 octets
ATTRIBUTE EAPOL-Key-Frame .4 octets
```
- [ ] Dictionary tested by starting the server with the new dictionary loaded (`radiusd -C`).
- [ ] Dictionary run through [format.pl](https://github.com/FreeRADIUS/freeradius-server/blob/v3.0.x/share/format.pl) (`share/format.pl <path to dictionary>`).
Expand Down
31 changes: 13 additions & 18 deletions .github/contributing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Introduction
============
# Contributing

## Introduction

The FreeRADIUS project wouldn't exist without contributions from a significant number of developers.

Expand All @@ -13,8 +14,7 @@ be acted on and in a timely manner.
If you choose to ignore these guidelines our response will be a link to this document.


GitHub Issue Tracker
====================
## GitHub Issue Tracker

The GitHub issue tracker is for non-security related defect reports, feature requests, and
pull-requests ONLY.
Expand All @@ -29,11 +29,10 @@ repositories.
Security issues should be reported to [email protected] especially if they can be remotely
exploited. This ensures that patches can be developed before the exploit is made public.

Defect reporting
================

Before reporting a defect
-------------------------
## Defect reporting

### Before reporting a defect

Verify it's still present in the Git HEAD. Checkout the appropriate branch for the version of the
server you're working with, as listed [here](http://doc.freeradius.org), build the server and attempt
Expand All @@ -47,9 +46,7 @@ Git HEAD.
Do not report non-security defects for EOL branches (as listed on doc.freeradius.org), or old releases.
Issues reported for these branches will be closed and locked.


Contents of a defect report
---------------------------
### Contents of a defect report

See [doc/bugs](https://github.com/FreeRADIUS/freeradius-server/blob/master/doc/source/bugs.md) for information
on what to include, and how to obtain it.
Expand All @@ -60,8 +57,7 @@ GitHub will automatically link your issue to other pre-existing issues when it e
string.


Pull requests and coding standards
==================================
## Pull requests and coding standards

If you're developing a new feature, module, or writing large amounts of code to fix a defect, contact
a member of the FreeRADIUS development team first. For simpler one or two line fixes go ahead and
Expand All @@ -83,15 +79,15 @@ If you're creating a new module you may wish to read the
You may also wish to utilise the [doxygen site](http://doc.freeradius.org) to review code documentation.

The doxygen site contains the complete reference of all API functions with doxygen headers as well
as structs and callback declarations. http://doc.freeradius.org is updated within one minute of each
as structs and callback declarations. <https://doc.freeradius.org> is updated within one minute of each
commit to the master branch of the freeradius-server repository.

Finally, this file was written to be displayed automatically on the GitHub issue tracker, so
Git/GitHub knowledge is assumed. If you're wondering what a pull-request is, this document may be of
some use http://wiki.freeradius.org/contributing/GitHub.
some use <http://wiki.freeradius.org/contributing/GitHub>.

Continuous Integration Tests (CIT)
==================================

## Continuous Integration Tests (CIT)

If possible include test cases in your pull-requests.

Expand All @@ -108,4 +104,3 @@ way to write new tests is to use the existing tests as examples.

Tests are run via Travis for each pull-request, and on every commit by a developer with repository
access.

3 changes: 3 additions & 0 deletions .github/linters/.luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
std = {
globals = {"fr","instantiate","detach","authorize","authenticate","post_auth","preacct","accounting","xlat","pairs","print","string","type"}
}
11 changes: 8 additions & 3 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:

lint:
name: Super-Linter. ${{ fromJSON('["Changes-only", "Full"]')[github.ref == 'refs/heads/linter'] }}
name: Super-Linter. ${{ fromJSON('["Changes-only", "Full"]')[github.ref == 'refs/heads/linter' || github.ref == 'refs/heads/ci-debug'] }}
runs-on: ubuntu-latest

steps:
Expand All @@ -32,12 +32,17 @@ jobs:
# jscpd:
# Disable entirely
# Has a hair trigger and isn't useful enough to warrant tuning
#
# sql-lint:
# Disable entirely
# Not suitable as a standalone linter
#
- name: Lint
uses: github/super-linter@v3
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: (.*/)?(configure|config\.sub|config\.guess|missing|install-sh|freeradius\.css|toc_focus\.js|asciidoc/sass/.*\.scss)
VALIDATE_ALL_CODEBASE: ${{ github.ref == 'refs/heads/linter' }}
FILTER_REGEX_EXCLUDE: (.*/)?(configure|config\.sub|config\.guess|missing|install-sh|freeradius\.css|toc_focus\.js|asciidoc/sass/.*\.scss|doc/templates/.*\.html|doc/doxygen/extra/.*\.html)
VALIDATE_ALL_CODEBASE: ${{ github.ref == 'refs/heads/linter' || github.ref == 'refs/heads/ci-debug' }}
VALIDATE_JSCPD: false
VALIDATE_SQL: false
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The GitHub issue tracker and mailing lists have a strict code of conduct.

> Only technical discussion related to FreeRADIUS, the protocols it implements, and its dependencies
> are permitted in GitHub communications and on the mailing list.
>
>
> Please note that any off-topic discussion will result in a warning. Continued off topic discussion
> will result in the individual being unsubscribed from the mailing lists and/or permanent
> banishment from the GitHub repositories.
Expand All @@ -18,7 +18,7 @@ it does not require participants to be explicitly "inclusive" or "accepting" of
requires participants to be *blind* to non-technical subjects, as those subjects are explicitly off
topic. The FreeRADIUS community is inclusive by virtue of not being exclusionary.

If you believe that the implicit biases of community members may affect how your contributions are
If you believe that the implicit biases of community members may affect how your contributions are
evaluated, you are invited to anonymise your contributions. You will not be penalised for use of
pseudonyms or anonymised identities when creating/signing patches, or posting on the mailing list(s).

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ of people, in sites ranging from 10 to 10 million+ users.
Please see the [documentation](doc/) directory, which has full
documentation for version 4.

Please also see https://freeradius.org and https://wiki.freeradius.org
Please also see <https://freeradius.org> and <https://wiki.freeradius.org>
for additional documentation.

## Installation
Expand Down Expand Up @@ -75,7 +75,7 @@ The debug output is explained in detail in the

Many questions are answered on the Wiki:

https://wiki.freeradius.org
<https://wiki.freeradius.org>

Read the configuration files. Many parts of the server are
documented only with extensive comments in the configuration files.
Expand All @@ -84,7 +84,7 @@ Search the mailing lists. For example, using Google, searching
"site:lists.freeradius.org <search term>" will return results from
the FreeRADIUS mailing lists.

https://freeradius.org/support/
<https://freeradius.org/support/>

Instructions for what to post on the mailing list are [on the
wiki](http://wiki.freeradius.org/list-help). Please note that we DO
Expand All @@ -109,7 +109,7 @@ mailing lists first to determine whether it really is a defect or
missing feature.

Instructions for gathering data for defect reports can be found in
[here](doc/antora/modules/developers/pages/bugs.adoc) or on the
[here](doc/antora/modules/developers/pages/bugs.adoc) or on the
[wiki](https://wiki.freeradius.org/project/bug-reports).

Under no circumstances should the issue tracker be used for support
Expand Down
6 changes: 3 additions & 3 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If the local system has [Antora
installed](https://docs.antora.org/antora/latest/install/install-antora/),
then you can run:

$ make docsite
make docsite

The output HTML is placed in the following location:

Expand All @@ -24,14 +24,14 @@ The output HTML is placed in the following location:
If Antora is not installed locally, it can usually be installed from
`npm` (a command available once you install [Node.js](https://nodejs.org/)):

$ npm i -g @antora/[email protected] @antora/[email protected]
npm i -g @antora/[email protected] @antora/[email protected]

## Basic HTML

If the local system has Asciidoctor and Pandoc installed, then it is
possible to create simple HTML output via the following command:

$ make html
make html

The build process will create one `html` file for every `adoc` file in
this directory. Note that Antora uses a different syntax for
Expand Down
Loading

0 comments on commit 2ea43e1

Please sign in to comment.